Skip to main content
KetQat

Appearance

Definition · intermediate

ZX diagram

A graph built from green Z spiders, red X spiders and Hadamard boxes, with open input and output wires. Each diagram denotes a linear map between qubit spaces, obtained by contracting the tensors of its generators along the wires.

Established definitionMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

A ZX diagram with mm inputs and nn outputs is a finite undirected multigraph whose internal vertices are generators and which has mm input and nn output boundary wires. The generators, with their interpretation [ ⁣[⋅] ⁣][\![\cdot]\!] as linear maps (C2)⊗a→(C2)⊗b(\C^2)^{\otimes a} \to (\C^2)^{\otimes b} for a generator with aa incoming and bb outgoing wires, are:

[ ⁣[Zαa,b] ⁣]=∣0⟩⊗b⟨0∣⊗a+eiα ∣1⟩⊗b⟨1∣⊗a,[ ⁣[Xαa,b] ⁣]=∣+⟩⊗b⟨+∣⊗a+eiα ∣−⟩⊗b⟨−∣⊗a,[\![Z^{a,b}_\alpha]\!] = \ket{0}^{\otimes b}\bra{0}^{\otimes a} + e^{i\alpha}\,\ket{1}^{\otimes b}\bra{1}^{\otimes a}, \qquad [\![X^{a,b}_\alpha]\!] = \ket{+}^{\otimes b}\bra{+}^{\otimes a} + e^{i\alpha}\,\ket{-}^{\otimes b}\bra{-}^{\otimes a},
[ ⁣[H] ⁣]=12(111−1),[\![H]\!] = \tfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix},

where ∣±⟩=(∣0⟩±∣1⟩)/2\ket{\pm} = (\ket{0} \pm \ket{1})/\sqrt{2} and a,b≥0a, b \ge 0 (an empty tensor power is the number 1). Zαa,bZ^{a,b}_\alpha is the Z spider (drawn green), Xαa,bX^{a,b}_\alpha the X spider (drawn red), HH the Hadamard box, and α\alpha the spider's phase; a phase of 0 is omitted. Plain wires denote the identity, and crossing wires the swap.

The interpretation of a whole diagram is the tensor contraction of its generators along the internal wires, with the boundary wires left open. Because each spider is symmetric in its inputs and in its outputs, and because bending a wire (turning an input into an output) is implemented by the cup ∣00⟩+∣11⟩=[ ⁣[Z00,2] ⁣]\ket{00} + \ket{11} = [\![Z^{0,2}_0]\!], the interpretation depends only on the graph, not on how it is drawn ("only connectivity matters").

Two diagrams are equal when their interpretations are equal; many papers instead work up to a nonzero scalar factor. The calculus was introduced by Coecke and Duncan; the textbook is Coecke and Kissinger. The definition uses Xαa,b=H⊗b Zαa,b H⊗aX^{a,b}_\alpha = H^{\otimes b}\, Z^{a,b}_\alpha\, H^{\otimes a}, which follows from H∣0⟩=∣+⟩H\ket{0} = \ket{+} and H∣1⟩=∣−⟩H\ket{1} = \ket{-}.

Holds when

  • Qubits only; phases α∈R\alpha \in \R taken modulo 2π2\pi.
  • Diagrams are read as tensor networks, so only connectivity matters, not the drawing.
Part of
Stated in

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. Bob Coecke, Ross Duncan (2011). Interacting quantum observables: categorical algebra and diagrammatics. New Journal of Physics 13, 043016. doi:10.1088/1367-2630/13/4/043016arXiv:0906.4725
  2. Bob Coecke, Aleks Kissinger (2017). Picturing Quantum Processes. Cambridge University Press. doi:10.1017/9781316219317
  3. Ross Duncan, Aleks Kissinger, Simon Perdrix, John van de Wetering (2020). Graph-theoretic simplification of quantum circuits with the ZX-calculus. Quantum 4, 279. doi:10.22331/q-2020-06-04-279arXiv:1902.03178

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    Generator interpretations, the cup identity and X = H^b Z H^a re-derived and checked numerically (numpy tensors for several arities); introduction of the calculus and its 'only topology matters' reading compared with Coecke and Duncan, arXiv 0906.4725, Sections 2.1-2.4; Crossref metadata for coecke-duncan-2011 and coecke-kissinger-2017 matched.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e

Current revision fe860deee456679a. Source file knowledge/records/definition/zx-diagram.md in the content repository (readable there once it is public).