A unitary operator is a linear operator U on a complex vector space whose adjoint is also its inverse, so that U†U = UU† = I. In quantum computing, and in particular within quantum gates & circuits, every ideal gate and every noiseless circuit is a unitary operator, and in a finite basis it is written as a unitary matrix.
Unitarity is not an arbitrary mathematical convenience. It follows from the Schrödinger equation, which makes closed quantum systems evolve reversibly, and it guarantees that total probability stays equal to one. Understanding unitary operators therefore explains why quantum gates are reversible, why they cannot copy unknown states and why measurement must be treated as a separate, non-unitary step.
What makes an operator unitary
An operator is unitary when it preserves inner products: for any two states, the overlap before and after applying U is identical. Because lengths and angles between state vectors are kept, a normalized state remains normalized, and the Born rule probabilities of any complete measurement still add up to one.
Several equivalent conditions characterize unitarity, and practitioners switch between them depending on the task. The table below lists the most useful ones and what each implies in practice.
| Condition | Mathematical form | Practical meaning |
|---|---|---|
| Inverse equals adjoint | U†U = UU† = I | Undoing a gate means applying its conjugate transpose |
| Inner product preserved | ⟨Uψ|Uφ⟩ = ⟨ψ|φ⟩ | Distinguishability of states is unchanged |
| Orthonormal columns | Columns form an orthonormal basis | Easy numerical test for a matrix |
| Unit-modulus eigenvalues | Eigenvalues equal e^(iθ) | Every gate is a set of phase rotations in its eigenbasis |
| Exponential of a Hermitian | U = e^(−iHt) | Each gate corresponds to a physical Hamiltonian applied for a time |
The last condition is the bridge between mathematics and hardware. A control pulse drives a qubit with a Hamiltonian H for a duration t, and the resulting gate is the matrix exponential of that Hamiltonian. Calibrating a gate is, in effect, tuning H and t until the realized operator matches the target unitary.
Unitary matrices as quantum gates
For n qubits, a gate is a 2^n by 2^n unitary matrix. A single-qubit gate is a 2 by 2 matrix, and up to an unobservable global phase it corresponds to a rotation of the Bloch sphere. Two-qubit gates are 4 by 4 matrices, and a gate on a full register of 50 qubits would formally require a matrix with roughly 10^30 entries, which is why classical simulation becomes infeasible.
The following table shows common gates, their matrix size and the kind of transformation each represents. The individual gates are covered in depth on their own pages.
| Gate | Matrix size | Transformation | Self-inverse |
|---|---|---|---|
| Pauli X | 2 × 2 | Bit flip, rotation by π about the x axis | Yes |
| Hadamard | 2 × 2 | Maps basis states to equal superpositions | Yes |
| T gate | 2 × 2 | Phase shift of π/4 on the one state | No, inverse is T† |
| CNOT | 4 × 4 | Flips the target when the control is one | Yes |
| Toffoli | 8 × 8 | Doubly controlled bit flip | Yes |
Circuits compose by matrix multiplication. Gates applied in sequence multiply in reverse order of appearance, and gates acting on separate qubits in parallel combine through the tensor product. Because the product of unitary matrices is again unitary, any circuit built from unitary gates is itself a single unitary operator.
Physical consequences of unitarity
Unitarity imposes hard constraints on what a quantum computer can do between measurements. These constraints shape algorithm design and explain several results that surprise newcomers.
- Reversibility: every gate has an inverse, so no information is destroyed until measurement. Classical irreversible operations such as AND must be embedded with extra ancilla qubits.
- No-cloning theorem: no unitary can copy an arbitrary unknown state, because copying would not preserve inner products between distinct inputs.
- Linearity: a gate acts on each component of a superposition independently, which is the source of quantum parallelism and interference.
- Global phase invariance: multiplying U by e^(iφ) changes no measurement outcome, so gates are equivalent up to this factor.
Measurement, decoherence and resets are not unitary. They are described by projectors or by quantum channels in the Kraus representation. A useful rule of thumb is that anything which erases information or reacts to the environment lies outside the unitary model.
Unitary operators compared with related operator classes
Unitary operators are often confused with Hermitian operators, because both appear throughout quantum mechanics. The distinction is one of role: Hermitian operators represent observables and generators, while unitary operators represent transformations. The table summarizes the differences.
| Operator class | Defining property | Eigenvalues | Role in quantum computing |
|---|---|---|---|
| Unitary | U†U = I | On the unit circle | Gates and noiseless evolution |
| Hermitian | H† = H | Real numbers | Observables and Hamiltonians |
| Projector | P² = P, P† = P | Zero or one | Projective measurement |
| Quantum channel | Completely positive, trace preserving | Not defined as a single matrix | Noise, decoherence, resets |
| Orthogonal | Real unitary matrix | On the unit circle | Gates without complex phases |
Some operators belong to more than one class. The Pauli matrices and the Hadamard gate are both Hermitian and unitary, which is why they square to the identity. A Hermitian operator H also generates a unitary family e^(−iHt), the relationship behind rotation gates and Hamiltonian simulation.
Decomposing and compiling unitary operators
Hardware exposes only a small native gate set, so an arbitrary unitary must be decomposed into those gates. For one qubit, the ZYZ Euler decomposition writes any unitary as three rotations and a global phase. For two qubits, the KAK decomposition shows that at most three CNOT gates plus single-qubit gates suffice.
Exact decomposition of a general n-qubit unitary requires a number of gates that grows exponentially in n, roughly proportional to 4^n. Efficient quantum algorithms are those whose target unitary has special structure, such as the quantum Fourier transform, which needs only a polynomial number of gates.
| Target | Method | Typical cost |
|---|---|---|
| Single-qubit unitary | Euler angles | Three rotations |
| Two-qubit unitary | KAK or Cartan decomposition | Up to three CNOT gates |
| General n-qubit unitary | Quantum Shannon decomposition | About 4^n CNOT gates |
| Fault-tolerant approximation | Solovay–Kitaev or number-theoretic synthesis | Polylogarithmic in 1/ε |
Limitations and common mistakes
Real devices implement only approximately unitary operations. Control errors produce a slightly wrong unitary, called a coherent error, while coupling to the environment produces non-unitary noise. Gate fidelity metrics compare the realized process with the ideal target, and the two error types accumulate differently over long circuits.
- Ignoring global phase: two matrices differing only by e^(iφ) implement the same gate, yet naive equality checks in software flag them as different.
- Forgetting phase in controlled gates: a global phase becomes a relative phase once the gate is controlled, so it can no longer be discarded.
- Mixing order of multiplication: the first gate in a circuit diagram is the rightmost factor in the matrix product.
- Treating measurement as a gate: measurement is irreversible and cannot be written as a unitary on the measured qubits alone.
In everyday language
A unitary operator is a perfectly reversible move for a quantum state. Think of turning a globe. You can spin it in any direction. Nothing gets stretched or lost. You can always spin it back.
Quantum gates work the same way. Each gate turns the state of the qubits without losing anything. That is why every gate can be undone. Only measuring the qubits breaks this rule, because looking at the result changes it for good.
Seen in the real world
A compiler engineer preparing a chemistry circuit for a superconducting processor receives a two-qubit block specified as a 4 by 4 unitary matrix. The device supports only single-qubit rotations and a CZ gate, so the block cannot run as written.
The engineer applies a KAK decomposition, which rewrites the matrix as three CZ gates surrounded by single-qubit rotations. A verification step multiplies the resulting gates back together and confirms that the product matches the target up to a global phase, with numerical deviation below 10^(−12).
Because each CZ gate on this device has an error rate near 0.5 percent while single-qubit gates are about ten times better, the engineer then checks whether the block needs all three entangling gates. It turns out to need only two, which cuts the expected error of the block by roughly a third and shortens the circuit.