Skip to content
Quantum ComputingAN INTERACTIVE OPEN TEXTBOOK
charithj.com.au

Vectors, matrices and linear algebra

Quantum states are vectors. Gates are matrices. A small calculation connects the two.

12 min readDr. Charith Jayasekara↓ Chapter PDF
By the end, you’ll be able to
  • Multiply a two-by-two matrix by a state vector.
  • Explain norm preservation for an ideal quantum gate.

We represent the basis states with two simple columns:

∣0⟩=(10),∣1⟩=(01).\lvert0\rangle=\begin{pmatrix}1\\0\end{pmatrix},\qquad \lvert1\rangle=\begin{pmatrix}0\\1\end{pmatrix}.

A general pure qubit has column (α,β)T(\alpha,\beta)^T. Its squared norm is ∣α∣2+∣β∣2=1|\alpha|^2+|\beta|^2=1.

The X gate exchanges the two amplitudes:

X=(0110),X(αβ)=(βα).X=\begin{pmatrix}0&1\\1&0\end{pmatrix},\qquad X\begin{pmatrix}\alpha\\\beta\end{pmatrix}=\begin{pmatrix}\beta\\\alpha\end{pmatrix}.

To multiply a matrix by a column, take each row’s dot product with the column. For the first row above, 0α+1β=β0\alpha+1\beta=\beta.

The Hadamard gate is

H=12(111−1).H=\frac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}.

Applying it to ∣0⟩\lvert0\rangle gives (1,1)T/2(1,1)^T/\sqrt2. Applying it again gives (1,0)T(1,0)^T. The cancellation in the second component is interference in matrix form.

An ideal closed-system gate UU satisfies U†U=IU^\dagger U=I, where the dagger means conjugate transpose. This property preserves inner products and norms, so valid states remain normalised. It also means U−1=U†U^{-1}=U^\dagger.

Measurement and noisy evolution need more general descriptions; do not assume every physical operation is a unitary gate on the subsystem you observe.

Calculate H∣1⟩H\lvert1\rangle. You should obtain (1,−1)T/2(1,-1)^T/\sqrt2. Then verify X2=IX^2=I and H2=IH^2=I directly. Use the gate playground to compare the numerical outputs with your calculation.

Reference: IBM Quantum — Single systems.

ONE IDEA FURTHER

Ready for the next step?

Your progress stays in this browser.