Skip to main contentIBM Quantum Documentation


class qiskit.transpiler.passes.SolovayKitaev(*args, **kwargs)

GitHub(opens in a new tab)

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)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


can be decomposed into

global phase:/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:
Discretized circuit:
global phase:/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(opens in a new tab).

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

arXiv:quant-ph/0505030(opens in a new tab).


  • 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).



execute(passmanager_ir, state, callback=None)

GitHub(opens in a new tab)

Execute optimization task for input Qiskit IR.



Optimized Qiskit IR and state of the workflow.

Return type

tuple(opens in a new tab)[Any(opens in a new tab), qiskit.passmanager.compilation_status.PassManagerState]



GitHub(opens in a new tab)

Name of the pass.

Return type

str(opens in a new tab)



GitHub(opens in a new tab)

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



update_status(state, run_state)

GitHub(opens in a new tab)

Update workflow status.


  • state (PassManagerState) – Pass manager state to update.
  • run_state (RunState) – Completion status of current task.


Updated pass manager state.

Return type


Was this page helpful?
Report a bug or request content on GitHub.