Quantum Computing Notation


If you have read about quantum computing before, you have definitely stumbled across expressions like ψ|\psi\rangle or 01\langle 0|1\rangle. This is Dirac notation — also called bra-ket notation — and it is the universal language of quantum mechanics and quantum computing.

For a CS student it is just linear algebra in a clever costume. Once you see through the costume, everything clicks.


The Core Idea: States Are Vectors

In quantum computing, the state of a qubit is a vector in a 2-dimensional complex vector space C2\mathbb{C}^2.

The two basis states — the quantum equivalents of 0 and 1 — are written as column vectors:

0=(10),1=(01)|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \qquad |1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}

These are called kets. A ket ψ|\psi\rangle is just any column vector representing a quantum state.

A general single-qubit state is a linear combination (superposition) of these basis vectors:

ψ=α0+β1=(αβ)|\psi\rangle = \alpha|0\rangle + \beta|1\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}

where α,βC\alpha, \beta \in \mathbb{C} and α2+β2=1|\alpha|^2 + |\beta|^2 = 1.


Bras: The Row Vector Counterpart

Every ket has a matching bra, written ψ\langle\psi|. It is the conjugate transpose (Hermitian adjoint) of the ket:

ψ=ψ=(αβ)\langle\psi| = |\psi\rangle^\dagger = \begin{pmatrix} \alpha^* & \beta^* \end{pmatrix}

where α\alpha^* is the complex conjugate of α\alpha.

So for the basis states:

0=(10),1=(01)\langle 0| = \begin{pmatrix} 1 & 0 \end{pmatrix}, \qquad \langle 1| = \begin{pmatrix} 0 & 1 \end{pmatrix}

The notation is designed so that combining a bra and a ket gives you a scalar — an inner product.


Inner Products: The Bracket

The inner product of two states ϕ\langle\phi| and ψ|\psi\rangle is written ϕψ\langle\phi|\psi\rangle — a “bra-ket”, which is where the name comes from.

For the basis states:

00=(10)(10)=1\langle 0|0\rangle = \begin{pmatrix} 1 & 0 \end{pmatrix}\begin{pmatrix} 1 \\ 0 \end{pmatrix} = 1

01=(10)(01)=0\langle 0|1\rangle = \begin{pmatrix} 1 & 0 \end{pmatrix}\begin{pmatrix} 0 \\ 1 \end{pmatrix} = 0

10=0,11=1\langle 1|0\rangle = 0, \qquad \langle 1|1\rangle = 1

This is exactly orthonormality — 0|0\rangle and 1|1\rangle are orthogonal unit vectors, just like the standard basis e^1\hat{e}_1 and e^2\hat{e}_2 you know from linear algebra.

The inner product ϕψ\langle\phi|\psi\rangle gives the probability amplitude for measuring state ϕ|\phi\rangle given that the system is in state ψ|\psi\rangle. The probability itself is ϕψ2|\langle\phi|\psi\rangle|^2.


Outer Products: Building Matrices

The outer product ψϕ|\psi\rangle\langle\phi| produces a matrix instead of a scalar. This is the key to constructing quantum gates.

For example:

00=(10)(10)=(1000)|0\rangle\langle 0| = \begin{pmatrix} 1 \\ 0 \end{pmatrix}\begin{pmatrix} 1 & 0 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}

11=(01)(01)=(0001)|1\rangle\langle 1| = \begin{pmatrix} 0 \\ 1 \end{pmatrix}\begin{pmatrix} 0 & 1 \end{pmatrix} = \begin{pmatrix} 0 & 0 \\ 0 & 1 \end{pmatrix}

01=(10)(01)=(0100)|0\rangle\langle 1| = \begin{pmatrix} 1 \\ 0 \end{pmatrix}\begin{pmatrix} 0 & 1 \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}

Notice that 00+11=I|0\rangle\langle 0| + |1\rangle\langle 1| = I — the identity matrix. This is the completeness relation, and it shows up constantly when decomposing gates.


Quantum Gates Are Unitary Matrices

A quantum gate transforms one qubit state into another. Since quantum evolution must be reversible and norm-preserving (probabilities must still sum to 1), every gate is represented by a unitary matrix UU, where UU=IUU^\dagger = I.

Applying a gate to a state is ordinary matrix-vector multiplication:

ψ=Uψ|\psi'\rangle = U|\psi\rangle

Let’s go through the most important single-qubit gates.


The Pauli-X Gate (Quantum NOT)

X=(0110)=01+10X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} = |0\rangle\langle 1| + |1\rangle\langle 0|

It flips 01|0\rangle \to |1\rangle and 10|1\rangle \to |0\rangle. Verify:

X0=(0110)(10)=(01)=1X|0\rangle = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \end{pmatrix} = |1\rangle \checkmark

X1=(0110)(01)=(10)=0X|1\rangle = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} = |0\rangle \checkmark

In the outer product form: Xψ=(01+10)(α0+β1)=α1+β0X|\psi\rangle = (|0\rangle\langle 1| + |1\rangle\langle 0|)(\alpha|0\rangle + \beta|1\rangle) = \alpha|1\rangle + \beta|0\rangle. The amplitudes are swapped — exactly what NOT does.


The Pauli-Z Gate (Phase Flip)

Z=(1001)=0011Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} = |0\rangle\langle 0| - |1\rangle\langle 1|

ZZ leaves 0|0\rangle unchanged and flips the sign (phase) of 1|1\rangle:

Z0=0,Z1=1Z|0\rangle = |0\rangle, \qquad Z|1\rangle = -|1\rangle

This does not change the measurement probabilities (12=1|-1|^2 = 1), but phase matters for interference — it is the kind of gate that makes quantum algorithms work.


The Pauli-Y Gate

Y=(0ii0)=i(1001)Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix} = i(|1\rangle\langle 0| - |0\rangle\langle 1|)

YY combines a bit flip and a phase flip:

Y0=i1,Y1=i0Y|0\rangle = i|1\rangle, \qquad Y|1\rangle = -i|0\rangle

Together XX, YY, ZZ are the Pauli matrices, the fundamental building blocks of single-qubit operations. You will see them everywhere.


The Hadamard Gate

H=12(1111)=12(00+01+1011)H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} = \frac{1}{\sqrt{2}}(|0\rangle\langle 0| + |0\rangle\langle 1| + |1\rangle\langle 0| - |1\rangle\langle 1|)

The Hadamard gate creates superposition. It maps the basis states to the diagonal basis +|+\rangle and |-\rangle:

H0=12(1111)(10)=12(11)=0+12=+H|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} = \frac{|0\rangle + |1\rangle}{\sqrt{2}} = |+\rangle

H1=12(1111)(01)=12(11)=012=H|1\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\begin{pmatrix} 0 \\ 1 \end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -1 \end{pmatrix} = \frac{|0\rangle - |1\rangle}{\sqrt{2}} = |-\rangle

+|+\rangle is a 50/50 superposition with both amplitudes positive. |-\rangle is a 50/50 superposition with a phase difference — they look identical when measured, but behave differently under further gates.

Apply HH twice and you get back to where you started: H2=IH^2 = I.


The S and T Phase Gates

S=(100i),T=(100eiπ/4)S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}, \qquad T = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix}

Both leave 0|0\rangle unchanged and rotate the phase of 1|1\rangle — by 90°90° for SS and 45°45° for TT. Note S=T2S = T^2 and Z=S2=T4Z = S^2 = T^4.

These gates are essential for universal quantum computing. The set {H,T,CNOT}\{H, T, \text{CNOT}\} is universal — any unitary operation can be approximated to arbitrary precision using only these three gates (Solovay-Kitaev theorem).


Two Qubits: Tensor Products

For a 2-qubit system, states live in a 44-dimensional space: C2C2\mathbb{C}^2 \otimes \mathbb{C}^2. The basis states are 00|00\rangle, 01|01\rangle, 10|10\rangle, 11|11\rangle, written as column vectors of length 4.

The tensor product ab=ab|a\rangle \otimes |b\rangle = |ab\rangle combines two single-qubit states:

00=00=(10)(10)=(1000),01=(0100),10=(0010),11=(0001)|00\rangle = |0\rangle \otimes |0\rangle = \begin{pmatrix}1\\0\end{pmatrix} \otimes \begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}1\\0\\0\\0\end{pmatrix}, \qquad |01\rangle = \begin{pmatrix}0\\1\\0\\0\end{pmatrix}, \qquad |10\rangle = \begin{pmatrix}0\\0\\1\\0\end{pmatrix}, \qquad |11\rangle = \begin{pmatrix}0\\0\\0\\1\end{pmatrix}

A 2-qubit gate is a 4×44 \times 4 unitary matrix.


The CNOT Gate

The Controlled-NOT gate is the canonical 2-qubit gate:

CNOT=(1000010000010010)=0000+0101+1110+1011\text{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix} = |00\rangle\langle 00| + |01\rangle\langle 01| + |11\rangle\langle 10| + |10\rangle\langle 11|

The first qubit is the control, the second is the target. The target is flipped if and only if the control is 1|1\rangle:

InputOutput
$00\rangle$
$01\rangle$
$10\rangle$
$11\rangle$

Verify the last row:

CNOT11=(1000010000010010)(0001)=(0010)=10\text{CNOT}|11\rangle = \begin{pmatrix} 1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0 \end{pmatrix}\begin{pmatrix}0\\0\\0\\1\end{pmatrix} = \begin{pmatrix}0\\0\\1\\0\end{pmatrix} = |10\rangle \checkmark

Combine CNOT with Hadamard to create entanglement. Start with 00|00\rangle, apply HH to the first qubit, then CNOT:

00HI0+120=00+102CNOT00+112|00\rangle \xrightarrow{H \otimes I} \frac{|0\rangle+|1\rangle}{\sqrt{2}} \otimes |0\rangle = \frac{|00\rangle+|10\rangle}{\sqrt{2}} \xrightarrow{\text{CNOT}} \frac{|00\rangle+|11\rangle}{\sqrt{2}}

That final state is a Bell state — the qubits are now entangled.


Putting It All Together

Here is the full notation reference at a glance:

NotationTypeMeaning
ψ\|\psi\rangleketcolumn vector — a quantum state
ψ\langle\psi\|brarow vector — conjugate transpose of the ket
ϕψ\langle\phi\|\psi\ranglebracketinner product — a scalar (probability amplitude)
ψϕ\|\psi\rangle\langle\phi\|outer producta matrix (used to build gates)
UψU\|\psi\ranglematrix-vector productapplying gate UU to state ψ\|\psi\rangle
ab\|ab\rangletensor productjoint state of two qubits

Every quantum circuit you will ever read is just a sequence of these matrix multiplications. The notation looks exotic, but the machinery is linear algebra — eigenvectors, inner products, unitary matrices. If you are comfortable with those, you already have the tools to read and reason about quantum circuits.


Further Reading

To practice computing with these by hand, the Qiskit Textbook has interactive circuit exercises. For a rigorous linear algebra treatment of the formalism, chapters 2–4 of Nielsen & Chuang are the standard reference. If you want a faster ramp, Quantum Computation: An Applied Approach by Hidary covers the same ground more concisely.