Any Single-Qubit Unitary
Every unitary matrix with determinant belongs to the group , and a fundamental theorem of linear algebra tells us that every such matrix can be written as a product of three rotations. This is the Euler angle decomposition, and it means the three rotation gates , , and you have already met are, collectively, enough to build any single-qubit gate.
The ZYZ decomposition
One standard form writes an arbitrary single-qubit unitary as
where , , , and are real angles. The overall factor is a global phase — physically unobservable and irrelevant to any measurement outcome or gate comparison. Stripping it away, every single-qubit gate is a ZYZ rotation sequence with three free parameters.
Finding the angles
Given a target unitary , the decomposition angles can be read off from the matrix entries. For the Hadamard gate
the ZYZ angles work out to , , :
Since (the identity), the effective sequence is just . You can verify this by multiplying the two matrices and comparing with up to the global phase . This confirms that is not a "magic" primitive — it is simply a particular rotation sequence.
Why this matters
Quantum hardware exposes a fixed native gate set. A compiler must translate every gate in your circuit into sequences of native operations. The Euler decomposition is the engine that powers single-qubit compilation: given any unitary your algorithm needs, the compiler solves for the three angles and emits the corresponding rotation sequence. Understanding the decomposition helps you reason about gate counts and recognize when two circuits are equivalent.
Try it
Implement the Hadamard gate using only and — no c.h() allowed. Use the ZYZ
decomposition: and (the term is the identity and can
be omitted). The grader checks the entire unitary matrix up to global phase, so an empty
circuit will not pass.
After running, the Bloch sphere view should show the same action as a Hadamard: the north pole maps to the state on the equator, confirming the decomposition is correct.
Sign in on the full site to ask questions and join the discussion.