Equivalent Quantum Circuits
Equivalent Quantum Circuits
I. THE CIRCUIT POINT OF VIEW the basics can skip. In Section III we set down the no-
arXiv:1110.2998v1 [quant-ph] 13 Oct 2011
tation and define all the gates we will employ in the rest
Quantum communication and computation study in- of the paper. Section IV gives the list of transformation
formation transmission and processing as physical phe- rules. Sections V and VI present some simple quantum
nomena that follow the laws of quantum mechanics. Con- computation blocks which appear in many applications.
sidering quantum mechanics introduces new possibilities Finally, Section VII goes through some examples in which
like private communication with quantum cryptography the given rules can be used to understand basic quantum
or efficient factoring algorithms among others1,2 . protocols.
Most quantum information protocols and algorithms
can be explained as a sequence of transformations ap- II. FUNDAMENTALS OF QUANTUM
plied to a known initial state and a final measurement COMPUTATION
stage. The intermediate evolution is usually the key to
the procedure. This state evolution can be studied from
A. The quantum information unit: the qubit
different perspectives. In this paper we take the point of
view of quantum circuits.
In electronic and electrical engineering the circuit rep- Information can be represented in many possible for-
resentation is routinely used to study classical electronic mats. In this paper we consider discrete quantum infor-
circuits. Circuit equivalences help to analyse complex mation units, the qubits.
processing blocks or to explain different logical opera- In classical computers, information is stored in bits
tions. We present some quantum circuit equivalences that can be either 0 or 1. Their quantum counterpart,
which can play a similar role in quantum computation. the qubits, are binary quantum information units that
Many of these equivalence rules have been used before can exist in an arbitrary superposition of states of the
in quantum circuit analysis3–6 . We compile some of the form
most useful and provide new derivations. |ψi = α|0i + β|1i, (1)
Most of the conventions for quantum circuit represen- 2 2 2 2
where |α| and |β| , such that |α| + |β| = 1, are the
tation are taken from classical circuits. There are some
respective probabilities of finding |0i and |1i after a mea-
wires (usually represented as lines) which carry the sig-
surement in the {|0i, |1i} basis. Figure 2 shows the circuit
nals (states) to different points of the circuit. The basic
representation of a measurement. A measurement on a
operations are represented as gates. Figure 1 shows two
qubit has two possible outcomes which can be associated
example circuits, a classical circuit (a half adder), and a
to the binary value of a classical bit.
generic quantum circuit. We follow the usual convention
of a state going from left to right, like an electrical signal
traversing the electronic elements.
FIG. 1: Classical logical circuit (left) and quantum logical B. Multiple qubits: tensor product and
circuit (right). entanglement
The paper starts with a brief review of quantum com- A system with n qubits can be expressed as a com-
putation (Section II) which readers already familiar with plex vector in a Hilbert space of dimension 2n . If the
2
qubits are not correlated, the composite system comes NOT, XOR. . . ). A combination of quantum gates forms
from taking the tensor product of the individual state of a quantum circuit. An n-qubit quantum gate can be
the n qubits (see2 for a good operational description). defined as a system that performs a determined operation
Tensor products are indicated by the symbol ⊗. Two on n input qubits so that for each input value there is
states |ψ1 i and |ψ2 i have a joint state |ψi = |ψ1 i ⊗ |ψ2 i. a defined associated output. Superpositions of different
Any complex unit vector in our Hilbert space repre- input states will produce the corresponding superposition
sents a valid quantum state. However, not all the valid of output states.
states can be expressed as a collection of independent We will treat the operations of quantum computing
qubits. When the state can only be described as a whole, from a circuital point of view. In the circuital model,
we say it is entangled. gates are presented following the classical circuit conven-
Entanglement is probably the most counterintuitive re- tion: the input is drawn at the left and the circuit gates
sult from quantum mechanics and is an essential resource are presented in order of application from left to right.
in quantum information. In Section VII we will see that The input qubits travel through all these gates and, at
the striking properties of the quantum dense coding and the output of the circuit, at the right, they emerge trans-
teleportation protocols boil down to the capacity of shar- formed.
ing long distance correlations. Quantum gates can be grouped into families. We will
be mostly concerned with three kinds of gates: single
qubit gates, controlled gates and classically controlled
C. Quantum gates gates.
Quantum gates are quantum analogous to the digital The operation of the H gate can be seen from its ef-
gates of electronic digital computers (such as AND, OR, fect on the states of the computational basis, {|0i, |1i}.
3
These states are transformed into two orthogonal super- Unlike classical multiple bit gates, quantum gates are
positions always reversible and can create entanglement between
qubits. Entangling gates, i.e. gates that can entangle
|0i + |1i independent qubits, play a fundamental role in quantum
H|0i = |+i = √ (2)
2 information. In particular, controlled operations provide
an intuitive formulation of qubit interactions.
and A controlled operation, CU , applies the quantum gate
|0i − |1i U on a group of qubits, the target qubits, if another set of
H|1i = |−i = √ . (3) qubits, the control qubits, have a particular value. Con-
2 trol qubits do not change during the process. We follow
Superpositions of |0i and |1i result in the corresponding the usual notation that represents a control by a dot if
superpositions of |+i and |−i. A compact way to express the gate is activated by a |1i state or a blank circle if it
the operation is is the |0i state that activates U . A controlled gate can
have multiple controls acting on a general U operation
|0i + (−1)x |1i that can involve multiple qubits. A gate with more than
H|xi = √ (4) one control is only applied if all the conditions are si-
2
multaneously met and will act as the identity operator
where |xi is a state from the computational basis (x is otherwise.
either 0 or 1). From the whole range of controlled operations, we will
This gate is its own inverse, as H|+i = |0i and H|−i = deal primarily with two: the CZ and CNOT operations.
|1i.
1. CZ gate
3. Z gate
Controlled Z, CZ, is the controlled version of the Z
The Z gate performs a sign shift when the value of the gate. This gate applies a Z operation on the target qubit
qubit is |1i and does nothing otherwise. The operation when the control is |1i. It can also be described as a con-
can be written as Z|xi = (−1)x |xi. The Z gate belongs to ditional operation that performs a sign shift only when
a more general family of phase shift gates which introduce the two qubit state is |11i. From that point of view, it is
a Φ phase shift on the |1i state. The Z gate corresponds sometimes referred to as the controlled sign, CS, gate.
to a phase shift of Φ = π. The effect on a two qubit state |xi|yi from the compu-
tational basis can be summed up as
CZ
|xi|yi −→ (−1)x·y |xi|yi. (5)
is kept while the target now holds the logical XOR of b, a state |xi from the computational basis becomes |x⊕bi
control and target so that and
CN OT |xi|yi = |xi|x ⊕ yi. (6) cX(α|0i + β|1i) = α|0 ⊕ bi + β|1 ⊕ bi. (8)
From all the equivalent gates that are essential for Figure 5 portrays the most extended notation for clas-
quantum computation, the CNOT gate is probably the sical controlled gates. Classical information is transmit-
most well known and it is almost universally used as ted through classical wires, represented by double lines,
a fundamental building block of quantum applications. while the quantum part is represented as usual. Control
The CNOT gate, when combined with single qubit gates, is indicated, as in quantum controlled gates, by a dot on
can provide any desired quantum operation7 . the control bit. The dot is connected by double, classical,
Figure 4 shows the usual pictorial representation of the lines to the controlled gate.
CZ and CNOT gates, along with the description of their
effect on a generic pair of qubits that need not to be
separable.
It is sometimes useful to introduce an additional repre-
sentation of the controlled operations. Truth tables like
those employed to illustrate the concepts of classical logic
can also be given for quantum gates. Table II presents
the truth tables for the CZ and CNOT gates.
The cX gate acts in a similar way, but producing a One group of equivalences is the set of the various ways
NOT operation instead of a sign shift. For a control bit of writing the identity operation. Some gate combina-
5
tions, or certain gates under particular conditions, are The CNOT, or CX, operation can be described in
equivalent to the no operation and can be removed from terms of a CZ gate. The X gate can be decomposed
the quantum circuit without a change of the global op- as a sequence of three single qubit gates, two Hadamard
eration, as long as the conditions are kept. gates and a Z gate, so that X = HZH and CN OT =
Every unitary operation has an inverse. Quantum (I ⊗ H)CZ(I ⊗ H) (Figure 8). When the control is |0i,
gates occasionally appear followed by their inverses. A the two Hadamard gates cancel each other and, when it
gate U immediately followed by its inverse U † = U −1 is |1i, the combination of gates acts as a NOT.
has no net effect on the input state. Usually, when dif-
ferent functional blocks are chained, these cancellations
arise. Separating the elementary operations is essential
in the analysis of equivalent circuits. We can add gates
that cancel each other to better identify the constitutive
blocks of the circuit or use the equivalences to simplify FIG. 8: CNOT with a CZ gate and two H gates.
circuits in order to save scarce resources in a physical
implementation of a particular operation. Figure 9 shows how this decomposition of the CNOT
gate, together with the control reversal property of the
Figure 6 shows three kinds of null operation that do
CZ gate, can be used to find equivalent circuits. The
not affect the state of the system. The first identity is
control of a CNOT gate can be transferred to the former
based on the fact that H, X and Z gates are their own
target when surrounded by the appropriate combination
inverses. If any of them is repeated two times in a row,
of H gates.
the first one is cancelled by the second. The same can be
The starting point is a CZ gate cornered by four
said of CNOT, CZ and CH gates.
Hadamard operations. Grouping the gates in the differ-
ent qubits, it is easy to see that, in a CNOT with a control
sandwiched between two H gates, control and target are
interchangeable terms. For the reversal, we consider the
gate (H ⊗ I)CN OT (H ⊗ I) = (H ⊗ I)(I ⊗ H)CZ(I ⊗
FIG. 6: Null operations.
H)(H ⊗ I). The CZ gate can be reversed and grouped
with the upper Hadamard gates to give the lower qubit
controlled CNOT.
There is also a CNOT null operation. The |+i and
|−i states are the eigenstates for the X operation, with
eigenvalues 1 and -1. As a consequence, the |+i state is
not affected by an X gate and, as control qubits do not
change, a CNOT with a target |+i state has no effect.
Finally, controlled gates with a control qubit |0i can
also be ignored. In that case, they are not active and are
equivalent to the identity operation.
On some occasions, the control and target roles are not CNOT gate with four H gates, one before and one after
clear in a controlled gate. Controlled Z gates, CZ, are the control and one before and one after the target, is
symmetrical. They induce a sign shift for states where equivalent to a CNOT operation where control and target
both qubits are |1i and any qubit can be rightfully said to are exchanged.
be the control (Figure 7). In many cases, it can be more
illustrative to use an equivalent circuit where control and
target roles are exchanged.
Figure 9. The left side circuit gives a CNOT surrounded classically controlled quantum gates, or classical opera-
by H gates. The right side circuit will present two H tions, helps to protect the most delicate and critical part
gates both before and after the new target. These gates of the system, the quantum states.
cancel (Rule I).
Rule IV: Quantum-classical substitution.
Corollary II.B:
CNOT gate preceded by an H gate in both the control Some quantum controlled operations on a pair of qubits
and the target qubits can be reversed moving the H gates which are later measured can be substituted for mea-
after the CNOT. surement followed by classical operations. Specifically, a
CNOT operation on a qubit which later controls a quan-
tum gate, U , can be replaced by the same operation con-
trolled by the classical XOR of the result of measuring the
CNOT operands.
is U ai ⊕bi |ψi i. If we take the XOR of the measured values The new circuit can be useful to implement CNOT
as the control, the output will be indistinguishable from gates between distant qubits in cases where only nearest
the case with a CNOT gate (multiple measurements of neighbour interactions are possible. With this decom-
the same inputs will have the same statistics). position of the CNOT gate, we can prove the two next
Although this equivalence works particularly well for properties related to different ways of arranging CNOT
the CNOT/XOR conversion, the property cannot be ex- gates.
tended to all the quantum controlled gates. Such a sub-
stitution can only take place whenever there is a classi-
cal gate that reproduces the probabilities for the output
Rule VI: CNOT mirror.
state.
The principle of deferred measurement and this The order of two chained CNOT gates such that the
quantum-classical gate substitution can simplify many target qubit of the first is the control of the second can be
circuits, especially when there are ancillary qubits. With- commuted adding a new CNOT gate from the control of
out loss of generality, we can suppose that after the last the first CNOT to the target of the second.
operation in which a qubit is involved, it is measured.
This way, it is possible to convert some of the operations The CNOT mirror operation gives a way to commute
into simpler classical or classically controlled gates. CNOT gates acting on different qubits when the control
of one of the gates is immediately before or after the tar-
get of the other (Figure 15). The gates can be reflected
Rule V: Distributed CNOT. with respect to a new CNOT gate that has as its control
the first gate’s control and targets the target of the sec-
A CNOT operation between two qubits can be imple- ond. This new CNOT gate commutes with the other two
mented with four CNOT operations with an intermediate and the reflection can happen on both sides.
qubit so that there is no direct interaction between the
original qubits.
−→ |Ci|A ⊕ Ci|C ⊕ T i −→ |Ci|Ai|C ⊕ T i. (11) Two CNOT gates with a common control qubit and two
8
For two data registers A and B, with content data a The easiest, and trivial, way to see the circuit performs
and b, the problem of state swapping consists in finding a swap is noticing that this circuit is exactly the same of
a suitable procedure to move the contents of A to B and Figure 19. The lower qubit has been moved to the top
the contents of B to A. After the transfer, A contains b and the upper qubit is now down. For the symmetric
and B contains a. swap this does not affect the result.
9
VII. EXAMPLES
A. Quantum teleportation
One dramatic example of the counterintuitive pos- FIG. 23: Teleportation derived from state transfer.
sibilities of entanglement is the quantum teleportation
protocol9 . In quantum teleportation, the state of an ar- The first CNOT can be distributed into four CNOT
bitrary quantum system, a single qubit in the basic case, gates with an ancillary qubit (Rule V). The new qubit
is transferred to another far location with the help of a has been artificially introduced and its concrete state is
classical channel and a previously shared Bell pair. not important. We can make it to start in |+i, which
The quantum circuit of Figure 22 implements the tele- allows to omit the first from the new CNOT gates.
portation protocol for a single qubit. In Figure 24 (up), we substitute the two ancillary
10
Without loss of generality, we can measure the ancil- As it was proved by Mermin5 , dense coding can be de-
lary qubits at the end of the operation. This does not af- rived from an unremarkable copy circuit that transforms
fect the |ψi state of interest. By replacing the last CNOT the input state |xi|yi|0i|0i into |xi|yi|xi|yi. The copy
gate by two H gates and a CZ gate and reversing this CZ can be done with two CNOT gates.
(Rule II), we arrive at the second to last circuit. The last The copy circuit is similar to the starting point of the
H gate is not important for us and can be omitted, as it teleportation procedure (Figure 23, left), repeated for
only affects the ancillary qubit. Finally, by Rule III, we each of the qubits. There is a further simplification. As
can replace the last two quantum controlled operations the original states encode classical data, they are only in
by a cX and a cZ gate and recover the familiar circuit for one state from the computational basis. The last CNOT
teleportation. gate in the state transfer circuit erases residual corre-
lations between the original qubit and the destination
qubit. If they were entangled, a measurement on the
C. Dense coding sender could alter the received state. If the set of possi-
ble states is reduced to two orthogonal states, as it hap-
Bell pairs can also be employed to send two bits worth pens in dense coding, this last erasure CNOT is no longer
of classical information with a single qubit10 . Imagine necessary.
we have a |β00 i entangled pair. We can transform this
EPR pair into states in the Bell basis with classically
controlled gates.
Figure 25 presents a version of this circuit in which
the original information is related to the measurement
of two qubits in the computational basis that carry the
classical information. In this form, its connections to
teleportation are clearer.
The circuit applies a cX and a cZ gate on the first qubit
of the Bell pair |β00 i to take two states |ai|bi from the
computational basis into the corresponding state from
the Bell basis (the states from Equation 14 up to a global FIG. 26: Derivation of the superdense coding circuit from a
phase). The resulting states can carry the information of CNOT partial copy of two qubits encoding classical informa-
two classical bits, but we only needed to act on one of the tion.
qubits to encode all the data. This means we can send
the second qubit in advance and convey the whole infor- Figure 26 shows the evolution from the CNOT copy-
mation by just one quantum transmission. The second ing circuit to a superdense encoder. The end circuit has
qubit is not required to have been in the same place as the two gates that, when applied to input |0i|0i, produce the
11
|β00 i Bell state (see Figure 21). It also has the corre-
sponding decoder (a CNOT followed by an H gate) at
the receiver’s side.
We can use the rules of Section IV to show this equiva-
lence. The second CNOT gate of the copying circuit can
be written as a sequence of H, CZ and H gates. We can
now insert an additional CNOT after the first H gate.
The input |0i is taken to |+i, for which, by Rule I, the
CNOT gate acts as the identity. Then, by the parallel
to Λ rule (Rule VII), we can produce two CNOTs be-
tween the last qubits and a third one between the second FIG. 27: Gottesman-Chuang gate teleportation circuit.
data qubit and the qubit that is going to be transmitted.
The further commutation with the CZ gate introduces no
changes. The Z operation only introduces a phase shift,
and target. We can replace the standard teleportation
but it does not change whether the control is |0i or |1i
circuit with an equivalent circuit with CNOT gates from
and, consequently, whether the NOT is activated or not.
Figure 24. The measured bits can change, but they are
In the presented circuits, the third qubit is the one
irrelevant for the global operation.
that is sent. The fourth qubit can be though to be part
of a preshared Bell pair. The data of both bits x and y
can be transferred just by acting on the third qubit. The
sender only has to apply the CNOT and CZ gates that are
controlled by the data to be sent. The counterintuitive
data compaction from two bits into one qubit is due to the
previously shared entanglement. The strong correlation
of the members of a Bell pair allows to treat them as one
entity and perform part of the encoding procedure before
having the data.
In this case, we don’t even need a complete state trans-
fer circuit. The CNOT copy circuit, applied on two
qubits, is enough. Notably, the dense coding protocol
cannot be used to send two qubits of information with a
single qubit transmission. As we have seen, a complete
state transfer circuit for quantum data would require ad-
ditional entanglement erasure gates (a CNOT for each
qubit). Those gates would imply some interaction with
the second qubit of the Bell pair (similar to the cZ oper-
ation which appeared in teleportation).
FIG. 28: CNOT gate teleportation as a teleportation stage
followed by a CNOT.
E. Gate teleportation
The last CNOT gate of this circuit can be mirrored
Gate teleportation offers an alternative way to perform in the intermediate CNOTs (rule VI) until it reaches the
certain operations when there are restrictions that forbid point of the original Bell pairs (Figure 28, down). On its
to apply a gate directly11 . Our reference point will be way to the beginning of the circuit, the CNOT gate will
the Gottesman-Chuang gate teleportation circuit of Fig- leave two residual CNOTs which give rise to the crossed
ure 27. Here, the input can be put in terms of a new cZ and cX gates of the gate teleportation circuit (con-
entangled state, |χi = |0000i+|0011i+|1110i+|1101i
2 , which trolled by bits b and c). The final circuit can be readily
results from the first CNOT operation between the Bell transformed into the original circuit of Figure 27. The
states. With this resource state, we can perform a CNOT measurements can be advanced by the principle of de-
operation between remote qubits with classical commu- ferred measurement. The cZ gates come from the substi-
nication and local classically controlled gates alone. The tution of the CNOT gates by their H and CZ equivalents,
usual approach to prove this operation is equivalent to as in the usual teleportation circuit (rule II). We ignore
a CNOT is based on the commutation rules of the Pauli two H gates which affect the value of the bits a and c,
group operators. We can use a circuital point of view to but do not alter the qubits of interest. Finally, due to the
clarify why this is the case. symmetry of the Bell pairs, we can see that the CNOT
We start from two teleportation circuits followed by between them has the same effect when it is applied on
a CNOT between their outputs (Figure 28, up). The either qubit of the second pair. The resulting entangled
output is clearly the CNOT operation between control state will be |χi in both cases.
12
9
∗
Electronic address: [email protected] C. Bennett, G. Brassard, C. Crépeau, R. Jozsa, A. Peres
1
M. A. Nielsen and I. L. Chuang (2000) Quantum Computa- and W. Wootters (1993) Teleporting an unknown quantum
tion and Quantum Information. First Edition. Cambridge state via dual classical and Einstein-Podolsky-Rosen chan-
University Press, Cambridge, UK. nels. Physical Review Letters, 70(13), 1895–1899.
2 10
N. D. Mermin (2007) Quantum Computer Science. First C. H. Bennett and S. J. Wiesner (1992) Communication
Edition. Cambridge University Press, Cambridge, UK. via one- and two-particle operators on Einstein-Podolsky-
3
X. Zhou, D. W. Leung and I. L. Chuang (2000) Methodol- Rosen states. Physical Review Letters, 69(20), 2881.
11
ogy for quantum logic gate construction. Physical Review D. Gottesman and I. L. Chuang (1999) Demonstrating the
A, 62(5), 052316. viability of universal quantum computation using teleporta-
4
N. D. Mermin (2001) From classical state swapping to tion and single-qubit operations. Nature, 402(6760), 390.
12
quantum teleportation. Physical Review A, 65(1), 012320. S. Bose (2003) Quantum Communication through an Un-
5
N. D. Mermin (2002) Deconstructing dense coding. Physi- modulated Spin Chain. Physical Review Letters, 91(20),
cal Review A, 66(3), 032308. 207901.
6 13
D. Maslov, G. Dueck, D. Miller and C. Negrevergne (2008) T. B. Pittman, B. C. Jacobs and J. D. Franson (2002)
Quantum Circuit Simplification and Level Compaction. Demonstration of feed-forward control for linear optics
Computer-Aided Design of Integrated Circuits and Sys- quantum computation. Physical Review A, 66(5), 052305.
14
tems, IEEE Transactions on, 27(3), 436 –444. J. C. Garcı́a-Escartı́n and P. Chamorro-Posada (2009) Op-
7
A. Barenco, C. H. Bennett, R. Cleve, D. P. DiVincenzo, tical CNOT gates with Quantum Interrogation. AIP Con-
N. Margolus, P. Shor, T. Sleator, J. A. Smolin and H. We- ference Proceedings, 1110(1), 399–402.
15
infurter (1995) Elementary gates for quantum computa- J. C. Garcı́a-Escartı́n and P. Chamorro-Posada (2009)
tion. Physical Review A, 52, 3457. Quantum interrogation logic gates. arXiv:0901.4731v1.
8 16
J. F. Clauser, M. A. Horne, A. Shimony and R. A. Holt B. Eastin and S. Flammia (2004) Q-circuit Tutorial .
(1969) Proposed Experiment to Test Local Hidden-Variable arXiv:quant-ph/0406003v2.
Theories. Physical Review Letters, 23(15), 880–884.