# Solovay–Kitaev theorem

In quantum information and computation, the Solovay–Kitaev theorem says that if a set of single-qubit quantum gates generates a dense subgroup of SU(2), then that set can be used to approximate any desired quantum gate with a short sequence of gates that can also be found efficiently. This theorem is considered one of the most significant results in the field of quantum computation and was first announced by Robert M. Solovay in 1995 and independently proven by Alexei Kitaev in 1997. Michael Nielsen and Christopher M. Dawson have noted its importance in the field.
A consequence of this theorem is that a quantum circuit of $m$ constant-qubit gates can be approximated to $\varepsilon$ error (in operator norm) by a quantum circuit of $O(m\log ^{c}(m/\varepsilon ))$ gates from a desired finite universal gate set (where c is a constant). By comparison, just knowing that a gate set is universal only implies that constant-qubit gates can be approximated by a finite circuit from the gate set, with no bound on its length. So, the Solovay–Kitaev theorem shows that this approximation can be made surprisingly efficient, thereby justifying that quantum computers need only implement a finite number of gates to gain the full power of quantum computation.

## Statement

Let ${\mathcal {G}}$ be a finite set of elements in SU(2) containing its own inverses (so $g\in {\mathcal {G}}$ implies $g^{-1}\in {\mathcal {G}}$) and such that the group $\langle {\mathcal {G}}\rangle$ they generate is dense in SU(2). Consider some $\varepsilon >0$. Then there is a constant $c$ such that for any $U\in \mathrm {SU} (2)$, there is a sequence $S$ of gates from ${\mathcal {G}}$ of length $O(\log ^{c}(1/\varepsilon ))$ such that $\|S-U\|\leq \varepsilon$. That is, $S$ approximates $U$ to operator norm error. Furthermore, there is an efficient algorithm to find such a sequence. More generally, the theorem also holds in SU(d) for any fixed d.
This theorem also holds without the assumption that ${\mathcal {G}}$ contains its own inverses, although presently with a larger value of $c$ that also increases with the dimension $d$.

## Quantitative bounds

The constant $c$ can be made to be $\log _{(1+{\sqrt {5}})/2}2+\delta =1.44042\ldots +\delta$ for any fixed $\delta >0$. However, there exist particular gate sets for which we can take $c=1$, which makes the length of the gate sequence optimal up to a constant factor.

## Proof idea

Every known proof of the fully general Solovay–Kitaev theorem proceeds by recursively constructing a gate sequence giving increasingly good approximations to $U\in \operatorname {SU} (2)$. Suppose we have an approximation $U_{n-1}\in \operatorname {SU} (2)$ such that $\|U-U_{n-1}\|\leq \varepsilon _{n-1}$. Our goal is to find a sequence of gates approximating $UU_{n-1}^{-1}$ to $\varepsilon _{n}$ error, for $\varepsilon _{n}<\varepsilon _{n-1}$. By concatenating this sequence of gates with $U_{n-1}$, we get a sequence of gates $U_{n}$ such that $\|U-U_{n}\|\leq \varepsilon _{n}$.
The main idea in the original argument of Solovay and Kitaev is that commutators of elements close to the identity can be approximated "better-than-expected". Specifically, for $V,W\in \operatorname {SU} (2)$ satisfying $\|V-I\|\leq \delta _{1}$ and $\|W-I\|\leq \delta _{1}$ and approximations ${\tilde {V}},{\tilde {W}}\in \operatorname {SU} (2)$ satisfying $\|V-{\tilde {V}}\|\leq \delta _{2}$ and $\|W-{\tilde {W}}\|\leq \delta _{2}$, then
    $\|VWV^{-1}W^{-1}-{\tilde {V}}{\tilde {W}}{\tilde {V}}^{-1}{\tilde {W}}^{-1}\|\leq O(\delta _{1}\delta _{2}),$
where the big O notation hides higher-order terms. One can naively bound the above expression to be $O(\delta _{2})$, but the group commutator structure creates substantial error cancellation.
We can use this observation to approximate $UU_{n-1}^{-1}$ as a group commutator $V_{n-1}W_{n-1}V_{n-1}^{-1}W_{n-1}^{-1}$. This can be done such that both $V_{n-1}$ and $W_{n-1}$ are close to the identity (since $\|UU_{n-1}^{-1}-I\|\leq \varepsilon _{n-1}$). So, if we recursively compute gate sequences approximating $V_{n-1}$ and $W_{n-1}$ to $\varepsilon _{n-1}$ error, we get a gate sequence approximating $UU_{n-1}^{-1}$ to the desired better precision $\varepsilon _{n}$ with $\varepsilon _{n}$. We can get a base case approximation with constant $\varepsilon _{0}$ with an exhaustive search of bounded-length gate sequences.

## Proof of Solovay-Kitaev Theorem

Let us choose the initial value $\varepsilon _{0}$ so that $\varepsilon _{0}<\varepsilon '$ to be able to apply the iterated “shrinking” lemma. In addition we want $s\varepsilon _{0}<1$ to make sure that $\varepsilon _{k}$ decreases as we increase $k$. Moreover, we also make sure that $\varepsilon _{0}$ is small enough so that $\varepsilon _{k}^{2}<\varepsilon _{k+1}$.
Since $\langle G\rangle$ is dense in $\operatorname {SU} (2)$, we can choose $l_{0}$ large enough so that $G^{l_{0}}$ is an $\varepsilon _{0}^{2}$-net for $\operatorname {SU} (2)$ (and hence for $\operatorname {S} _{\varepsilon _{0}}$, as well), no matter how small $\varepsilon _{0}$ is. Thus, given any $U\in \operatorname {SU} (2)$, we can choose $U_{0}\in G^{l_{0}}$ such that $||U-U_{0}||<\varepsilon _{0}^{2}$. Let $\Delta :=UU_{0}^{+}$ be the “difference” of $U$ and $U_{0}$. Then
    $\|\Delta _{1}-I\|=\|(U-U_{0})U_{0}^{+}\|=\|U-U_{0}\|<\varepsilon _{0}^{2}<\varepsilon _{1}.$
Hence, $\Delta _{1}\in \operatorname {S_{\varepsilon _{1}}}$. By invoking the iterated "shrinking" lemma with $k=1$, there exists $U_{1}\in G^{l_{1}}$ such that
    $\|\Delta _{1}-U_{1}\|=\|UU_{0}^{+}-U_{1}\|=\|U-U_{1}U_{0}\|<\varepsilon _{1}^{2}.$
Similarly let $\Delta _{2}:=\Delta _{1}U_{1}^{+}=UU_{0}^{+}U_{1}^{+}$. Then
    $\|\Delta _{2}-I\|=\|(U-U_{1}U_{0})U_{0}^{+}U_{1}^{+}\|=\|U-U_{1}U_{0}\|<\varepsilon _{1}^{2}<\varepsilon _{2}.$
Thus, $\Delta _{2}\in \operatorname {S_{\varepsilon _{2}}}$ and we can invoke the iterated "shrinking" lemma (with $k=2$ this time) to get $U_{2}\in G^{l_{2}}$ such that $\|\Delta _{2}-U_{2}\|=\|UU_{0}^{+}U_{1}^{+}-U_{2}\|=\|U-U_{2}U_{1}U_{0}\|<\varepsilon _{2}^{2}.$
If we continue in this way, after k steps we get $U_{k}\in \operatorname {G} ^{l_{k}}$ such that
    $\|U-U_{k}U_{k-1}...U_{0}\|<\varepsilon _{k}^{2}.$
Thus, we have obtained a sequence of
    $L=\sum _{m=0}^{k}l_{m}=\sum _{m=0}^{k}5^{m}l_{0}={\frac {5^{k+1}-1}{4}}l_{0}<{\frac {5}{4}}5^{k}l_{0}$
gates that approximates $U$ to accuracy $\varepsilon _{k}^{2}$. To determine the value of $k$, we set $\varepsilon _{k}^{2}=\left((s\varepsilon _{0})^{(3/2)^{k}}/s\right)^{2}=\varepsilon$ and solve for k:
    $\left({\frac {3}{2}}\right)^{k}={\frac {{\text{log}}(1/s^{2}\varepsilon )}{2{\text{log}}(1/s\varepsilon _{0})}}.$
Now we can always choose $\varepsilon _{0}$ slightly smaller so that the obtained value of $k$ is an integer. Let $c={\text{log}}5/{\text{log}}(3/2)\approx 3.97$ so that$5^{k}=\left({\frac {3}{2}}\right)^{kc}$. Then
    $L<{\frac {5}{4}}5^{k}l_{0}={\frac {5}{4}}\left({\frac {3}{2}}\right)^{kc}l_{0}={\frac {5}{4}}\left({\frac {{\text{log}}(1/s^{2}\varepsilon )}{2{\text{log}}(1/s\varepsilon _{0})}}\right)^{c}l_{0}$
Hence for any $U\in \operatorname {SU} (2)$ there is a sequence of $L=O({\text{log}}^{c}(1/\varepsilon ))$ gates that approximates $U$ to accuracy $\varepsilon$.

## Solovay-Kitaev algorithm for qubits

Here the main ideas that are used in the SK algorithm have been presented. The SK algorithm may be expressed in nine lines of pseudocode. Each of these lines are explained in detail below, but present it here in its entirety both for the reader's reference, and to stress the conceptual simplicity of the algorithm:
Let us examine each of these lines in detail. The first line:
indicates that the algorithm is a function with two inputs: an arbitrary single-qubit quantum gate, $U$, which we desire to approximate, and a non-negative integer, $n$, which controls the accuracy of the approximation. The function returns a sequence of instructions which approximates $U$ to an accuracy $\varepsilon _{n}$, where $\varepsilon _{n}$ is a decreasing function of $n$, so that as $n$ gets larger, the accuracy gets better, with $\varepsilon _{n}\to 0$ as $n\to \infty$. $\varepsilon _{n}$ is described in detail below.
The Solovay-Kitaev function is recursive, so that to obtain an $\varepsilon _{n}$-approximation to $U$, it will call itself to obtain $\varepsilon _{n-1}$-approximations to certain unitaries. The recursion terminates at $n=0$, beyond which no further recursive calls are made:
In order to implement this step it is assumed that a preprocessing stage has been completed which allows one to find a basic $\varepsilon _{0}$-approximation to arbitrary $U\in \operatorname {SU} (2)$. Since $\varepsilon _{0}$ is a constant, in principle this preprocessing stage may be accomplished simply by enumerating and storing a large number of instruction sequences from $G$, say up to some sufficiently large (but fixed) length $l_{0}$, and then providing a lookup routine which, given $U$, returns the closest sequence.
At higher levels of recursion, to find an $\varepsilon _{n}$-approximation to $U$, one begins by finding an $\varepsilon _{n-1}$-approximation to $U$:
$U_{n-1}$ is used as a step towards finding an improved approximation to $U$. Defining $\Delta$≡ $UU_{n-1}^{+}$, the next three steps of the algorithm aim to find an $\varepsilon _{n}$-approximation to $\Delta$, where $\varepsilon _{n}$ is some improved level of accuracy, i.e., $\varepsilon _{n}<\varepsilon _{n-1}$. Finding such an approximation also enables us to obtain an $\varepsilon _{n}$-approximation to $U$, simply by concatenating exact sequence of instructions for $U_{n-1}$ with $\varepsilon _{n}$-approximating sequence for $\Delta$.
How do we find such an approximation to? First, observe that $\Delta$ is within a distance $\varepsilon _{n-1}$ of the identity. This follows from the definition of $\Delta$ and the fact that $U_{n-1}$ is within a distance $\varepsilon _{n-1}$ of $U$.
Second, decompose $\Delta$ as a group commutator $\Delta =VWV^{+}W^{+}$ of unitary gates $V$ and $W$. For any $\Delta$ it turns out that this is not obvious and that there is always an infinite set of choices for $V$ and $W$ such that $\Delta =VWV^{+}W^{+}$. For our purposes it is important that we find $V$ and $W$ such that $d(I,V),d(I,W)<c_{gc}{\sqrt {\varepsilon _{n-1}}}$ for some constant $c_{gc}$. We call such a decomposition a balanced group commutator.
For practical implementations we will see below that it is useful to have $c_{gc}$ as small as possible.
The next step is to find instruction sequences which are $\varepsilon _{n-1}$-approximations to $V$ and $W$:
The group commutator of $V_{n-1}$ and $W_{n}$ turns out to be an $\varepsilon _{n-1}$ ≡ $c_{\text{approx}}\varepsilon _{n-1}^{3/2}$-approximation to $\Delta$, for some small constant $c_{\text{approx}}$. Provided $\varepsilon _{n-1}<1/c_{\text{approx}}^{2}$, we see that $\varepsilon _{n}<\varepsilon _{n-1}$, and this procedure therefore provides an improved approximation to $\Delta$, and thus to $U$.
The constant $c_{\text{approx}}$ is important as it determines the precision $\varepsilon _{0}$ required of the initial approximations. In particular, we see that for this construction to guarantee that $\varepsilon _{0}>\varepsilon _{1}>...$ we must have $\varepsilon _{0}<1/c_{\text{approx}}^{2}$.
The algorithm concludes by returning the sequences approximating the group commutator, as well as $U_{n-1}$:
Summing up, the function Solovay-Kitaev(U, n) returns a sequence which provides an $\varepsilon _{n}=c_{\text{approx}}\varepsilon _{n-1}^{3/2}$-approximation to the desired unitary $U$ . The five constituents in this sequence are all obtained by calling the function at the $n-1$th level of recursion.