|q⟩ Bad Qubits

intermediate · Physics · Density Matrices & Mixed States

Checkpoint: Work with Density Matrices

This checkpoint chains together the whole module: build a joint density matrix, take a partial trace, and read off both a purity and an expectation value from the reduced state.

What you are computing

Start from the partially entangled pure state

∣ψ⟩=cos⁡t ∣00⟩+sin⁡t ∣11⟩,t=π8.|\psi\rangle = \cos t\,|00\rangle + \sin t\,|11\rangle, \qquad t = \frac{\pi}{8}.

Its joint density matrix is ρAB=∣ψ⟩⟨ψ∣\rho_{AB} = |\psi\rangle\langle\psi|. Tracing out the second qubit gives a diagonal reduced state — the squared Schmidt coefficients on the diagonal:

ρA=Tr⁡B ρAB=(cos⁡2t00sin⁡2t).\rho_A = \operatorname{Tr}_B\,\rho_{AB} = \begin{pmatrix}\cos^2 t & 0\\ 0 & \sin^2 t\end{pmatrix}.

From ρA\rho_A you extract two numbers seen throughout the module:

purity=Tr⁡(ρA2)=cos⁡4t+sin⁡4t,⟨Z⟩A=Tr⁡(ρAZ)=cos⁡2t−sin⁡2t=cos⁡2t.\text{purity} = \operatorname{Tr}(\rho_A^2) = \cos^4 t + \sin^4 t, \qquad \langle Z\rangle_A = \operatorname{Tr}(\rho_A Z) = \cos^2 t - \sin^2 t = \cos 2t.

Checks to keep you honest

Try it

Carry out all three steps — build ρAB\rho_{AB}, trace out BB, then compute the purity and ⟨Z⟩A\langle Z\rangle_A of ρA\rho_A — and return their sum Tr⁡(ρA2)+⟨Z⟩A\operatorname{Tr}(\rho_A^2) + \langle Z\rangle_A.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.