If you have read about quantum computing before, you have definitely stumbled across expressions like ∣ψ⟩ or ⟨0∣1⟩. 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.
The two basis states — the quantum equivalents of 0 and 1 — are written as column vectors:
∣0⟩=(10),∣1⟩=(01)
These are called kets. A ket ∣ψ⟩ 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⟩=(αβ)
where α,β∈C and ∣α∣2+∣β∣2=1.
Bras: The Row Vector Counterpart
Every ket has a matching bra, written ⟨ψ∣. It is the conjugate transpose (Hermitian adjoint) of the ket:
⟨ψ∣=∣ψ⟩†=(α∗β∗)
where α∗ is the complex conjugate of α.
So for the basis states:
⟨0∣=(10),⟨1∣=(01)
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 ⟨ϕ∣ and ∣ψ⟩ is written ⟨ϕ∣ψ⟩ — a “bra-ket”, which is where the name comes from.
For the basis states:
⟨0∣0⟩=(10)(10)=1
⟨0∣1⟩=(10)(01)=0
⟨1∣0⟩=0,⟨1∣1⟩=1
This is exactly orthonormality — ∣0⟩ and ∣1⟩ are orthogonal unit vectors, just like the standard basis e^1 and e^2 you know from linear algebra.
The inner product ⟨ϕ∣ψ⟩ gives the probability amplitude for measuring state ∣ϕ⟩ given that the system is in state ∣ψ⟩. The probability itself is ∣⟨ϕ∣ψ⟩∣2.
Outer Products: Building Matrices
The outer product∣ψ⟩⟨ϕ∣ produces a matrix instead of a scalar. This is the key to constructing quantum gates.
For example:
∣0⟩⟨0∣=(10)(10)=(1000)
∣1⟩⟨1∣=(01)(01)=(0001)
∣0⟩⟨1∣=(10)(01)=(0010)
Notice that ∣0⟩⟨0∣+∣1⟩⟨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 matrixU, where UU†=I.
Applying a gate to a state is ordinary matrix-vector multiplication:
∣ψ′⟩=U∣ψ⟩
Let’s go through the most important single-qubit gates.
The Pauli-X Gate (Quantum NOT)
X=(0110)=∣0⟩⟨1∣+∣1⟩⟨0∣
It flips ∣0⟩→∣1⟩ and ∣1⟩→∣0⟩. Verify:
X∣0⟩=(0110)(10)=(01)=∣1⟩✓
X∣1⟩=(0110)(01)=(10)=∣0⟩✓
In the outer product form: X∣ψ⟩=(∣0⟩⟨1∣+∣1⟩⟨0∣)(α∣0⟩+β∣1⟩)=α∣1⟩+β∣0⟩. The amplitudes are swapped — exactly what NOT does.
The Pauli-Z Gate (Phase Flip)
Z=(100−1)=∣0⟩⟨0∣−∣1⟩⟨1∣
Z leaves ∣0⟩ unchanged and flips the sign (phase) of ∣1⟩:
Z∣0⟩=∣0⟩,Z∣1⟩=−∣1⟩
This does not change the measurement probabilities (∣−1∣2=1), but phase matters for interference — it is the kind of gate that makes quantum algorithms work.
The Pauli-Y Gate
Y=(0i−i0)=i(∣1⟩⟨0∣−∣0⟩⟨1∣)
Y combines a bit flip and a phase flip:
Y∣0⟩=i∣1⟩,Y∣1⟩=−i∣0⟩
Together X, Y, Z are the Pauli matrices, the fundamental building blocks of single-qubit operations. You will see them everywhere.
The Hadamard Gate
H=21(111−1)=21(∣0⟩⟨0∣+∣0⟩⟨1∣+∣1⟩⟨0∣−∣1⟩⟨1∣)
The Hadamard gate creates superposition. It maps the basis states to the diagonal basis∣+⟩ and ∣−⟩:
H∣0⟩=21(111−1)(10)=21(11)=2∣0⟩+∣1⟩=∣+⟩
H∣1⟩=21(111−1)(01)=21(1−1)=2∣0⟩−∣1⟩=∣−⟩
∣+⟩ is a 50/50 superposition with both amplitudes positive. ∣−⟩ is a 50/50 superposition with a phase difference — they look identical when measured, but behave differently under further gates.
Apply H twice and you get back to where you started: H2=I.
The S and T Phase Gates
S=(100i),T=(100eiπ/4)
Both leave ∣0⟩ unchanged and rotate the phase of ∣1⟩ — by 90° for S and 45° for T. Note S=T2 and Z=S2=T4.
These gates are essential for universal quantum computing. The set {H,T,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 4-dimensional space: C2⊗C2. The basis states are ∣00⟩, ∣01⟩, ∣10⟩, ∣11⟩, written as column vectors of length 4.
The tensor product∣a⟩⊗∣b⟩=∣ab⟩ combines two single-qubit states:
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:
Notation
Type
Meaning
∥ψ⟩
ket
column vector — a quantum state
⟨ψ∥
bra
row vector — conjugate transpose of the ket
⟨ϕ∥ψ⟩
bracket
inner product — a scalar (probability amplitude)
∥ψ⟩⟨ϕ∥
outer product
a matrix (used to build gates)
U∥ψ⟩
matrix-vector product
applying gate U to state ∥ψ⟩
∥ab⟩
tensor product
joint 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.