← Exercise library← All exercises for this theme
Theme 2 — Hilbert Spaces and Dirac Notation

Properties of the trace

Keywords: trace · cyclicity · change of basis · closure relation · projector · Pauli matrices

Exercise 1 : Properties of the trace

In a finite-dimensional Hilbert space H\H of dimension nn, the trace of an operator A^\hat A is defined, for an orthonormal basis (∣ei⟩)(\ket{e_i}), by tr⁡A^=∑i⟨ei∣A^∣ei⟩=∑iAii\tr\hat A=\sum_i\bra{e_i}\hat A\ket{e_i}=\sum_iA_{ii}. We denote by 1\mathbf{1} the identity operator, which can be written as 1=∑i∣ei⟩⟨ei∣\mathbf{1}=\sum_i\ket{e_i}\bra{e_i}.

Question 1
Show that tr⁡(A^B^)=tr⁡(B^A^)\tr(\hat A\hat B)=\tr(\hat B\hat A) for all operators A^\hat A and B^\hat B.

Solution
Denoting the matrix elements by AijA_{ij} and BijB_{ij}, we have (AB)ii=∑jAijBji(AB)_{ii}=\sum_jA_{ij}B_{ji}. Thus

tr⁡(AB)=∑i∑jAijBji=∑j∑iBjiAij=∑j(BA)jj=tr⁡(BA),\tr(AB)=\sum_i\sum_jA_{ij}B_{ji}=\sum_j\sum_iB_{ji}A_{ij}=\sum_j(BA)_{jj}=\tr(BA),

where we have simply interchanged the order of the two finite sums.

Question 2
Show that the trace does not depend on the orthonormal basis chosen.

Hint
Insert the closure relation in the basis (∣ei⟩)(\ket{e_i}) twice into the expression for the trace calculated in another basis (∣fk⟩)(\ket{f_k}).

Solution
Let (∣fk⟩)(\ket{f_k}) be another orthonormal basis. Inserting the closure relation 1=∑i∣ei⟩⟨ei∣\mathbf{1}=\sum_i\ket{e_i}\bra{e_i} on both sides of A^\hat A,

∑k⟨fk∣A^∣fk⟩=∑k∑i,j⟨fk|ei⟩⟨ei∣A^∣ej⟩⟨ej|fk⟩=∑i,j⟨ei∣A^∣ej⟩∑k⟨ej|fk⟩⟨fk|ei⟩.\sum_k\bra{f_k}\hat A\ket{f_k}=\sum_k\sum_{i,j}\braket{f_k}{e_i}\bra{e_i}\hat A\ket{e_j}\braket{e_j}{f_k} =\sum_{i,j}\bra{e_i}\hat A\ket{e_j}\sum_k\braket{e_j}{f_k}\braket{f_k}{e_i}.

The last sum is ⟨ej|ei⟩=δij\braket{e_j}{e_i}=\delta_{ij}, by the closure relation in the basis (∣fk⟩)(\ket{f_k}). This leaves ∑i⟨ei∣A^∣ei⟩\sum_i\bra{e_i}\hat A\ket{e_i}: the trace is the same in both bases. In matrix terms, if UU is the unitary change-of-basis matrix, this amounts to tr⁡(U†AU)=tr⁡(AUU†)=tr⁡A\tr(U^\dagger AU)=\tr(AUU^\dagger)=\tr A, by the property established in the preceding question.

Question 3
Show that tr⁡(∣u⟩⟨v∣)=⟨v|u⟩\tr\bigl(\ket u\bra v\bigr)=\braket vu. Deduce that, for a normalised state ∣ψ⟩\ket\psi, ⟨ψ∣A^∣ψ⟩=tr⁡(∣ψ⟩⟨ψ∣A^)\bra\psi\hat A\ket\psi=\tr\bigl(\ket\psi\bra\psi\hat A\bigr).

Solution
We calculate

tr⁡(∣u⟩⟨v∣)=∑i⟨ei|u⟩⟨v|ei⟩=∑i⟨v|ei⟩⟨ei|u⟩=⟨v|u⟩.\tr\bigl(\ket u\bra v\bigr)=\sum_i\braket{e_i}{u}\braket{v}{e_i}=\sum_i\braket{v}{e_i}\braket{e_i}{u}=\braket vu .

Apply this result to ∣ψ⟩⟨ψ∣A^=∣ψ⟩(⟨ψ∣A^)\ket\psi\bra\psi\hat A=\ket\psi\bigl(\bra\psi\hat A\bigr), which is the ket-bra formed from ∣ψ⟩\ket\psi and the bra ⟨ψ∣A^\bra\psi\hat A, the adjoint of the ket A^†∣ψ⟩\hat A^\dagger\ket\psi. We obtain tr⁡(∣ψ⟩⟨ψ∣A^)=⟨ψ∣A^∣ψ⟩\tr\bigl(\ket\psi\bra\psi\hat A\bigr)=\bra\psi\hat A\ket\psi. This expression of the expectation value as a trace will be very useful when we describe mixed states by means of a density operator.

Question 4
Show that the trace of an orthogonal projector is equal to the dimension of its image.

Solution
Let P^\hat P be the orthogonal projector onto a subspace FF of dimension pp. Choose an orthonormal basis (∣e1⟩,...,∣ep⟩)(\ket{e_1},...,\ket{e_p}) of FF, completed to an orthonormal basis of H\H by vectors in F⊥F^\perp. We have P^∣ei⟩=∣ei⟩\hat P\ket{e_i}=\ket{e_i} for i≤pi\leq p and P^∣ei⟩=0\hat P\ket{e_i}=0 for i>pi>p. The trace, calculated in this basis, is therefore ∑i≤p1=p\sum_{i\leq p}1=p. Since it does not depend on the basis, this result is general. For example, tr⁡1=n\tr\mathbf{1}=n and the trace of a projector ∣ψ⟩⟨ψ∣\ket\psi\bra\psi onto a normalised vector is 11.

Question 5
Is the trace invariant under an arbitrary permutation of the factors in a product of three operators? Calculate tr⁡(σxσyσz)\tr(\sigma_x\sigma_y\sigma_z) and tr⁡(σyσxσz)\tr(\sigma_y\sigma_x\sigma_z), where the σj\sigma_j are the Pauli matrices, given that σxσy=iσz\sigma_x\sigma_y=i\sigma_z, σyσx=−iσz\sigma_y\sigma_x=-i\sigma_z and σz2=1\sigma_z^2=\mathbf{1}.

Solution
Applying the property tr⁡(AB)=tr⁡(BA)\tr(AB)=\tr(BA) to AA and the product BCBC gives tr⁡(ABC)=tr⁡(BCA)=tr⁡(CAB)\tr(ABC)=\tr(BCA)=\tr(CAB): the trace is invariant under cyclic permutations of the factors. It is not invariant under an arbitrary permutation. Indeed,

tr⁡(σxσyσz)=tr⁡(iσzσz)=i tr⁡1=2i,tr⁡(σyσxσz)=tr⁡(−iσzσz)=−2i.\tr(\sigma_x\sigma_y\sigma_z)=\tr(i\sigma_z\sigma_z)=i\,\tr\mathbf{1}=2i, \qquad \tr(\sigma_y\sigma_x\sigma_z)=\tr(-i\sigma_z\sigma_z)=-2i .

The two results differ, although the two products differ only by the exchange of the first two factors, which is not a cyclic permutation.