# Clifford group

The Clifford group encompasses a set of quantum operations that map the set of n-fold Pauli group products into itself. It is most famously studied for its use in quantum error correction.

## Definition

The Pauli matrices,
    $\sigma _{0}=I={\begin{bmatrix}1&0\\0&1\end{bmatrix}},\quad \sigma _{1}=X={\begin{bmatrix}0&1\\1&0\end{bmatrix}},\quad \sigma _{2}=Y={\begin{bmatrix}0&-i\\i&0\end{bmatrix}},{\text{ and }}\sigma _{3}=Z={\begin{bmatrix}1&0\\0&-1\end{bmatrix}}$
provide a basis for the density operators of a single qubit, as well as for the unitaries that can be applied to them. For the $n$-qubit case, one can construct a group, known as the Pauli group, according to
    $\mathbf {P} _{n}=\left\{e^{i\theta \pi /2}\sigma _{j_{1}}\otimes \cdots \otimes \sigma _{j_{n}}\mid \theta =0,1,2,3,j_{k}=0,1,2,3\right\}.$
The Clifford group is defined as the group of unitaries that normalize the Pauli group: $\mathbf {C} _{n}=\{V\in U_{2^{n}}\mid V\mathbf {P} _{n}V^{\dagger }=\mathbf {P} _{n}\}.$ Under this definition, $\mathbf {C} _{n}$ is infinite, since it contains all unitaries of the form $e^{i\theta }I$ for a real number $\theta$ and the identity matrix $I$. Any unitary in $\mathbf {C} _{n}$ is equivalent (up to a global phase factor) to a circuit generated using Hadamard, Phase, and CNOT gates, so the Clifford group is sometimes defined as the (finite) group of unitaries generated using Hadamard, Phase, and CNOT gates. The n-qubit Clifford group $\mathbf {C} _{n}$ defined in this manner contains $2^{n^{2}+2n+3}\prod _{j=1}^{n}(4^{j}-1)$ elements.
Some authors choose to define the Clifford group as the quotient group $\mathbf {C} _{n}/U(1)$, which counts elements in $\mathbf {C} _{n}$ that differ only by an overall global phase factor as the same element. The smallest global phase is ${\frac {1+i}{\sqrt {2}}}$, the eighth complex root of the number 1, arising from the circuit identity $HSHSHS={\frac {1+i}{\sqrt {2}}}I$, where $H$ is the Hadamard gate and $S$ is the Phase gate. For $n=$ 1, 2, and 3, this group contains 24, 11,520, and 92,897,280 elements, respectively. The number of elements in $\mathbf {C} _{n}/U(1)$ is $2^{n^{2}+2n}\prod _{j=1}^{n}(4^{j}-1)$.
Another possible definition of the Clifford group can be obtained from the above by further factoring out the Pauli group $\{I,X,Y,Z\}$ on each qubit. The leftover group is isomorphic to the group of $2n\times 2n$ symplectic matrices Sp(2n,2) over the field $\mathbb {F} _{2}$ of two elements. It has $2^{n^{2}}\prod _{j=1}^{n}(4^{j}-1)$ elements.

### Example

In the case of a single qubit, each element in the single-qubit Clifford group $\mathbf {C} _{1}/U(1)$ can be expressed as a matrix product $\mathbf {A} \mathbf {B}$, where $\mathbf {A} \in \{I,H,S,HS,SH,HSH\}$ and $\mathbf {B} =\{I,X,Y,Z\}$. Here $H$ is the Hadamard gate and $S$ the Phase gate.

## Generating gate library

The Clifford group is generated by three gates, Hadamard, phase gate S, and CNOT.

## Circuit complexity

Arbitrary Clifford group element can be generated as a circuit with no more than $O(n^{2}/\log(n))$ gates. Here, reference reports an 11-stage decomposition -H-C-P-C-P-C-H-P-C-P-C-, where H, C, and P stand for computational stages using Hadamard, CNOT, and Phase gates, respectively, and reference shows that the CNOT stage can be implemented using $O(n^{2}/\log(n))$ gates (stages -H- and -P- rely on the single-qubit gates and thus can be implemented using linearly many gates, which does not affect asymptotics).

## Notable subgroups

The Clifford group has a rich subgroup structure often exposed by the quantum circuits generating various subgroups. The subgroups of the Clifford group $\mathbf {C} _{n}$ include:
* n-fold Pauli product group $\mathbf {P} _{n}$. It has $2^{2n+2}$ elements ($2^{2n}$ without the global phase) and it is generated by the quantum circuits with Pauli-X and Pauli-Z gates.
* General linear group GL$(n,\mathbb {F} _{2})$. It has $\prod _{j=0}^{n-1}(2^{n}-2^{j})=2^{n^{2}+O(1)}$ elements and it is generated by the circuits with the CNOT gates.
* Symmetric group $\mathrm {S} _{n}$. It has $n!$ elements and it is generated by the circuits with the SWAP gates.
* Diagonal subgroup, consisting of diagonal Clifford unitaries. It has $2^{0.5n^{2}+O(n)}$ elements and it is generated by the quantum circuits with Phase and CZ gates.
* Hadamard-free subgroup is generated by the quantum circuits over Phase and CNOT gates. It has $2^{1.5n^{2}+O(n)}$ elements.
* Weyl group, which is generated by the SWAP and Hadamard gates. It has $2^{n\log(n)+O(n)}$ elements.
* Borel group, a maximal solvable subgroup, which is generated by the product of the lower triangular invertible Boolean matrices (CNOT circuits with controls on top qubits and targets on the bottom qubits) with diagonal subgroup elements (circuits with Phase and CZ gates). This group is a subgroup of the Hadamard-free subgroup; it has $2^{n^{2}+O(n)}$ elements.

## Properties

The order of Clifford gates and Pauli gates can be interchanged. For example, this can be illustrated by considering the following operator on 2 qubits
    $A=(X\otimes Z)CZ$.
We know that: $CZ(X\otimes I)CZ^{\dagger }=X\otimes Z$. If we multiply by CZ from the right
    $CZ(X\otimes I)=(X\otimes Z)CZ$.
So A is equivalent to
    $A=(X\otimes Z)CZ=CZ(X\otimes I)$.

### Simulatability

The Gottesman–Knill theorem states that a quantum circuit using only the following elements can be simulated efficiently on a classical computer:
* Preparation of qubits in computational basis states,
* Clifford gates, and
* Measurements in the computational basis.
The Gottesman–Knill theorem shows that even some highly entangled states can be simulated efficiently. Several important types of quantum algorithms use only Clifford gates, most importantly the standard algorithms for entanglement distillation and for quantum error correction.