Problem 1. Consider the density matrix:

ρ=(3/424eiϕ24eiϕ1/4)

go through the conditions to ensure that this matrix is indeed a density matrix. Furthermore is the matrix a pure or mixed state, i.e. ρ=|ψψ| or ρ=ipi|ψiψi|.

Also calculate the tr(σ1ρ).

22.0 μs

Solution 1. The criteria that a matrix be a density matrix is the following:

  1. Positive semidefinite operator, therefore is Hermitian with eigenvalues 0.

  2. Has tr(ρ)=1

70.4 μs
982 μs
348 μs

[342eiϕ42eiϕ414] 

1.1 ms

So the easiest condition to check is the second one by taking the trace of the ensity matrix, as below:

15.1 μs

1 

5.8 ms

It satisfies this criteria. Now we need to check if its positive semidefinite. Since this requires that its Hermitian, we can check that ρ=ρ.

20.7 μs
ρ == ρ.adjoint()

ρ is Hermitian.

4.2 ms

Now to see if the is postive valued, we can get the eigenspectrum[1]:

15.6 μs
8.0 ms

e1=1234=0.067

e2=34+12=0.933

as we can see ρ is indeed positive and semidefinite and therefore a density matrix.

The next part is to determine if the density matrix corresponds to a pure or mixed state.

2.2 ms

For a pure state we can check that ρ2=|ψψ|ψψ|=ρ:

19.4 μs
false
343 μs

so its not a pure state but a mixed state. Finally we want to evaluate the expectation of the Pauli operator σx using tr(σxρ).

12.5 μs
49.9 ms

2cos(ϕ)2 

155 ms
10.1 μs
180 ms

1

the returned data type from ρ.eigenvals() is a julia dictionary with keys being eigenvalues (SymPy) and values the degeneracy/multiplicty. We just want the dictionary keys here.

6.3 μs