Sign in
← Atlas
Exact & formalGatesTwo-qubit gate

DCX (double-CNOT) gate

A two-qubit permutation gate defined as two CNOTs with reversed control and target applied back to back — a genuinely different two-CNOT gate from SWAP (which uses three), and notable for not being self-inverse.

double cnottwo qubitcliffordrouting

Atlas stars stay in the public catalog. Saving this entry to your workspace starts an unstarred private copy.

DCX is useful less as an algorithmic primitive and more as a compiler/transpiler building block: it is literally the two-CNOT circuit that appears naturally when routing swaps are partially applied, and Qiskit exposes it as a named gate so transpilers do not have to re-recognize the pattern.

Circuit & simulation
|01⟩ → |11⟩100%
|10⟩ → |01⟩100%
What this takes and returns
Takes2 qubitsWhat joins here

Takes a 2-qubit register and states no assumption about what is on it. That is the whole condition: anything returning 2 qubits can feed it.

16 entries meet this end. Named below.

Returns2 qubitsWhat joins here

Returns a 2-qubit register a next stage can take. This is the end that joins.

11 entries meet this end. Named below.

A unitary. The same register goes in and comes out, and this entry states no assumption about what is on it — which is what lets anything of the same width feed it. See all 29 →

How it works

Definition

In the q[0]q[0]-leftmost basis ordering used throughout this catalog, composing CX(q0 ⁣ ⁣q1)\mathrm{CX}(q_0\!\to\!q_1) then CX(q1 ⁣ ⁣q0)\mathrm{CX}(q_1\!\to\!q_0) gives

DCX=(1000001000010100)\mathrm{DCX} = \begin{pmatrix} 1&0&0&0\\0&0&1&0\\0&0&0&1\\0&1&0&0 \end{pmatrix}

in the ordered basis {00,01,10,11}\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\} (frameworks using a little-endian statevector ordering will print an index-permuted version of this same matrix).

Action on basis states

DCX00=00,DCX01=11,DCX10=01,DCX11=10\mathrm{DCX}|00\rangle = |00\rangle, \qquad \mathrm{DCX}|01\rangle = |11\rangle, \qquad \mathrm{DCX}|10\rangle = |01\rangle, \qquad \mathrm{DCX}|11\rangle = |10\rangle

00|00\rangle is a fixed point; the other three basis states form a single 3-cycle 01111001|01\rangle\to|11\rangle\to|10\rangle\to|01\rangle, verified by direct basis-state tracking through both CNOTs.

Decomposition

DCX=CX(q1 ⁣ ⁣q0)CX(q0 ⁣ ⁣q1)\mathrm{DCX} = \mathrm{CX}(q_1\!\to\!q_0)\cdot \mathrm{CX}(q_0\!\to\!q_1)

This is not really a "decomposition" in the sense of compiling a hardware-hard gate down to easier ones — two reversed CNOTs is the definition of DCX. The gate exists as a named primitive because this exact two-CNOT pattern recurs often enough in routing and partial-SWAP contexts to be worth naming directly.

Key identities

  • DCX\mathrm{DCX} is Clifford, since it is a product of two Clifford (CX\mathrm{CX}) gates.
  • DCX3=II\mathrm{DCX}^3 = I\otimes I (period 3, from the 3-cycle structure), but DCX2II\mathrm{DCX}^2 \ne I\otimes I — unlike CX\mathrm{CX}, CZ\mathrm{CZ}, or SWAP\mathrm{SWAP}, DCX\mathrm{DCX} is not self-inverse: DCX=DCX2DCX\mathrm{DCX}^\dagger = \mathrm{DCX}^2 \ne \mathrm{DCX}.
  • DCX\mathrm{DCX} differs from SWAP\mathrm{SWAP} (three alternating CNOTs) by exactly one CNOT: SWAP=CX(q0 ⁣ ⁣q1)DCX\mathrm{SWAP} = \mathrm{CX}(q_0\!\to\!q_1)\cdot\mathrm{DCX}, so appending one more CNOT to DCX completes a full SWAP.
  • Because DCX is built from only two CNOTs rather than three, it is cheaper than a full SWAP whenever a circuit only needs the specific 3-cycle permutation rather than a genuine two-qubit exchange.
Implementation
Native
dcx.qasm
OPENQASM 3.0;
include "stdgates.inc";
qubit[2] q;
x q[1];
cx q[0], q[1];
cx q[1], q[0];
Quantum vs classical

Classical baseline

Use a classical state-vector or matrix simulation at the same width, precision, and measurement objective.

Quantum claim

The quantum record demonstrates a state or operator behavior; it does not make classical simulation or communication costs disappear.

How to compare

Compare fidelity, samples, gate depth, noise, memory, and the cost of preparing and reading the state.

Declared gaps

Nobody has reviewed this record for gaps yet.

Literature & references
Quantum Computation and Quantum Information: 10th Anniversary Edition2010 · Michael A. Nielsen and Isaac L. Chuang

Standard reference for gate matrices, the Clifford/non-Clifford distinction, and controlled-gate constructions used throughout this record.

doi.org/10.1017/cbo9780511976667
OpenQASM 3: A broader and deeper quantum assembly language2021 · Andrew W. Cross, Ali Javadi-Abhari, Thomas Alexander, Niel de Beaudrap, Lev S. Bishop, Steven Heidel, Colm A. Ryan, Prasahnt Sivarajah, John Smolin, Jay M. Gambetta, Blake R. Johnson

Defines the standard gate library (id, sdg, tdg, cy, crz, rxx, rzz, ccx, cx…) used natively by the code snippets on this record.

arxiv.org/abs/2104.14722