Next Article in Journal
A Collective Comment on Sanctuary, B. “Spin Helicity and the Disproof of Bell’s Theorem” and Sanctuary’s Bivector Spin Framework (2023–2025)
Previous Article in Journal
Hybrid Quantum–Classical Architectures in Medical Imaging: A Taxonomy-Based Survey of COVID-19 Models
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Binary-Shadow Method for Wire Permutations and the Exact CNOT Cost of n-Qubit Cyclic SWAP Gates

School of Mathematics and Statistics, University of New South Wales, Sydney, NSW 2052, Australia
Quantum Rep. 2026, 8(2), 55; https://doi.org/10.3390/quantum8020055
Submission received: 23 April 2026 / Revised: 15 June 2026 / Accepted: 18 June 2026 / Published: 22 June 2026
(This article belongs to the Section Quantum Computing and Information Processing)

Abstract

We develop the binary-shadow method for exact CNOT counting and apply it to arbitrary wire permutations. The Heisenberg evolution of rotated local Z observables converts every CNOT gate into an elementary transvection over F 2 , and for a wire permutation, the resulting binary shadow is rigid: it must equal the associated permutation matrix. This reduces the exact CNOT cost of a wire permutation in the CNOT+local model to the transvection length of its permutation matrix. The remaining problem is classical. The relevant mathematical input is the transvection-length theory of permutation matrices, or equivalently, the CNOT-only synthesis of permutation circuits. Combining the binary-shadow reduction with the graph-theoretic link-middle-cut theorem for cycle matrices yields an exact formula: if σ S n has c ( σ ) disjoint cycles, then CNOT-cost ( W σ ) = tr ( P σ ) = 3 n c ( σ ) . The novelty is therefore not the CNOT-only permutation formula by itself, but the transfer of that exact lower bound to the CNOT+local model: arbitrary one-qubit gates may rotate the local Pauli axes, but they cannot reduce the CNOT count of a wire permutation. In particular, the n-qubit cyclic SWAP gate S n | x 1 1 | x 2 2 | x n n = | x n 1 | x 1 2 | x n 1 n requires exactly 3 ( n 1 ) CNOT gates, even when arbitrary one-qubit gates are allowed at zero cost. Thus, the exact values for n = 2 , 3 , 4 , 5 , 6 , are 3 , 6 , 9 , 12 , 15 , . We also give explicit optimal factorizations for n = 4 and n = 5 , and show more generally that each additional wire in a cyclic shift costs exactly three more CNOT gates.

1. Introduction

Minimizing the number of CNOT gates is a central problem in exact quantum circuit synthesis and reversible-circuit optimization [1,2,3]. In most architectures, one-qubit gates are far cheaper and more reliable than two-qubit entangling gates, so the CNOT count is a natural and practically meaningful cost measure. The two-qubit SWAP gate is the standard benchmark: the standard optimal construction uses three CNOT gates, and three are necessary in the exact two-qubit synthesis theory [4,5]. For larger systems, upper bounds are easy to obtain from explicit constructions, but matching lower bounds are often subtle once arbitrary one-qubit gates are allowed.
Wire permutations are also a basic data-movement primitive. They appear when logical qubits must be routed to physical locations, when swap networks rearrange registers, and when permutation subroutines are used inside larger quantum algorithms. An exact lower bound for these gates therefore separates unavoidable two-qubit cost from artefacts of a particular compiler or circuit decomposition.
This paper develops a binary-shadow framework for exact CNOT counting in the CNOT+local model and uses it to treat the general n-qubit problem. The target gate is the cyclic wire permutation
S n | x 1 1 | x 2 2 | x n n =   | x n 1 | x 1 2 | x n 1 n .
For n = 2 , this is the ordinary SWAP and costs 3 CNOT gates. For n = 3 , the cost is 6. The natural question is whether there is a closed formula for general n, and more generally, for arbitrary wire permutations.
The binary-shadow method shows that the quantum problem is equivalent to a classical one. Working in the Heisenberg picture, we allow the local Pauli Z axis on each qubit to rotate under the surrounding one-qubit gates. After this change in viewpoint, each CNOT contributes one elementary transvection over F 2 , so every circuit with k CNOT gates has a binary shadow that is a product of k transvections. For a wire permutation, the shadow is rigid: it must coincide with the associated permutation matrix. Consequently, for every wire permutation W σ , one has
CNOT-cost ( W σ ) = tr ( P σ ) ,
where P σ is the permutation matrix of σ and tr ( P σ ) is its transvection length over F 2 .
Thus, the quantum question becomes the classical question of computing the transvection length of permutation matrices. This places the problem in the theory of linear reversible circuits, where CNOT-only synthesis is Gaussian elimination over F 2 , and optimization is governed by word length with respect to elementary transvections [3,6,7]. The decisive concept here is the graph-theoretic link-middle-cut decomposition introduced by Bu, Fan, and Joo in their study of exact CNOT synthesis for linear reversible circuits [8]. Their result shows that an m-cycle permutation matrix requires exactly 3 ( m 1 ) CNOT gates in the CNOT-only model. Related permutation-circuit realizations have also been studied recently from a group-theoretic quantum-circuit perspective [9]. Combined with the binary-shadow reduction, this immediately suggests a complete answer for cyclic SWAP gates. In fact, by adding a short induction on the number of cycles, one obtains a formula for every permutation matrix.
The main result of this paper is the following.
Theorem 1.
Let σ S n , and let c ( σ ) denote the number of disjoint cycles in its cycle decomposition, including fixed points. Then,
CNOT-cost ( W σ ) = tr ( P σ ) = 3 n c ( σ ) .
In particular, if S n is the cyclic SWAP gate from (1), then
CNOT-cost ( S n ) = 3 ( n 1 ) .

Comparison with Existing Work and Novelty

The CNOT-only part of (3) is not claimed as new. Bataille studied the algebraic structure and optimization of CNOT circuits and, in compatible notation, reports the cost 3 ( n p ) for a permutation/cycling with p components [10]. Bu, Fan, and Joo later proved, using the link-middle-cut method, that n-cycle matrices require 3 ( n 1 ) CNOT gates and also generalized the statement to permutation circuits [8]. Liu et al. studied related realizations of permutation groups by CNOT circuits, including exact results for the three-qubit cycle and upper-bound constructions for larger cases [9]. Recent work on sparse amplitude permutation gates further shows that permutation-type primitives remain relevant in state preparation and circuit decomposition [11].
The contribution of the present paper is different: it proves that these CNOT-only lower bounds remain valid even in the larger CNOT+local model, where arbitrary one-qubit gates may be inserted before, after, and between the CNOT gates for free. A priori, those local gates can rotate the Pauli axes and might conceivably create a shorter entangling-gate implementation. The binary-shadow rigidity theorem rules this out for wire permutations. Thus, this paper gives a model-lifting argument from CNOT-only transvection length to exact CNOT complexity with free local gates.
Equation (4) settles the exact values for the first unresolved cases:
CNOT-cost ( S 4 ) = 9 , CNOT-cost ( S 5 ) = 12 , CNOT-cost ( S 6 ) = 15 .
More generally, every time the cyclic shift gains one additional qubit, the optimal CNOT count increases by exactly three.
The proof is deliberately phrased in the Heisenberg picture, following a standard viewpoint in quantum computation and stabilizer-circuit analysis [12,13]. Unlike stabilizer simulation, however, the binary shadow used here tracks only the support pattern of rotated local Z axes; this coarse invariant is weak for general unitaries but becomes exact for wire permutations.
This paper is organized as follows. Section 2 fixes the notation and records the conventions used throughout. Section 3 develops binary shadows of CNOT+local circuits. Section 4 proves the rigidity theorem for wire permutations and the reduction (2). Section 5 computes the transvection length of permutation matrices using cycle structure and the classical exact m-cycle theorem. Section 6 specializes the formula to n-qubit cyclic SWAP gates, including explicit optimal factorizations for n = 4 and n = 5 . Section 7 discusses applications and implications for circuit compilation and resource accounting. Section 8 closes with a more explicit conclusion and open directions.

2. Notation and Setup

We work on the Hilbert space ( C 2 ) n of n qubits. The computational basis on qubit r is denoted by | 0 r , | 1 r . If
| x =   | x 1 1 | x n n , x r { 0 , 1 } ,
then x = ( x 1 , , x n ) will also be regarded as a vector in F 2 n . Throughout this paper, all addition in F 2 is modulo 2, and products of gates are read from right to left.
If i j , then CNOT i j denotes the controlled-NOT gate with control qubit i and target qubit j. Explicitly,
CNOT i j | x 1 1 | x n n =   | x 1 1 | x i i | x i + x j j | x n n ,
with all other qubits unchanged. The arrow in CNOT i j therefore points from the control qubit to the target qubit.
A local unitary is a tensor product
L = U 1 U n ,
where each U r is a one-qubit unitary acting on qubit r only.
For permutation σ S n , we write W σ for the corresponding wire permutation:
W σ | ψ 1 1 | ψ n n =   | ψ σ ( 1 ) 1 | ψ σ ( n ) n .
Thus, output wire r receives the input state that originally sat on wire σ ( r ) . Equivalently,
W σ Z r W σ = Z σ ( r ) ( r = 1 , , n ) ,
where Z r denotes the Pauli Z operator acting on qubit r.
We now introduce the binary objects that will encode the CNOT pattern.
Definition 1.
A local axis on qubit r is an observable of the form
A r = u r Z u r
for some one-qubit unitary u r . Equivalently, A r is a traceless Hermitian unitary on qubit r; in particular, A r 2 = I and the eigenvalues of A r are ± 1 .
In Bloch-sphere language, a local axis is simply a rotated Pauli Z direction. Allowing these axes to vary is what lets the one-qubit gates be absorbed into the formalism.
More explicitly, if X , Y , Z are the Pauli matrices, then every local axis can be written as
A r = α r X + β r Y + γ r Z , α r 2 + β r 2 + γ r 2 = 1 ,
so it is a measurement direction on the Bloch sphere obtained from the standard Z axis by a one-qubit change in basis. The word “local” means that the operator acts on one tensor factor only; the word “axis” refers to the corresponding Bloch-sphere direction.
Definition 2.
Let A = ( A 1 , , A n ) be a family of local axes, and let x = ( x 1 , , x n ) F 2 n . We write
A x : = A 1 x 1 A n x n , A r 0 = I , A r 1 = A r .
If, for example, x = ( 1 , 0 , 1 ) , then A x = A 1 I A 3 .
Because the factors in (8) act on different qubits, they commute, and one has
A x A y = A x + y ( x , y F 2 n ) .
For a bit vector x F 2 n , we write
supp ( x ) : = { r { 1 , , n } : x r = 1 }
for its support.
Definition 3.
For i j , let T j i G L ( n , F 2 ) be the elementary transvection defined by
T j i e j = e i + e j , T j i e r = e r ( r j ) ,
where e 1 , , e n is the standard basis of F 2 n .
The notation in (9) is chosen to mirror the circuit notation: the CNOT gate CNOT i j contributes the transvection T j i on the Heisenberg-side labels.
For clarity, T j i is the only elementary transvection notation used below. When a two-wire swap is expanded, it will be written as the three directed transvections T b a T a b T b a , not as an undefined bidirectional symbol.
Definition 4.
For σ S n , the associated permutation matrix P σ G L ( n , F 2 ) is defined by
P σ e r = e σ ( r ) ( r = 1 , , n ) .
We write tr ( P σ ) for the minimal number of elementary transvections needed to factor P σ .
If σ has disjoint cycle decomposition
σ = γ 1 γ 2 γ c ,
we write c ( σ ) = c for the number of cycles, counting fixed points as 1-cycles. If m i is the length of γ i , then
m 1 + + m c = n .
Finally, we fix the specific cyclic shift permutation used throughout this paper.
Definition 5.
Let σ n S n be the cycle defined by
σ n ( 1 ) = n , σ n ( r ) = r 1 ( 2 r n ) .
The corresponding wire permutation W σ n will be denoted by S n and called the n-qubit cyclic SWAP gate. Thus,
S n | x 1 1 | x 2 2 | x n n =   | x n 1 | x 1 2 | x n 1 n .
The matrix P σ n is the standard cyclic permutation matrix
P σ n = 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 .

3. Binary Shadows of CNOT+Local Circuits

The construction below is a support-level version of the Heisenberg evolution of Pauli observables [12,13]. The surrounding one-qubit gates are absorbed by allowing the local Z axes to rotate. We begin with the basic one-CNOT calculation.
Lemma 1.
Let
G = L out CNOT i j L in
be an n-qubit circuit consisting of one CNOT gate and arbitrary local unitaries before and after it. Then, there exist families of local axes A = ( A 1 , , A n ) on the input side and B = ( B 1 , , B n ) on the output side such that
G B e r G = A T j i e r for all r = 1 , , n .
Consequently,
G B x G = A T j i x for all x F 2 n .
Proof. 
Write
L in = V 1 V n , L out = U 1 U n .
Define local axes on the input and output sides by
A r : = V r Z V r , B r : = U r Z U r ( r = 1 , , n ) .
For qubits r { i , j } , the CNOT acts trivially, so
G B r G = V r Z V r = A r .
For the two active qubits, we use the standard Heisenberg identities
CNOT i j Z i CNOT i j = Z i , CNOT i j Z j CNOT i j = Z i Z j .
Hence,
G B i G = A i , G B j G = A i A j .
This is precisely the elementary transvection T j i on exponent vectors. The basis vector e i labels the output axis B i , and the identity G B i G = A i says that its input-side exponent vector is still e i = T j i e i . The basis vector e j labels B j , and the identity G B j G = A i A j says that its input-side exponent vector is e i + e j = T j i e j . All other basis vectors are fixed. Equation (15) then follows from multiplicativity: conjugation preserves products, and the observables A x multiply by bitwise addition of exponents. □
The previous lemma motivates the central definition.
Definition 6.
Let U be an n-qubit unitary. A matrix M G L ( n , F 2 ) is called a binary shadow of U if there exist families of local axes A on the input side and B on the output side such that
U B x U = A M x for all x F 2 n .
A binary shadow need not be unique for a general unitary, because the families of local axes in (17) may not be unique. The notation “a binary shadow of U” should therefore be read as “a binary shadow of U with respect to some chosen input and output local axes.” The axis families A and B may depend on U and on the particular CNOT+local decomposition used to construct the shadow. The next theorem shows, however, that the existence of a short shadow is automatic for every circuit with few CNOT gates.
Remark 1
(Terminology). The term “binary shadow” is not meant to invoke classical shadow tomography. Classical shadows are randomized measurement data used to estimate properties of quantum states. Here, the object is instead a deterministic matrix over F 2 extracted from the Heisenberg evolution of rotated local Z axes. The word “shadow” is used only in the elementary sense that this matrix is a coarse binary projection of the full operator evolution.
Theorem 2.
Let U be an n-qubit circuit containing exactly k CNOT gates and any number of one-qubit gates. If the CNOT gates, in temporal order, are
CNOT i 1 j 1 , CNOT i 2 j 2 , , CNOT i k j k ,
then U has a binary shadow
M = T j 1 i 1 T j 2 i 2 T j k i k .
In particular, every k-CNOT circuit has a binary shadow that is a product of exactly k elementary transvections.
Proof. 
We argue by induction on k. If k = 0 , then U is local, say U = U 1 U n . Choose any family of output axes B = ( B 1 , , B n ) and define
A r : = U r B r U r .
Then, U B x U = A x for every x F 2 n , so the identity matrix is a binary shadow of U.
Now, suppose the statement is true for circuits with k 1 CNOT gates, and write
U = G k V ,
where G k is the last CNOT block together with the local gates immediately adjacent to it, and V contains the first k 1 CNOT gates. By Lemma 1, there exist an intermediate family of local axes C and an output family B such that
G k B x G k = C T j k i k x for all x F 2 n .
By the induction hypothesis applied to V, there exist an input family A and a binary shadow
N = T j 1 i 1 T j k 1 i k 1
for which
V C y V = A N y for all y F 2 n .
Combining the two identities gives
U B x U = V G k B x G k V = V C T j k i k x V = A N T j k i k x .
Therefore,
M = N T j k i k = T j 1 i 1 T j k i k
is a binary shadow of U. □

4. Wire Permutations and Transvection Length

For a wire permutation W σ , the binary shadow is in fact unique.
Theorem 3.
Let U be an n-qubit circuit built from CNOT gates and one-qubit gates, and suppose that U = W σ is a wire permutation. Then, every binary shadow of U is equal to P σ . Consequently,
CNOT-cost ( W σ ) tr ( P σ ) .
Proof. 
Let M be any binary shadow of U. By definition, there exist families of local axes A and B such that
U B x U = A M x for all x F 2 n .
In particular,
U B r U = A M e r ( r = 1 , , n ) ,
where B r = B e r is a local observable on output qubit r.
Because U = W σ only permutes tensor factors, the operator U B r U is local on input qubit σ ( r ) . On the other hand, the operator A M e r acts nontrivially, exactly on the qubits in supp ( M e r ) , because every local axis A s is non-identity. Therefore, supp ( M e r ) must contain exactly one index, namely σ ( r ) . Equivalently,
M e r = e σ ( r ) ( r = 1 , , n ) .
Thus, M = P σ .
If U is realized with k CNOT gates, then by Theorem 2, it has a binary shadow that is a product of k transvections. Since every binary shadow is P σ , the matrix P σ admits a factorization of length k. Hence, k tr ( P σ ) , which proves (19). □
Corollary 1.
For every wire permutation W σ ,
CNOT-cost ( W σ ) = tr ( P σ ) .
Equivalently, allowing arbitrary one-qubit gates does not lower the optimal CNOT count of a wire permutation below its optimal CNOT-only count.
Proof. 
The lower bound is exactly Theorem 3. For the reverse inequality, choose a shortest transvection factorization
P σ = T j 1 i 1 T j k i k .
Consider the CNOT-only circuit
V = CNOT i k j k CNOT i 1 j 1 ,
so that the CNOT gates appear in temporal order as
CNOT i 1 j 1 , , CNOT i k j k .
Applying Theorem 2 with no surrounding one-qubit gates shows that V has binary shadow P σ relative to the standard Z axes. Hence,
V Z r V = Z σ ( r ) ( r = 1 , , n ) .
For computational-basis states, this means that the rth output bit is exactly the σ ( r ) th input bit, so V implements the wire permutation W σ . Therefore, CNOT-cost ( W σ ) k = tr ( P σ ) . □
Remark 2.
Readers who prefer the usual Schrödinger-side bit-update convention may transpose all matrices. Since
T j i T = T i j ,
transvection length is unchanged by transposition, and the results above are independent of this convention.
Remark 3.
For any transposition ( a b ) , one has
P ( a b ) = T b a T a b T b a ,
so tr ( P ( a b ) ) 3 . By Corollary 1, this is exactly the CNOT cost of the corresponding two-wire swap. The exact three-CNOT lower bound for two-qubit SWAP follows from the standard optimal two-qubit synthesis results [4,5]. Hence,
tr ( P ( a b ) ) = 3 .
Section 4 is the quantum reduction step: every exact CNOT-counting problem for a wire permutation in the CNOT+local model becomes a transvection-length problem for a permutation matrix over F 2 . We now solve that classical problem for arbitrary permutations.

5. Transvection Length of Permutation Matrices

CNOT-only circuits on computational basis states implement invertible linear maps over F 2 , and elementary CNOT gates correspond exactly to elementary transvections. This viewpoint is standard in linear reversible circuit synthesis and optimization [3,6,7]. In this section, we derive the exact formula
tr ( P σ ) = 3 n c ( σ )
for every permutation σ S n . The key external input is the exact length of a single cycle matrix.

5.1. The Cycle Case and the Link-Middle-Cut Method

The relevant classical lower-bound technique is the link-middle-cut (LMC) decomposition of a CNOT synthesis, introduced by Bu, Fan, and Joo [8]. Their method associates several graphs with a CNOT circuit and classifies each gate as a link, middle, or cut gate. For a cycle matrix, they prove that each of these three classes must contain at least m 1 gates, yielding an exact lower bound of 3 ( m 1 ) . The same paper also shows that optimal factorizations of a cycle matrix split into three spanning trees of size m 1 .
This single-cycle theorem is closely aligned with earlier CNOT-only work of Bataille, who analyzed CNOT circuits through their underlying algebraic structure and stated the corresponding 3 ( n p ) cost for permutation/cycling structures with p components [10]. The LMC theorem is used here as the quoted exact transvection-length input, while the binary-shadow argument supplies the additional quantum reduction needed when arbitrary local gates are free.
For the purposes of the present paper, we need only the following theorem.
Theorem 4
(Bu–Fan–Joo). Let τ S m be an m-cycle, and let P τ be its permutation matrix over F 2 . Then,
tr ( P τ ) = 3 ( m 1 ) .
Remark 4.
Theorem 4 is the exact classical statement needed to extend the binary-shadow method from the three-qubit cyclic SWAP to all n. In the notation of the introduction, it says precisely that the permutation matrix of the m-qubit cyclic shift has CNOT-only cost 3 ( m 1 ) .

5.2. Cycle Decomposition and the General Permutation Formula

We now record two elementary lemmas that convert the single-cycle theorem into a formula for arbitrary permutations.
Lemma 2.
Let σ S n , and let a and b lie in distinct cycles of σ. Then, the permutation σ ( a b ) has exactly one fewer cycle than σ:
c σ ( a b ) = c ( σ ) 1 .
Proof. 
Write the two cycles containing a and b as
( a a 2 a r ) and ( b b 2 b s ) ,
and let the remaining cycles of σ be unchanged. Since the transposition ( a b ) acts first in the composition σ ( a b ) , we compute
a b b 2 , b 2 b 2 b 3 , , b s b s b ,
and then,
b a a 2 , a 2 a 2 a 3 , , a r a r a .
Therefore, the two cycles merge into the single cycle
( a b 2 b s b a 2 a r ) ,
while all other cycles are unchanged. Hence, the total number of cycles drops by exactly one. □
Proposition 1.
For every permutation σ S n ,
tr ( P σ ) 3 n c ( σ ) .
Proof. 
Let
σ = γ 1 γ 2 γ c
be the disjoint cycle decomposition of σ , with | γ i | = m i . Each cycle γ i can be written as a product of m i 1 transpositions:
γ i = ( a i , 1 a i , 2 ) ( a i , 2 a i , 3 ) ( a i , m i 1 a i , m i ) ,
where γ i = ( a i , 1 a i , 2 a i , m i ) . Since each transposition matrix has transvection length 3 by (22), we obtain
tr ( P γ i ) 3 ( m i 1 ) .
Because the cycles are disjoint, their permutation matrices commute and multiply to P σ . By subadditivity of transvection length,
tr ( P σ ) i = 1 c tr ( P γ i ) i = 1 c 3 ( m i 1 ) = 3 i = 1 c m i c = 3 ( n c ) .
This proves (24). □
We can now prove the exact formula.
Theorem 5.
For every permutation σ S n ,
tr ( P σ ) = 3 n c ( σ ) .
Proof. 
The upper bound is Proposition 1. For the lower bound, we induct on c ( σ ) .
If c ( σ ) = 1 , then σ is an n-cycle, and the claim is exactly Theorem 4.
Now, assume the formula is known for all permutations on n letters with fewer than c 2 cycles, and let σ have c cycles. Suppose for contradiction that
tr ( P σ ) < 3 ( n c ) .
Choose a and b from two distinct cycles of σ , and set
τ : = σ ( a b ) .
By Lemma 2, τ has c 1 cycles. Moreover, our convention P ρ e r = e ρ ( r ) gives P α β = P α P β for all permutations α , β . Hence, for τ = σ ( a b ) ,
P τ = P σ P ( a b ) .
There is no extra sign or phase issue: these are ordinary 0–1 permutation matrices, now regarded over F 2 . So, by subadditivity of transvection length and (22), we have
tr ( P τ ) tr ( P σ ) + tr ( P ( a b ) ) < 3 ( n c ) + 3 = 3 n ( c 1 ) .
This contradicts the induction hypothesis applied to τ , since c ( τ ) = c 1 . Therefore, no such σ can exist, and the lower bound
tr ( P σ ) 3 n c ( σ )
holds for every σ . Together with Proposition 1, this proves (25). □
Remark 5.
Theorem 5 is consistent with the general permutation result proved by Bu, Fan, and Joo [8]. The point of the argument above is that, once the exact single-cycle length is known, the full cycle-structure formula follows by a short induction that fits naturally with the binary-shadow reduction.
The quantum consequence is now immediate.
Corollary 2.
For every wire permutation W σ ,
CNOT-cost ( W σ ) = 3 n c ( σ ) .
Proof. 
Combine Corollary 1 with Theorem 5. □

6. Exact CNOT Cost of the n -Qubit Cyclic SWAP

We now specialize Corollary 2 to the cyclic SWAP gate S n from Definition 5. Since σ n is a single n-cycle, we have c ( σ n ) = 1 , and therefore,
CNOT-cost ( S n ) = 3 ( n 1 ) .
We first record an explicit optimal family of circuits.
Proposition 2.
For every n 2 ,
S n = SWAP 12 SWAP 23 SWAP n 1 , n .
Consequently,
CNOT-cost ( S n ) 3 ( n 1 ) .
At the level of transvections,
P σ n = T n n 1 T n 1 n T n n 1 T 2 1 T 1 2 T 2 1 .
Proof. 
Starting from the right-hand side of (28), the rightmost swap SWAP n 1 , n moves the state on wire n one position to the left, the next swap SWAP n 2 , n 1 moves it one step further, and so on. After the full product is applied, the state originally on wire n has moved to wire 1, while each of the states originally on wires 1 , 2 , , n 1 has shifted one place to the right. This is exactly the action of S n .
Each two-wire swap uses three CNOT gates, so (29) follows immediately. Replacing each swap by its standard three-transvection factorization gives (30). □
We can now state the exact theorem.
Theorem 6.
For every n 2 , the n-qubit cyclic SWAP gate satisfies
CNOT-cost ( S n ) = 3 ( n 1 ) .
Equivalently, the cyclic permutation matrix (13) has transvection length
tr ( P σ n ) = 3 ( n 1 ) .
Proof. 
The upper bound is Proposition 2. The lower bound follows from Corollary 2, because c ( σ n ) = 1 . □
The first unresolved cases asked for in the problem statement now follow immediately.
Corollary 3.
The exact CNOT costs of the four- and five-qubit cyclic SWAP gates are
CNOT-cost ( S 4 ) = 9 , CNOT-cost ( S 5 ) = 12 .
More generally,
CNOT-cost ( S 6 ) = 15 , CNOT-cost ( S 7 ) = 18 , and in general CNOT-cost ( S n ) = 3 n 3 .

6.1. Explicit Optimal Factorizations for n = 4 and n = 5

For completeness, we write out the first two new cases explicitly.
Example 1
(The four-qubit cyclic SWAP). The four-qubit cyclic SWAP is
S 4 | a 1 | b 2 | c 3 | d 4 = | d 1 | a 2 | b 3 | c 4 .
Its permutation matrix is
P σ 4 = 0 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 ,
and by Theorem 6, one has
tr ( P σ 4 ) = CNOT-cost ( S 4 ) = 9 .
One optimal factorization is
P σ 4 = T 4 3 T 3 4 T 4 3 T 3 2 T 2 3 T 3 2 T 2 1 T 1 2 T 2 1 = P ( 3 4 ) P ( 2 3 ) P ( 1 2 ) .
Thus, no exact implementation of S 4 can use fewer than nine CNOT gates, even with arbitrary one-qubit gates inserted anywhere in the circuit.
Example 2
(The five-qubit cyclic SWAP). The five-qubit cyclic SWAP is
S 5 | a 1 | b 2 | c 3 | d 4 | e 5 = | e 1 | a 2 | b 3 | c 4 | d 5 .
Its permutation matrix is
P σ 5 = 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 ,
and Theorem 6 gives
tr ( P σ 5 ) = CNOT-cost ( S 5 ) = 12 .
An optimal factorization is
P σ 5 = T 5 4 T 4 5 T 5 4 T 4 3 T 3 4 T 4 3 T 3 2 T 2 3 T 3 2 T 2 1 T 1 2 T 2 1 = P ( 4 5 ) P ( 3 4 ) P ( 2 3 ) P ( 1 2 ) .
Hence, twelve CNOT gates are necessary and sufficient.

6.2. First Exact Values

Table 1 lists the first exact values for cyclic SWAP gates.
The table exhibits the simplest qualitative consequence of the theorem: the exact cost grows linearly with slope 3. In particular, extending a cyclic shift from n to n + 1 wires increases the optimal CNOT count by exactly three.

7. Applications and Implications

The theorem has three immediate implications.
First, it gives a certified benchmark for qubit-routing and register-rearrangement subroutines. If an algorithm or compiler must implement a pure wire permutation W σ in an unconstrained architecture, then 3 ( n c ( σ ) ) CNOT gates are unavoidable. In particular, the adjacent-swap construction for an n-cycle is not merely natural; it is globally optimal even after arbitrary one-qubit gates are allowed at zero cost.
Second, the result clarifies the role of local gates in exact synthesis. In many Clifford, Clifford + T , and reversible-linear compilation tasks, local gates are treated as comparatively cheap. The binary-shadow rigidity theorem shows that, for wire permutations, those local degrees of freedom cannot be exploited to reduce the two-qubit cost. This provides a reusable proof strategy: if a target family has a rigid support-level Heisenberg shadow, then CNOT-only lower bounds may transfer to the CNOT+local setting.
Third, the result is relevant as a low-level resource-accounting primitive for larger permutation-based constructions. Recent work on sparse amplitude permutation gates uses permutation subroutines in state-preparation problems [11]. Recent quantum-information and quantum-secure communication protocols also emphasize the need to account carefully for quantum resources, including semi-quantum private comparison protocols [14,15,16] and quantum-based authentication schemes for smart-grid settings [17]. The present theorem does not optimize those complete protocols; rather, it supplies an exact lower bound for the pure wire-permutation/data-movement component whenever such a component occurs inside a larger construction.

8. Conclusions and Future Work

The binary-shadow method reduces an exact CNOT-counting problem for quantum circuits to a transvection-length problem over F 2 . For wire permutations, this reduction is complete: the binary shadow is rigid, and the CNOT complexity in the CNOT+local model is exactly the same as in the CNOT-only model. In this sense, arbitrary one-qubit gates do not create any hidden shortcut for permuting qubit wires.
The present paper extends the three-qubit cyclic SWAP analysis to arbitrary n. The exact formula
CNOT-cost ( S n ) = 3 ( n 1 )
shows that the linear upper bound coming from adjacent swaps is already optimal. More generally, the formula
CNOT-cost ( W σ ) = 3 n c ( σ )
expresses the exact CNOT cost of a wire permutation entirely in terms of its cycle structure.
Conceptually, three mathematical ideas are doing the work:
  • The Heisenberg-picture binary shadow, which extracts a matrix over F 2 from a CNOT+local circuit;
  • Rigidity for wire permutations, which forces that shadow to be the permutation matrix itself;
  • The graph-theoretic link-middle-cut theory of CNOT syntheses, which computes the transvection length of cycle matrices and hence, of arbitrary permutation matrices.
Together, these ideas turn a quantum lower-bound problem into a concrete question about word length in G L ( n , F 2 ) with respect to elementary transvections.
There are several natural directions for further work. First, it would be interesting to identify other classes of target unitaries for which the binary shadow is similarly rigid. Second, one can ask for analogous exact formulas under architectural constraints; for example, when only nearest-neighbour CNOT gates are allowed. Third, the permutation case suggests investigating whether the binary-shadow method can be fused with other classical lower-bound techniques beyond the LMC framework, potentially yielding new exact CNOT counts for larger families of unitaries.
The comparison with the existing CNOT-only literature is now transparent. The formula 3 ( n c ( σ ) ) is already present at the level of CNOT-only permutation circuits; what is proved here is that the same value is the exact CNOT cost in the larger CNOT+local model. Thus, this paper’s main role is not to replace the LMC theory or earlier CNOT-only analyses, but to explain why their permutation lower bounds survive the addition of arbitrary one-qubit gates.
The limitations are also clear. The binary shadow records only the support pattern of rotated local Z axes, so it is generally too coarse to classify arbitrary unitaries. It becomes decisive here because a wire permutation maps each local output observable to a single local input observable, forcing the shadow matrix to be a permutation matrix. Extending the method therefore requires finding other target families with comparable rigidity.
Finally, it would be useful to turn the binary-shadow obstruction into an automated compiler certificate: given a proposed short circuit for a wire permutation, the certificate would show directly that its CNOT count is below the transvection length and hence, impossible.

Funding

This research received no external funding.

Data Availability Statement

No new data were created or analyzed in this study. Data sharing is not applicable to this article.

Conflicts of Interest

The author declares no conflicts of interest.

References

  1. Barenco, A.; Bennett, C.H.; Cleve, R.; DiVincenzo, D.P.; Margolus, N.; Shor, P.; Sleator, T.; Smolin, J.A.; Weinfurter, H. Elementary gates for quantum computation. Phys. Rev. A 1995, 52, 3457–3467. [Google Scholar] [CrossRef] [PubMed]
  2. Nielsen, M.A.; Chuang, I.L. Quantum Computation and Quantum Information, 10th Anniversary ed.; Cambridge University Press: Cambridge, UK, 2010. [Google Scholar]
  3. Saeedi, M.; Markov, I.L. Synthesis and optimization of reversible circuits—A survey. ACM Comput. Surv. 2013, 45, 21. [Google Scholar] [CrossRef]
  4. Vidal, G.; Dawson, C.M. Universal quantum circuit for two-qubit transformations with three controlled-NOT gates. Phys. Rev. A 2004, 69, 010301(R). [Google Scholar]
  5. Vatan, F.; Williams, C. Optimal quantum circuits for general two-qubit gates. Phys. Rev. A 2004, 69, 032315. [Google Scholar] [CrossRef]
  6. Shende, V.V.; Prasad, A.K.; Markov, I.L.; Hayes, J.P. Synthesis of reversible logic circuits. IEEE Trans. Comput.-Aided Des. Integr. Circuits Syst. 2003, 22, 710–722. [Google Scholar] [CrossRef]
  7. Patel, K.N.; Markov, I.L.; Hayes, J.P. Optimal synthesis of linear reversible circuits. Quantum Inf. Comput. 2008, 8, 282–294. [Google Scholar] [CrossRef]
  8. Bu, A.; Fan, E.; Joo, R. Minimum synthesis cost of CNOT circuits. Quantum Inf. Process. 2025, 24, 208. [Google Scholar] [CrossRef]
  9. Liu, J.; Ren, Y.; Cao, Y.; Sun, H.; Chen, L. Realization of permutation groups by quantum circuit. arXiv 2024, arXiv:2406.01350. [Google Scholar]
  10. Bataille, M. Quantum circuits of CNOT gates: Optimization and entanglement. Quantum Inf. Process. 2022, 21, 269. [Google Scholar] [CrossRef]
  11. Gaidai, I.; Herrman, R. Decomposition of sparse amplitude permutation gates with application to preparation of sparse clustered quantum states. Quantum Inf. Process. 2026, 25, 31. [Google Scholar] [CrossRef]
  12. Gottesman, D. The Heisenberg representation of quantum computers. arXiv 1998, arXiv:quant-ph/9807006. [Google Scholar]
  13. Aaronson, S.; Gottesman, D. Improved simulation of stabilizer circuits. Phys. Rev. A 2004, 70, 052328. [Google Scholar] [CrossRef]
  14. Huang, J.-H.; Li, M.-L.; Liu, Y.-Y.; Qin, L.-G.; Gong, L.-H. Efficient semi-quantum private comparison protocol of size relation based on high dimensional Bell states. Chin. Phys. B, 2025; in press. [CrossRef]
  15. Zhou, N.-R.; Chen, Z.-Y.; Liu, Y.-Y.; Gong, L.-H. Multi-party semi-quantum private comparison protocol of size relation with d-level GHZ states. Adv. Quantum Technol. 2025, 8, 2400530. [Google Scholar] [CrossRef]
  16. Zhou, Y.-Y.; Wang, Y.-P.; Dai, J.-Y.; Gong, L.-H. Efficient multi-party semi-quantum private comparison protocol based on Bell states. Adv. Quantum Technol. 2025, 8, e00439. [Google Scholar] [CrossRef]
  17. Lou, X.; Wang, Z. A novel quantum-based mutual authentication and key agreement scheme for smart grid. IEEE Trans. Inf. Forensics Secur. 2026, 21, 2061–2075. [Google Scholar] [CrossRef]
Table 1. Exact CNOT cost of the n-qubit cyclic SWAP gate.
Table 1. Exact CNOT cost of the n-qubit cyclic SWAP gate.
n c ( σ n ) CNOT-cost ( S n )
213
316
419
5112
6115
3 ( n 1 )
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zhang, B. A Binary-Shadow Method for Wire Permutations and the Exact CNOT Cost of n-Qubit Cyclic SWAP Gates. Quantum Rep. 2026, 8, 55. https://doi.org/10.3390/quantum8020055

AMA Style

Zhang B. A Binary-Shadow Method for Wire Permutations and the Exact CNOT Cost of n-Qubit Cyclic SWAP Gates. Quantum Reports. 2026; 8(2):55. https://doi.org/10.3390/quantum8020055

Chicago/Turabian Style

Zhang, Bohan. 2026. "A Binary-Shadow Method for Wire Permutations and the Exact CNOT Cost of n-Qubit Cyclic SWAP Gates" Quantum Reports 8, no. 2: 55. https://doi.org/10.3390/quantum8020055

APA Style

Zhang, B. (2026). A Binary-Shadow Method for Wire Permutations and the Exact CNOT Cost of n-Qubit Cyclic SWAP Gates. Quantum Reports, 8(2), 55. https://doi.org/10.3390/quantum8020055

Article Metrics

Back to TopTop