The goal of this project is to efficiently synthesize an arbitrary quantum gate exactly, using only the gates within the Clifford + T gate set.
All operations on a quantum computer rely on rotating qubits in very specific ways. In theory, a qubit can be rotated in infinitely many ways, almost like rotating an arrow by any angle in 3D space. Mathematically, these rotations are described by unitary matrices with entries in complex rings. However, real quantum computers cannot perform arbitrary exact rotations directly. Instead, they are restricted to a fixed “alphabet” of basic gates that are physically implementable and robust.
The Clifford + T gate set is universal. Much like how 26 letters can form every word in the English language, the gates in the Clifford + T set (H and T) can express every single-qubit gate with entries in the ring
A qubit (quantum bit) is a quantum state that has some probability of measuring a
The
We represent a qubit as a column vector, where the top entry represents the probability of measuring
Quantum gates are applied to qubits by left multiplication. These gates change the probability.
Quantum gates are represented as left-multiplied unitary matrices.
The gate must be unitary so that the total probability is preserved
We use
A matrix is unitary if multiplying the matrix by its dagger gives the identity matrix.
The dagger of a matrix is its conjugate transpose.
More precisely, a matrix
The
We define the ring
where
Similarly, we define
where
Every element of
The Hadamard gate is defined as
Multiplication by
in the standard
The
where
We define
For integers
Since
Thus any
Using Euler's formula,
We define
Important identities:
where
Units are elements with multiplicative inverses and magnitude
Since multiplication by a unit only changes the global phase, we can discard them.
A global phase has the form
Multiplying a quantum state by
Units in
Therefore, elements that differ by a unit are treated as equivalent for synthesis purposes.
A relative phase has the form
Here, only one component is multiplied by a phase factor.
Relative phase does not change measurement probabilities, but it changes the quantum state geometrically.
On the Bloch sphere, this corresponds to a rotation about the
Start with your desired unitary gate
- Multiply the matrix by
$\delta$ $(1 + \omega)$ until all entries are in the ring$\mathbb{Z}[\omega]$ . Represent the number of times you multiplied by delta as the variable$k$ . To keep the unitary matrix equal to the original, you will represent it as
- Express a column vector
$\ket{\psi}$ as the first column of$U$ in the form
and
-
For every step there is guaranteed to exist a
$T^LH$ sequence where$L \in {0,1,2,3}$ that can reduce the SDE by 1 (refer additional info).This means cancelling out one delta in
turning it into
reducing the SDE by
- Apply the
$T^LH$ sequence to$\ket{\psi}$ and reduce the column after the$H$ gate. To accurately reduce up to irrelevant global phase, utilize the equalities
-
Repeat steps 3 and 4 until the SDE
$= 0$ . This means all the entries of$\ket{\psi}$ are in the ring$\mathbb{Z}[\omega]$ . We are pretty much done once the gate is in the ring$\mathbb{Z}[\omega]$ because lemma 10.1.2 in Picturing Quantum Software states that it must be a computational basis vector up to a global phase [2]. -
If
$\ket{\psi}$ is in the$\ket{1}$ state as in it is in the form
then apply an
-
Apply the same sequence of gates to send the second column to the one state.
-
Reverse and dagger the gate sequence in order to go from
$\lvert 0 \rangle$ to$U\lvert 0 \rangle$ (additional info). -
Return the reverse daggered gate sequence
The user inputs the first column of a unitary matrix with entries in the ring
Each entry is read and checked by the readDOmega() method that uses the TextIO library input system and ensures each inputted number is in the ring.
Each entry is followed by an
where
The inputted column vector is then used as the input for the constructor in the U2Matrix class. The constructor assembles the whole 2x2 unitary matrix using the column vector as the first column of the matrix. Then using the isUnitary() method in U2Matrix to check unitarity, if this check fails the algorithm cannot proceed.
The convertToZOmega() method in the runner class is used to find the SDE. To calculate the SDE in terms of
until the entries are in the ring
To maintain equality after the multiplication we can represent the column vector as
where
Next we create a cVector (column vector) object using the cVector class constructor, inputting ZOmega elements
We attempt to reduce the SDE to 0 using H and T gates.
A
so it only multiplies the bottom component by a unit phase and does not affect SDE.
Hadamard Gate
A Hadamard gate acts as
Applying
Each Hadamard increases SDE by
After every Hadamard, the algorithm immediately attempts to reduce the state and SDE using the factorOutAllDeltas() method. This method operates on
First, if all coefficients are even, it factors out a
Second, it checks whether the remaining coefficients satisfy specific parity patterns modulo 2 (refer additional info) that indicate divisibility by
With this method of reduction, a single Hadamard at best can only cancel the factor it introduces, so it cannot reduce SDE on its own. For this reason, the main reduction loop applies gates in the form
implemented in reduceColumnVector() method by brute-forcing over the
After the second Hadamard, the cyclotomic elements have been sufficiently changed by repeated
If the SDE begins as even, the reduction process terminates when SDE reaches 0. If not, we use a parity test and solve a 4x4 linear system to solve for the coefficents after dividing by the remaining
The first column should be in the zero state. If the remaining
Because of the unitary’s orthogonality, the same gate sequence will send the second column to the reduced
This algorithm constructs a gate sequence that sends the unitary to the identity zero-state matrix. We want to output a gate sequence that goes in the opposite direction, from the zero-state identity matrix to the desired unitary.
Finally, we reverse and dagger the gate sequence and print the output.
The constructed sequence is designed to reduce the target state to the zero state. Suppose the algorithm produces a gate sequence
such that
And because
this implies that
To recover
and taking the dagger of a product of matrices reverses the order such that in our case:
Therefore,
Thus, the reverse daggered sequence prepares the desired unitary from the identity.
To factor out a
So after squaring the cyclotomic element, the cyclotomic element is divisible by
This means that the cyclotomic element before being squared was divisible by
To actually divide by
We want to divide by
Let
and
To divide by
The relationship between coefficients is
where
Solving for the coefficients of
Let
Then multiplication by δ = 1 + ω gives:
So x is divisible by δ if and only if there exist integers p, q, r, s such that:
a = p - s
b = p + q
c = q + r
d = r + s
From that:
Therefore if (a + b + d - c) is divisible by 2, dividing by δ is possible.
If the parity condition holds, compute:
p = (a + b + d - c)/2
q = b - p
r = c - b + p
s = d - c + b - p
Then
Represents elements of
Handles:
- Addition
- Multiplication
- Conjugation
- Equality checking
Ensures denominators remain powers of
Represents elements of
Handles:
- Polynomial arithmetic modulo
$\omega^4 = -1$ - Delta divisibility and factorization
- Ring membership checks
Let
We prove that for any
Step One: Compute
Using the 8th root of unity relations:
From algebraic manipulation,
where
is a unit.
Hence
Step Two: Proof
Let
Then by definition of
Substitute
Since
Thus we may write
Multiplying both sides by
Let
Conclusion:
For every
[1] Aleks Kissinger and John van de Wetering, Picturing Quantum Software, Preprint Version 1.1.0 October 2024
[2] Vadym Kliuchnikov, Dmitri Maslov and Michele Mosca, Fast and efficient exact synthesis of single qubit unitaries generated by Clifford and T gates, arXiv:1206.5236v4 [quant-ph], 27 Feb 2013
I would like to thank Amolak Kalra and Mark Deaconu for their guidance and generous help on this project.
I am especially grateful to Amolak Kalra for devoting so much time to mentor, encourage, and teach me the foundations that made this project possible.
Mark's related work helped in many ways in the completion of this project: https://github.com/MarkNDeaconu
Finally I would like to thank Professor Mosca for giving me the opportunity of working in his quantum computing research group last summer.