The ZX-calculus is a rigorous
graphical language for reasoning about
linear map
In mathematics, and more specifically in linear algebra, a linear map (also called a linear mapping, linear transformation, vector space homomorphism, or in some contexts linear function) is a Map (mathematics), mapping V \to W between two vect ...
s between
qubits, which are represented as
string diagrams String diagrams are a formal graphical language for representing morphisms in monoidal categories, or more generally 2-cells in 2-categories. They are a prominent tool in applied category theory. When interpreted in the monoidal category of vector ...
called ''ZX-diagrams''. A ZX-diagram consists of a set of generators called ''spiders'' that represent specific
tensor
In mathematics, a tensor is an algebraic object that describes a multilinear relationship between sets of algebraic objects related to a vector space. Tensors may map between different objects such as vectors, scalars, and even other tenso ...
s. These are connected together to form a
tensor network similar to
Penrose graphical notation
In mathematics and physics, Penrose graphical notation or tensor diagram notation is a (usually handwritten) visual depiction of multilinear functions or tensors proposed by Roger Penrose in 1971. A diagram in the notation consists of several sha ...
. Due to the symmetries of the spiders and the properties of the underlying
category, topologically deforming a ZX-diagram (i.e. moving the generators without changing their connections) does not affect the linear map it represents. In addition to the equalities between ZX-diagrams that are generated by topological deformations, the calculus also has a set of
graphical rewrite rules for transforming diagrams into one another. The ZX-calculus is ''universal'' in the sense that any linear map between qubits can be represented as a diagram, and different sets of graphical rewrite rules are
complete
Complete may refer to:
Logic
* Completeness (logic)
* Completeness of a theory, the property of a theory that every formula in the theory's language or its negation is provable
Mathematics
* The completeness of the real numbers, which implies t ...
for different families of linear maps. ZX-diagrams can be seen as a generalisation of
quantum circuit notation.
History
The ZX-calculus was first introduced by
Bob Coecke and Ross Duncan in 2008 as an extension of the
categorical quantum mechanics
Categorical quantum mechanics is the study of quantum foundations and quantum information using paradigms from mathematics and computer science, notably monoidal category theory. The primitive objects of study are physical processes, and the diff ...
school of reasoning. They introduced the fundamental concepts of spiders,
strong complementarity and most of the standard rewrite rules.
In 2009 Duncan and Perdrix found the additional
Euler decomposition rule for the
Hadamard gate
The Hadamard transform (also known as the Walsh–Hadamard transform, Hadamard–Rademacher–Walsh transform, Walsh transform, or Walsh–Fourier transform) is an example of a generalized class of Fourier transforms. It performs an orthogonal ...
,
which was used by Backens in 2013 to establish the first completeness result for the ZX-calculus. Namely that there exists a set of rewrite rules that suffice to prove all equalities between
stabilizer ZX-diagrams, where phases are multiples of
, up to global scalars. This result was later refined to completeness including scalar factors.
Following an incompleteness result, in 2017, a completion of the ZX-calculus for the approximately universal
fragment was found, in addition to two different completeness results for the universal ZX-calculus (where phases are allowed to take any real value).
Also in 2017 the book ''Picturing Quantum Processes'' was released, that builds quantum theory from the ground up, using the ZX-calculus. See also the 2019 book ''Categories for Quantum Theory''.
Informal introduction

ZX-diagrams consist of green and red nodes called ''spiders'', which are connected by ''wires''. Wires may curve and cross, arbitrarily many wires may connect to the same spider, and multiple wires can go between the same pair of nodes. There are also Hadamard nodes, usually denoted by a yellow box, which always connect to exactly two wires.
ZX-diagrams represent linear maps between
qubits, similar to the way in which
quantum circuits represent
unitary
Unitary may refer to:
Mathematics
* Unitary divisor
* Unitary element
* Unitary group
* Unitary matrix
* Unitary morphism
* Unitary operator
* Unitary transformation
* Unitary representation
* Unitarity (physics)
* ''E''-unitary inverse semigroup ...
maps between qubits. ZX-diagrams differ from quantum circuits in two main ways. The first is that ZX-diagrams do not have to conform to the rigid topological structure of circuits, and hence can be deformed arbitrarily. The second is that ZX-diagrams come equipped with a set of rewrite rules, collectively referred to as the ''ZX-calculus''. Using these rules, calculations can be performed in the graphical language itself.
Generators
The building blocks or
generators of the ZX-calculus are graphical representations of specific
states, unitary operators, linear
isometries, and
projections in the computational basis
and the
Hadamard-transformed basis and
. The colour green (or sometimes white) is used to represent the computational basis and the colour red (or sometimes grey) is used to represent the Hadamard-transformed basis. Each of these generators can furthermore be labelled by a phase, which is a real number from the interval