|q⟩ Bad Qubits

intermediate · Physics · Operators, Eigenvalues & Spectral Theorem

Checkpoint: Diagonalize an Observable

This checkpoint pulls the whole module together. You will take a Hermitian observable, find its spectrum and eigenvectors, and rebuild it from its spectral decomposition — the round trip that the spectral theorem promises always works. If your eigenvalues and eigenvectors are right, the rebuilt operator reproduces the original exactly.

The task

Diagonalize the observable

A=(1221).A = \begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix}.

It is real and symmetric, hence Hermitian, so the spectral theorem guarantees real eigenvalues and an orthonormal eigenbasis.

Step 1 — eigenvalues

Use the trace–determinant form of the characteristic equation. Here trA=2\operatorname{tr}A = 2 and detA=(1)(1)(2)(2)=3\det A = (1)(1) - (2)(2) = -3, so

λ22λ3=(λ3)(λ+1)=0λ1=3,  λ2=1.\lambda^2 - 2\lambda - 3 = (\lambda - 3)(\lambda + 1) = 0 \quad\Longrightarrow\quad \lambda_1 = 3,\ \ \lambda_2 = -1.

Both real, as required. Their sum is 2=trA2 = \operatorname{tr}A and product is 3=detA-3 = \det A — a quick consistency check.

Step 2 — eigenvectors

Solve (Aλ1)v=0(A - \lambda\mathbb{1})|v\rangle = 0 for each eigenvalue.

The two eigenvectors are orthogonal, v1v2=12(11)=0\langle v_1|v_2\rangle = \tfrac12(1 - 1) = 0, exactly as the spectral theorem demands for distinct eigenvalues of a Hermitian operator. Each is normalized to unit length.

Step 3 — reconstruct from the spectral decomposition

The spectral theorem says

A=λ1v1v1+λ2v2v2.A = \lambda_1\,|v_1\rangle\langle v_1| + \lambda_2\,|v_2\rangle\langle v_2|.

The two outer products are

v1v1=12(1111),v2v2=12(1111).|v_1\rangle\langle v_1| = \tfrac12\begin{pmatrix} 1 & 1 \\ 1 & 1\end{pmatrix}, \qquad |v_2\rangle\langle v_2| = \tfrac12\begin{pmatrix} 1 & -1 \\ -1 & 1\end{pmatrix}.

Weighting by the eigenvalues and adding,

312(1111)+(1)12(1111)=(1221)=A.3\cdot\tfrac12\begin{pmatrix} 1 & 1 \\ 1 & 1\end{pmatrix} + (-1)\cdot\tfrac12\begin{pmatrix} 1 & -1 \\ -1 & 1\end{pmatrix} = \begin{pmatrix} 1 & 2 \\ 2 & 1\end{pmatrix} = A.

The reconstruction matches AA entry by entry. In particular the (0,0)(0,0) entry is 312+(1)12=13\cdot\tfrac12 + (-1)\cdot\tfrac12 = 1, which equals A00A_{00} — the value you will return as a check.

Try it

Carry out the three steps above in code: find the eigenvalues, build normalized eigenvectors, form the spectral decomposition, and return the reconstructed (0,0)(0,0) entry of AA. A correct diagonalization returns 11.

Run your code to see the quantum state.

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