|q⟩ Bad Qubits

intermediate · Physics · Operators, Eigenvalues & Spectral Theorem

Matrix Elements

A linear operator becomes concrete the moment you pick a basis: it turns into a grid of numbers, a matrix. The individual numbers in that grid are called matrix elements, and computing them is the everyday arithmetic of quantum mechanics.

Definition

Let {e1,,en}\{|e_1\rangle, \dots, |e_n\rangle\} be an orthonormal basis, so eiej=δij\langle e_i | e_j\rangle = \delta_{ij}. For a linear operator AA, the matrix element between basis vectors ei|e_i\rangle and ej|e_j\rangle is the complex number

Aij=eiAej.A_{ij} = \langle e_i | A | e_j \rangle.

Read it inside out: first AA acts on ej|e_j\rangle to produce a vector AejA|e_j\rangle, then you take the inner product of that vector with ei|e_i\rangle. The result is a single scalar — the entry in row ii, column jj of the matrix of AA.

Why this recovers the whole matrix

Recall from the previous lesson that Aej=iAijeiA|e_j\rangle = \sum_i A_{ij}|e_i\rangle. Take the inner product of both sides with ei\langle e_i| and use orthonormality:

eiAej=kAkjeiek=kAkjδik=Aij.\langle e_i | A | e_j \rangle = \sum_k A_{kj}\,\langle e_i | e_k\rangle = \sum_k A_{kj}\,\delta_{ik} = A_{ij}.

So the bracket eiAej\langle e_i | A | e_j \rangle is exactly the coefficient AijA_{ij}. Sweeping ii and jj over the basis fills in the entire matrix. The matrix and the operator carry the same information once a basis is fixed.

Reading off the matrix from gate actions

For a qubit with the computational basis {0,1}\{|0\rangle, |1\rangle\} (with 0|0\rangle labeling row/ column 00 and 1|1\rangle labeling row/column 11), the three Pauli operators are

X=(0110),Y=(0ii0),Z=(1001).X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \quad Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}, \quad Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}.

Take YY. Its defining action is Y0=i1Y|0\rangle = i|1\rangle and Y1=i0Y|1\rangle = -i|0\rangle. To find 0Y1\langle 0 | Y | 1 \rangle, compute Y1=i0Y|1\rangle = -i|0\rangle and then project onto 0\langle 0|:

0Y1=0(i0)=i00=i.\langle 0 | Y | 1 \rangle = \langle 0 | (-i|0\rangle) = -i\,\langle 0 | 0\rangle = -i.

That i-i sits in row 00, column 11 — exactly the top-right entry of the matrix above. Likewise

1Y0=1(i1)=i,\langle 1 | Y | 0 \rangle = \langle 1 | (i|1\rangle) = i,

the bottom-left entry. Notice 0Y1=1Y0\langle 0|Y|1\rangle = \overline{\langle 1|Y|0\rangle}: the off-diagonal elements are complex conjugates of each other. That is the Hermitian symmetry Aij=AjiA_{ij} = \overline{A_{ji}}, a property we will study in detail two lessons from now.

A useful sanity check: the trace

The diagonal matrix elements Aii=eiAeiA_{ii} = \langle e_i | A | e_i\rangle add up to the trace,

Tr(A)=ieiAei.\operatorname{Tr}(A) = \sum_i \langle e_i | A | e_i \rangle.

Remarkably, the trace does not depend on the chosen orthonormal basis, even though the individual AiiA_{ii} do. For each Pauli matrix above, the two diagonal entries cancel, so Tr(X)=Tr(Y)=Tr(Z)=0\operatorname{Tr}(X) = \operatorname{Tr}(Y) = \operatorname{Tr}(Z) = 0.

Try it

Compute the matrix element 1Y0\langle 1 | Y | 0 \rangle of the Pauli-YY operator. It is purely imaginary — return its imaginary part as a plain number.

Run your code to see the quantum state.

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