A quantum gate maps a pure state into In turn, a mixed state is mapped by that same gate into

Let's look at how to simulate the action of gates on density operators using code!

The code below intends to calculate the effect of a quantum gate U on a quantum state with density operator rho. Complete the missing lines to compute the resulting density operator after applying U on rho.

or to submit your code

To interact with codercises, please switch to a larger screen size.

Learning Objectives:

  • Explain the effect of applying gates to mixed states.
  • Determine the measurement probabilities and post-measurement states when measuring a mixed state.
  • Calculate expectation values for observables on a given mixed state.