class qiskit.transpiler.passes.SolovayKitaev(*args, **kwargs)[source]#

Bases: TransformationPass

Approximately decompose 1q gates to a discrete basis using the Solovay-Kitaev algorithm.

The Solovay-Kitaev theorem [1] states that any single qubit gate can be approximated to arbitrary precision by a set of fixed single-qubit gates, if the set generates a dense subset in \(SU(2)\). This is an important result, since it means that any single-qubit gate can be expressed in terms of a discrete, universal gate set that we know how to implement fault-tolerantly. Therefore, the Solovay-Kitaev algorithm allows us to take any non-fault tolerant circuit and rephrase it in a fault-tolerant manner.

This implementation of the Solovay-Kitaev algorithm is based on [2].

For example, the following circuit

q_0: ┤ RX(0.8) ├

can be decomposed into

global phase: 7π/8
q_0: ┤ H ├┤ T ├┤ H ├

with an L2-error of approximately 0.01.


Per default, the basis gate set is ["t", "tdg", "h"]:

import numpy as np
from qiskit.circuit import QuantumCircuit
from qiskit.transpiler.passes.synthesis import SolovayKitaev
from qiskit.quantum_info import Operator

circuit = QuantumCircuit(1)
circuit.rx(0.8, 0)

print("Original circuit:")

skd = SolovayKitaev(recursion_degree=2)

discretized = skd(circuit)

print("Discretized circuit:")

print("Error:", np.linalg.norm(Operator(circuit).data - Operator(discretized).data))
Original circuit:
q: ┤ Rx(0.8) ├
Discretized circuit:
global phase: 7π/8
q: ┤ H ├┤ T ├┤ H ├
Error: 2.828408279166474

For individual basis gate sets, the generate_basic_approximations function can be used:

from qiskit.synthesis import generate_basic_approximations
from qiskit.transpiler.passes import SolovayKitaev

basis = ["s", "sdg", "t", "tdg", "z", "h"]
approx = generate_basic_approximations(basis, depth=3)

skd = SolovayKitaev(recursion_degree=2, basic_approximations=approx)


[1]: Kitaev, A Yu (1997). Quantum computations: algorithms and error correction.

Russian Mathematical Surveys. 52 (6): 1191–1249. Online.

[2]: Dawson, Christopher M.; Nielsen, Michael A. (2005) The Solovay-Kitaev Algorithm.


  • recursion_degree -- The recursion depth for the Solovay-Kitaev algorithm. A larger recursion depth increases the accuracy and length of the decomposition.

  • basic_approximations -- The basic approximations for the finding the best discrete decomposition at the root of the recursion. If a string, it specifies the .npy file to load the approximations from. If a dictionary, it contains {label: SO(3)-matrix} pairs. If None, a default based on the H, T and Tdg gates up to combinations of depth 10 is generated.



Check if the pass is an analysis pass.

If the pass is an AnalysisPass, that means that the pass can analyze the DAG and write the results of that analysis in the property set. Modifications on the DAG are not allowed by this kind of pass.


Check if the pass is a transformation pass.

If the pass is a TransformationPass, that means that the pass can manipulate the DAG, but cannot modify the property set (but it can be read).



Return the name of the pass.


Run the SolovayKitaev pass on dag.


dag (DAGCircuit) -- The input dag.


Output dag with 1q gates synthesized in the discrete target basis.


TranspilerError -- if a gates does not have to_matrix

Return type: