In short: Quantum computing needs only a small slice of linear algebra: states are unit vectors written as kets, gates are unitary matrices, measurements are Hermitian operators, and multi-qubit systems are built with tensor products.
If you have read our overview in the math behind quantum computing, this article is the hands-on companion. We will build each prerequisite from scratch and immediately test it on a real gate. Engineers coming from VLSI will find it familiar: a unitary is to a quantum circuit what a lossless, invertible logic transform is to a netlist, except that it acts on complex amplitudes instead of bits.
Dirac notation: kets, bras and amplitudes
A ket |ψ⟩ is simply a column vector. The computational basis for one qubit is |0⟩ = (1, 0)ᵀ and |1⟩ = (0, 1)ᵀ. Any state is |ψ⟩ = α|0⟩ + β|1⟩ with complex α, β satisfying |α|² + |β|² = 1. A bra ⟨ψ| is the conjugate transpose (the dagger) of the ket, a row vector with every entry conjugated. That conjugation is the single most common source of sign errors in homework and interviews: forgetting it breaks every result involving complex amplitudes such as the |−i⟩ state.
Key fact: The squared magnitude of an amplitude is a probability. For |ψ⟩ = (|0⟩ + |1⟩)/√2, each outcome has probability (1/√2)² = 0.5, and the amplitudes themselves can be negative or complex without changing that.
Inner and outer products
The inner product ⟨φ|ψ⟩ is a bra times a ket and returns one complex number. It measures overlap. ⟨0|1⟩ = 0 (orthogonal), ⟨0|0⟩ = 1 (normalised), and ⟨+|0⟩ = 1/√2, so the probability of reading 0 from |+⟩ is |1/√2|² = 0.5. Orthonormality of a basis is exactly the statement ⟨i|j⟩ = δᵢⱼ.
The outer product |ψ⟩⟨φ| is a ket times a bra and returns a matrix. For example |0⟩⟨0| = [[1,0],[0,0]] is a projector: it keeps the |0⟩ component and kills the rest. Every operator can be written as a sum of outer products, and the identity is the completeness relation |0⟩⟨0| + |1⟩⟨1| = I. This is why the Pauli-X gate can be written compactly as X = |0⟩⟨1| + |1⟩⟨0|: it sends |1⟩ to |0⟩ and |0⟩ to |1⟩.
Eigenvalues, Hermitian operators and measurement
An eigenvector satisfies A|v⟩ = λ|v⟩. The Pauli-Z matrix diag(1, −1) has eigenvectors |0⟩ (λ = +1) and |1⟩ (λ = −1). Pauli-X has eigenvectors |+⟩ = (|0⟩+|1⟩)/√2 with λ = +1 and |−⟩ = (|0⟩−|1⟩)/√2 with λ = −1. Measuring in the X basis therefore means applying a Hadamard first and then reading Z.
A Hermitian operator satisfies A = A†. Its eigenvalues are always real and its eigenvectors for different eigenvalues are orthogonal, which is exactly what a physical observable needs. X, Y and Z are all Hermitian. In the spectral form A = Σ λᵢ|vᵢ⟩⟨vᵢ|, each outer product is a projector, and the probability of outcome λᵢ is ⟨ψ|vᵢ⟩⟨vᵢ|ψ⟩ = |⟨vᵢ|ψ⟩|². Expectation values follow as ⟨ψ|A|ψ⟩, the quantity that variational algorithms such as VQE minimise.
Unitary operators: the gates
A unitary satisfies U†U = I. It preserves inner products and therefore norms, so total probability stays at 1, and it is always invertible with U⁻¹ = U†. Its eigenvalues lie on the unit circle, e^{iθ}. Every gate you will ever draw on a circuit diagram is unitary; irreversible steps only appear at measurement.
Worked example, Hadamard: H = (1/√2)[[1,1],[1,−1]]. Then H|0⟩ = (1/√2)(1,1)ᵀ = |+⟩ and H|1⟩ = |−⟩. Check unitarity: H† = H and H·H = (1/2)[[2,0],[0,2]] = I, so H is both Hermitian and unitary and is its own inverse. Not every gate is so lucky: the phase gate S = diag(1, i) is unitary but not Hermitian, since S† = diag(1, −i) ≠ S, and S·S = Z.
Key fact: Hermitian means real eigenvalues (measurable quantities); unitary means eigenvalues of magnitude 1 (reversible evolution). The two only coincide for operators with eigenvalues ±1, such as X, Y, Z and H.
Tensor products: scaling to many qubits
The tensor (Kronecker) product combines systems. For vectors, |0⟩⊗|1⟩ = |01⟩ = (0,1,0,0)ᵀ, so n qubits live in a 2ⁿ-dimensional space. For operators, (A⊗B)(|a⟩⊗|b⟩) = A|a⟩⊗B|b⟩. Applying H to qubit 0 of two qubits is H⊗I, a 4×4 matrix; ten qubits already means a 1024×1024 matrix, which is why classical simulators run out of memory near 45 to 50 qubits.
The CNOT gate cannot be written as A⊗B at all. In outer-product form CNOT = |0⟩⟨0|⊗I + |1⟩⟨1|⊗X: if the control is 0 do nothing, if it is 1 flip the target. A state that cannot be factorised into a tensor product is entangled. Worked example: start from |00⟩, apply H⊗I to get (|00⟩+|10⟩)/√2, then CNOT to get (|00⟩+|11⟩)/√2, the Bell state. No choice of single-qubit kets multiplies out to it.
| Object | Defining rule | Eigenvalues | Example |
|---|---|---|---|
| Hermitian | A = A† | Real | Z, X, Y |
| Unitary | U†U = I | |λ| = 1 | H, S, CNOT |
| Projector | P² = P = P† | 0 or 1 | |0⟩⟨0| |
Why it matters beyond the classroom
These identities are what quantum SDKs and simulators do internally: Qiskit and Cirq build Kronecker products to expand a gate onto the right qubit, and unitarity checks catch bad custom gates. Hardware teams use the same algebra when characterising pulses, and the discipline of verifying invertible transforms will feel natural to anyone who has done equivalence checking in Synopsys Formality or Cadence Conformal. If you want practitioner training to pair with this theory, the programmes at ChipXpert cover the semiconductor side. Next, see qubits and the Bloch sphere for the geometric picture.
Key fact: Interview shortcut: to test whether a matrix is a valid gate, check U†U = I; to test whether it is a valid observable, check A = A†.
Ready to go from notation to circuits? Explore the quantum track in our CourseTron courses and practise every identity above on live simulators.
FAQ
Why are quantum gates unitary rather than arbitrary matrices?
Because they must preserve total probability and be reversible. A unitary keeps the norm of the state vector at 1, and its inverse is simply its conjugate transpose.
What is the difference between Hermitian and unitary?
Hermitian operators (A = A†) have real eigenvalues and describe measurable quantities. Unitary operators (U†U = I) have unit-modulus eigenvalues and describe time evolution or gates. Some, like H and X, are both.
How many numbers does an n-qubit state need?
2ⁿ complex amplitudes, because tensor products multiply dimensions. 30 qubits already need about a billion amplitudes, which is why simulation becomes impractical.
What does an outer product do in practice?
It builds operators from states. Projectors like |0⟩⟨0| model measurement, and sums such as |0⟩⟨1| + |1⟩⟨0| build gates like Pauli-X.