ABSTRACT (original article): The Clifford group plays a central role in quantum information science. It is the building block for many error-correcting schemes and matches the first three moments of the Haar measure over the unitary group -a property that is essential for a broad range of quantum algorithms, with applications in pseudorandomness, learning theory, benchmarking, and entanglement distillation. At the heart of understanding many properties of the Clifford group lies the Clifford commutant: the set of operators that commute with -fold tensor powers of Clifford unitaries. Previous understanding of this commutant has been limited to relatively small values of , constrained by the number of qubits . In this work, we develop a complete theory of the Clifford commutant. Our first result provides an explicit orthogonal basis for the commutant and computes its dimension for arbitrary and . We also introduce an alternative and easy-to-manipulate basis formed by isotropic sums of Pauli operators. We show that this basis is generated by products of permutations -which generate the unitary group commutant- and at most three other operators. Additionally, we develop a graphical calculus allowing a diagrammatic manipulation of elements of this basis. These results enable a wealth of applications: among others, we characterize all measurable magic measures and identify optimal strategies for stabilizer property testing, whose success probability also offers an operational interpretation to stabilizer entropies. Finally, we show that these results also generalize to multi-qudit systems with prime local dimension. CITATION (original article): Bittel, L., Eisert, J., Leone, L., Mele, A. A., & Oliviero, S. F. E. (2025), A complete theory of the Clifford commutant, arXiv:2504.12263. https://doi.org/10.48550/arXiv.2504.12263
In this notebook we give an explicit representation of the Clifford commutant for
k4,k6,k8
.
Clifford-Weingarten Calculus. The Clifford group acting on
k
copies of the Hilbert space defines the
k
-design projector
(k)
Φ
cl
, which projects onto the commutant
Com
⊗k
Cl
n

, spanned by the set
P
of reduced Pauli monomials. The Clifford-Weingarten formula expresses the projector as:
(k)
Φ
cl
(O)
∑
Ω,
′
Ω
∈P
-1
W
Ω,
′
Ω
tr(OΩ)
′
Ω
where
W
is the Gram matrix with entries
W
Ω,
′
Ω
tr(
†
Ω
′
Ω
)
. In the large-
n
limit (
n≥
2
k
-3k+7
), the diagonal entries satisfy
-1
W
Ω,Ω
≈
-k
d
while off-diagonal entries satisfy

-1
W
Ω,
′
Ω
(
-(k+1)
d
)
for
Ω≠
′
Ω
, where
d
n
2
. Each section below implements this formula for
k4,6,8
.

Clifford Commutant for
k=4

In this section, we develop the Clifford Commutant for
k4
. The Clifford commutant for
k4
can be decomposed in the action of the permutations and of the projector
(4)
Ω
1

1
d
∑
P
⊗4
P
For
k4
, the commutant
Com
⊗4
Cl
n

has dimension 30. It is generated by a single nontrivial Pauli monomial
Ω
4
together with all 24 permutations in
S
4
. The 30 basis elements form 6 cosets of
S
4
acting on
Ω
4
, giving a block-structured 30×30 Gram matrix
(4)
W
. The Clifford-Weingarten formula at
k4
reads:
(4)
Φ
cl
(O)
∑
Ω,
′
Ω
∈
P
4
-1
W
Ω,
′
Ω
tr(OΩ)
′
Ω
The matrix S computed below encodes the Gram matrix structure; inverting it yields the Weingarten coefficients used in the twirl expansion.
To build the Clifford Weingarten we need to compute
tr(
T
σ
T
κ
)
and
tr
(4)
Q
T
σ
T
κ


Permutations

In[]:=
C
e
={Cycles[{}]};​​
C
(12)
=Flatten[GroupOrbits[AlternatingGroup[4],{Cycles[{{1,2}}]}]];​​
C
(123)
=Flatten[{GroupOrbits[AlternatingGroup[4],{Cycles[{{1,2,3}}]}],GroupOrbits[AlternatingGroup[4],{Cycles[{{1,3,2}}]}]}];​​
C
(1234)
=Flatten[GroupOrbits[AlternatingGroup[4],{Cycles[{{1,2,3,4}}]}]];​​
C
(12)(34)
=Flatten[GroupOrbits[AlternatingGroup[4],{Cycles[{{1,2},{3,4}}]}]];​​
S
4
=Flatten
C
e
,
C
(12)
,
C
(123)
,
C
(1234)
,
C
(12)(34)
;

tr(
T
π
T
σ
)

In[]:=
tr(
T
π
T
σ
)
=TableTableWhichMemberQ[
C
e
,PermutationProduct[
S
4
[[i]],
S
4
[[j]]]],
4
d
,MemberQ
C
(12)
,PermutationProduct[
S
4
[[i]],
S
4
[[j]]],
3
d
,MemberQ
C
(123)
,PermutationProduct[
S
4
[[i]],
S
4
[[j]]],
2
d
,MemberQ
C
(1234)
,PermutationProduct[
S
4
[[i]],
S
4
[[j]]],
d
,MemberQ
C
(12)(34)
,PermutationProduct[
S
4
[[i]],
S
4
[[j]]],
2
d
,{i,1,24},{j,1,24};

tr
(4)
Q
T
π
T
σ


In[]:=
C
(4)
Q
e
={Cycles[{}],Cycles[{{1,2},{3,4}}],Cycles[{{1,3},{2,4}}],Cycles[{{1,4},{2,3}}]};​​
C
(4)
Q
(13)
={Cycles[{{2,4}}],Cycles[{{1,4,3,2}}],Cycles[{{1,3}}],Cycles[{{1,2,3,4}}]};​​
C
(4)
Q
(12)
={Cycles[{{1,2}}],Cycles[{{1,3,2,4}}],Cycles[{{3,4}}],Cycles[{{1,4,2,3}}]};​​
C
(4)
Q
(132)
={Cycles[{{1,3,2}}],Cycles[{{2,3,4}}],Cycles[{{1,2,4}}],Cycles[{{1,4,3}}]};​​
C
(4)
Q
(123)
={Cycles[{{1,2,3}}],Cycles[{{1,4,2}}],Cycles[{{2,4,3}}],Cycles[{{1,3,4}}]};​​
C
(4)
Q
(14)
={Cycles[{{1,4}}],Cycles[{{1,3,4,2}}],Cycles[{{2,3}}],Cycles[{{1,2,4,3}}]};​​
S
(Q)4
={Cycles[{}],Cycles[{{1,2}}],Cycles[{{1,3}}],Cycles[{{1,4}}],Cycles[{{1,2,3}}],Cycles[{{1,3,2}}]};
In[]:=
tr
(4)
Q
T
κ
T
′
κ

=TableTableWhichMemberQ
C
(4)
Q
e
,PermutationProduct
S
(Q)4
[[i]],
S
(Q)4
[[j]],
3
d
,MemberQ
C
(4)
Q
(13)
,PermutationProduct
S
(Q)4
[[i]],
S
(Q)4
[[j]],
2
d
,MemberQ
C
(4)
Q
(12)
,PermutationProduct
S
(Q)4
[[i]],
S
(Q)4
[[j]],
2
d
,MemberQ
C
(4)
Q
(14)
,PermutationProduct
S
(Q)4
[[i]],
S
(Q)4
[[j]],
2
d
,MemberQ
C
(4)
Q
(132)
,PermutationProduct
S
(Q)4
[[i]],
S
(Q)4
[[j]],
d
,MemberQ
C
(4)
Q
(123)
,PermutationProduct
S
(Q)4
[[i]],
S
(Q)4
[[j]],
d
,{i,1,6},{j,1,6};
In[]:=
tr
(4)
Q
T
κ
T
σ

=TableTableWhichMemberQ
C
(4)
Q
e
,PermutationProduct
S
(Q)4
[[i]],
S
4
[[j]],
3
d
,MemberQ
C
(4)
Q
(13)
,PermutationProduct
S
(Q)4
[[i]],
S
4
[[j]],
2
d
,MemberQ
C
(4)
Q
(12)
,PermutationProduct
S
(Q)4
[[i]],
S
4
[[j]],
2
d
,MemberQ
C
(4)
Q
(14)
,PermutationProduct
S
(Q)4
[[i]],
S
4
[[j]],
2
d
,MemberQ
C
(4)
Q
(132)
,PermutationProduct
S
(Q)4
[[i]],
S
4
[[j]],
d
,MemberQ
C
(4)
Q
(123)
,PermutationProduct
S
(Q)4
[[i]],
S
4
[[j]],
d
,{i,1,6},{j,1,24};

(4)
W

In[]:=
W
(4)
=InverseArrayFlatten
tr(
T
π
T
σ
)
,
tr
(4)
Q
T
κ
T
σ

,Transpose
tr
(4)
Q
T
κ
T
σ

,
d
tr
(4)
Q
T
κ
T
′
κ

;
Note that here we used
W
(4)
instead of
(4)
W
since Mathematica protect the symbol power .

Clifford Commutant for
k=6

In this section, we develop the Clifford Commutant for
k6
. The Clifford commutant for
k6
can be decomposed in the action of the permutations and of the projector ​
(6)
Ω
0
I
​​
(6)
Ω
1

1
d
∑
P
⊗4
P
​​
(6)
Ω
2

1
d
∑
P
⊗6
P
​​
(6)
Ω
3
1
2
d
∑
P,Q
⊗2
P
⊗
⊗2
(PQ)
⊗
⊗2
Q
For
k6
, the commutant
Com
⊗6
Cl
n

has dimension 4590. The reduced Pauli monomial basis
P
6
decomposes into four coset classes:
Ω
4
(2700 elements, weight-4 Pauli monomials),
Ω
6
(720 elements, weight-6 Pauli monomials),
Ω
4,4
(450 elements, products of two weight-4 blocks), and the 720 permutations in
S
6
. The 4590×4590 Gram matrix
(6)
W
inherits a block structure from these coset classes. The Clifford-Weingarten formula at
k6
provides the exact twirl projector, with asymptotic corrections at order
-7
d
relative to the leading term. The matrix
S
computed below encodes these inner products; its inverse gives the Weingarten coefficients for the
k6
twirl.
In this notebook, we provide the
S
matrix for
k6
, where we remind the definition
=
;
In[]:=
//MatrixForm
Out[]//MatrixForm=
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
12[76+13d+
2
d
]
d(1+d)(2+d)(4+d)
2
(5+d)
36
d(1+d)(2+d)(5+d)
720
d(1+d)(2+d)(4+d)(23+d)
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
36
d(1+d)(2+d)(5+d)
2
d[1+d]
720
d(1+d)(2+d)(4+d)(23+d)
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
720
d(1+d)(2+d)(4+d)(23+d)
720
d(1+d)(2+d)(4+d)(23+d)
720(3+d)(5+d)
d(1+d)(2+d)(4+d)
2
(23+d)
In[]:=
//MatrixForm
Out[]//MatrixForm=
1
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
1
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
1
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
1
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
1
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
d(1+d)(2+d)(4+d)
2
(5+d)
12[76+13d+
2
d
]
1
36
d(1+d)(2+d)(5+d)
1
720
d(1+d)(2+d)(4+d)(23+d)
1
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
1
36
d(1+d)(2+d)(5+d)
1
2
d[1+d]
1
720
d(1+d)(2+d)(4+d)(23+d)
1
720
d(1+d)(2+d)(3+d)(4+d)(5+d)
1
720
d(1+d)(2+d)(4+d)(23+d)
1
720
d(1+d)(2+d)(4+d)(23+d)
d(1+d)(2+d)(4+d)
2
(23+d)
720(3+d)(5+d)

Clifford Commutant for
k=8

In this section, we develop the Clifford Commutant for
k=8
. The Clifford commutant for
k=8
can be decomposed in the action of the permutations and of the projector ​
​​
​​
​​
​​
​​
​​
​​
​​
​​
​​
​​
​​

CITE THIS NOTEBOOK

A complete theory of the Clifford commutant​
by Lennart Bittel, Jens Eisert, Lorenzo Leone, Antonio A. Mele, Salvatore F.E. Oliviero​
Wolfram Community, STAFF PICKS, April, 28, 2026
​https://community.wolfram.com/groups/-/m/t/3707421