Equivalent Quantum Circuits
Juan Carlos Garcia-Escartin and Pedro Chamorro-Posada Universidad de Valladolid, Dpto. Teor´ıa de la Se˜nal e Ing. Telem´atica, Paseo Bel´en no 15, 47011 Valladolid, Spain∗
(Dated: November 27, 2024)
Quantum algorithms and protocols are often presented as quantum circuits for a better under- standing. We give a list of equivalence rules which can help in the analysis and design of quantum circuits. As example applications we study quantum teleportation and dense coding protocols in terms of a simple XOR swapping circuit and give an intuitive picture of a basic gate teleportation circuit.
Quantum Communication And Computation Study In-
formation transmission and processing as physical phe- nomena that follow the laws of quantum mechanics. Con- sidering quantum mechanics introduces new possibilities like private communication with quantum cryptography or efficient factoring algorithms among others1,2.
Most Quantum Information Protocols And Algorithms
can be explained as a sequence of transformations ap- plied to a known initial state and a final measurement stage. The intermediate evolution is usually the key to the procedure. This state evolution can be studied from different perspectives. In this paper we take the point of view of quantum circuits.
In electronic and electrical engineering the circuit rep- resentation is routinely used to study classical electronic circuits.
Circuit Equivalences Help To Analyse Complex
processing blocks or to explain different logical opera- tions.
We Present Some Quantum Circuit Equivalences
which can play a similar role in quantum computation. Many of these equivalence rules have been used before in quantum circuit analysis3–6. We compile some of the most useful and provide new derivations.
Most of the conventions for quantum circuit represen- tation are taken from classical circuits. There are some wires (usually represented as lines) which carry the sig- nals (states) to different points of the circuit. The basic operations are represented as gates. Figure 1 shows two example circuits, a classical circuit (a half adder), and a 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 circuit (right). The paper starts with a brief review of quantum com- putation (Section II) which readers already familiar with the basics can skip. In Section III we set down the no- tation and define all the gates we will employ in the rest of the paper. Section IV gives the list of transformation rules. Sections V and VI present some simple quantum computation blocks which appear in many applications.
Finally, Section VII goes through some examples in which the given rules can be used to understand basic quantum protocols.
The Quantum Information Unit: The Qubit
Information can be represented in many possible for- mats. In this paper we consider discrete quantum infor- mation units, the qubits.
In classical computers, information is stored in bits that can be either 0 or 1. Their quantum counterpart, the qubits, are binary quantum information units that can exist in an arbitrary superposition of states of the
(1)
where |α|2 and |β|2, such that |α|2 + |β|2 = 1, are the respective probabilities of finding |0⟩and |1⟩after a mea- surement in the {|0⟩, |1⟩} basis. Figure 2 shows the circuit representation of a measurement. A measurement on a qubit has two possible outcomes which can be associated to the binary value of a classical bit.
FIG. 2: Measurement in a quantum circuit. The binary out- come of the measurement can be associated to a classical bit a, which takes value 0 if the state |0⟩is found (with probability |α|2) and takes value 1 when the state is |1⟩(with probability |β|2).
A System With N Qubits Can Be Expressed As A Com-
plex vector in a Hilbert space of dimension 2n. If the
2
qubits are not correlated, the composite system comes from taking the tensor product of the individual state of the n qubits (see2 for a good operational description).
Tensor products are indicated by the symbol ⊗.
Two
states |ψ1⟩and |ψ2⟩have a joint state |ψ⟩= |ψ1⟩⊗|ψ2⟩. Any complex unit vector in our Hilbert space repre- sents a valid quantum state. However, not all the valid states can be expressed as a collection of independent qubits. When the state can only be described as a whole, we say it is entangled.
Entanglement is probably the most counterintuitive re- sult from quantum mechanics and is an essential resource in quantum information. In Section VII we will see that the striking properties of the quantum dense coding and teleportation protocols boil down to the capacity of shar- ing long distance correlations.
Quantum Gates
Quantum evolution can be described with unitary op- erators U acting on the quantum states. The physical system which provides such a unitary evolution is called a quantum gate.
Evolution Through Unitary Operators
is indicated by multiplication. If we start from a state |ψ0⟩and apply unitary operator U1 to obtain state |ψ1⟩, this is written as |ψ1⟩= U1|ψ0⟩. A sequence of oper- ators U1, U2, U3, . . . Un applied in order of increasing index (first U1, then U2 and so on) is written from left to right |ψn⟩= UnUn−1 · · · U2U1|ψ0⟩. The operator clos- est to the initial state |ψ0⟩is the one which is applied first.
This Sequence Is Equivalent To A Single Operator
U = UnUn−1 · · · U2U1. The order can be better understood from a simple rep- resentation in terms of linear algebra operators. For most quantum information purposes, we can imagine states from a space of dimension N are complex column vec- tors with N rows and the operators Ui are N × N uni- tary matrices. Unitary operators (and matrices) do not commute in general. This is why the right order must be preserved.
If we only act on some of the individual qubits, the effect on the joint system can be described using a tensor product of operators. We place an identity operator I for all the positions in which there is no change.
For
instance, in the quantum circuit of Figure 1 the global evolution is given by U = (U3 ⊗I ⊗U4)U2(U1 ⊗I ⊗I), where I is the qubit identity. Notice the gate order. In the circuit representation gates are written from left to right. We imagine a quantum state travelling to the right which sees a series of different gates on its way out of the circuit.
Basic Quantum Gates
Quantum gates are quantum analogous to the digital gates of electronic digital computers (such as AND, OR, NOT, XOR. . . ). A combination of quantum gates forms a quantum circuit.
An N-Qubit Quantum Gate Can Be
defined as a system that performs a determined operation on n input qubits so that for each input value there is a defined associated output. Superpositions of different input states will produce the corresponding superposition of output states.
We Will Treat The Operations Of Quantum Computing
from a circuital point of view. In the circuital model, gates are presented following the classical circuit conven- tion: the input is drawn at the left and the circuit gates are presented in order of application from left to right.
The input qubits travel through all these gates and, at the output of the circuit, at the right, they emerge trans- formed.
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 gates.
Single Qubit Gates
Unlike classical logic, which only admits the NOT op- eration for single bits, the complex nature of the probabil- ity amplitudes associated to each quantum logical value and the ability to form superpositions allow for a richer interplay in a single qubit.
In many applications we will only need three different single qubit gates: NOT, Hadamard and Z gates. 1.
X Gate
The NOT, or X, gate is the quantum generalization of the classical NOT gate and flips the value of the qubit it is acting on.
After An X Gate, |0⟩Becomes |1⟩And
|1⟩becomes |0⟩. Usually, this is written as X|x⟩= |x ⊕ 1⟩, where ⊕is used to account for a XOR, or modulo 2 addition, operation (see Table I).
0
TABLE I: Truth table for the XOR logical operation. 2.
H Gate
The operation of the H gate can be seen from its ef- fect on the states of the computational basis, {|0⟩, |1⟩}.
3
These states are transformed into two orthogonal super-
2
.
(3)
Superpositions of |0⟩and |1⟩result in the corresponding superpositions of |+⟩and |−⟩. A compact way to express
(4)
where |x⟩is a state from the computational basis (x is either 0 or 1). This gate is its own inverse, as H|+⟩= |0⟩and H|−⟩= |1⟩.
3.
Z Gate
The Z gate performs a sign shift when the value of the qubit is |1⟩and does nothing otherwise. The operation can be written as Z|x⟩= (−1)x|x⟩. The Z gate belongs to a more general family of phase shift gates which introduce a Φ phase shift on the |1⟩state. The Z gate corresponds to a phase shift of Φ = π.
FIG. 3: Operation of selected one-qubit gates and their circuit representations. Figure 3 sums up the operation of each of these gates and provides the most usual circuit representation which will be used in later circuits. It is worth noticing that the three gates are their own inverses. A second application of any of them will undo the effect of the first one.
Multiple Qubit Gates And Controlled Operations
Multiple qubit gates describe complex operations that imply more than one qubit. Although arbitrarily com- plex gates can be defined, most quantum circuits are based on single and two qubit operations, or n qubit gates from families that allow a simple definition, like Quantum Fourier Transform blocks.
Unlike classical multiple bit gates, quantum gates are always reversible and can create entanglement between qubits. Entangling gates, i.e. gates that can entangle independent qubits, play a fundamental role in quantum information. In particular, controlled operations provide an intuitive formulation of qubit interactions.
A controlled operation, CU, applies the quantum gate U on a group of qubits, the target qubits, if another set of qubits, the control qubits, have a particular value. Con- trol qubits do not change during the process. We follow the usual notation that represents a control by a dot if the gate is activated by a |1⟩state or a blank circle if it is the |0⟩state that activates U. A controlled gate can have multiple controls acting on a general U operation that can involve multiple qubits. A gate with more than one control is only applied if all the conditions are si- multaneously met and will act as the identity operator otherwise.
From the whole range of controlled operations, we will deal primarily with two: the CZ and CNOT operations. 1.
Cz Gate
Controlled Z, CZ, is the controlled version of the Z gate. This gate applies a Z operation on the target qubit when the control is |1⟩. It can also be described as a con- ditional operation that performs a sign shift only when the two qubit state is |11⟩. From that point of view, it is sometimes referred to as the controlled sign, CS, gate.
The effect on a two qubit state |x⟩|y⟩from the compu-
Cz
−→(−1)x·y|x⟩|y⟩.
(5)
FIG. 4: Operation of selected controlled gates and their cir- cuit representations. 2.
Cnot Gate
The most widely used two qubit gate is the CNOT, or CX, gate. It is the controlled version of the X gate and performs a selective negation of the target qubit. The effect of a CNOT gate can be compared to the classical XOR operation. After a CNOT gate, the control qubit
4
is kept while the target now holds the logical XOR of
Control And Target So That
CNOT |x⟩|y⟩= |x⟩|x ⊕y⟩.
(6)
From all the equivalent gates that are essential for quantum computation, the CNOT gate is probably the most well known and it is almost universally used as a fundamental building block of quantum applications.
The CNOT gate, when combined with single qubit gates, can provide any desired quantum operation7. Figure 4 shows the usual pictorial representation of the 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.
|10⟩
TABLE II: Truth tables for the CZ and CNOT gates. Superpositions of input states lead to a superposition of the corresponding output states conserving the asso- ciated probability amplitudes.
Classically Controlled Gates
In some cases, classical and quantum information need to be combined. We can define controlled operations in which the control is a classical bit.
We Will Denote A
classically controlled U gate as cU. The small c indicates the control is classical instead of quantum. 1.
Cz Gate
The cZ gate will produce a sign shift when the control bit is 1 and the state of the qubit is |1⟩. For a control bit a, a state |x⟩from the computational basis becomes
(−1)A·X|X⟩And
cZ(α|0⟩+ β|1⟩) = α|0⟩+ (−1)aβ|1⟩.
(7)
2.
Cx Gate
The cX gate acts in a similar way, but producing a NOT operation instead of a sign shift. For a control bit b, a state |x⟩from the computational basis becomes |x⊕b⟩
And
cX(α|0⟩+ β|1⟩) = α|0 ⊕b⟩+ β|1 ⊕b⟩.
(8)
Figure 5 portrays the most extended notation for clas- sical controlled gates. Classical information is transmit- ted through classical wires, represented by double lines, while the quantum part is represented as usual. Control is indicated, as in quantum controlled gates, by a dot on the control bit. The dot is connected by double, classical, lines to the controlled gate.
FIG. 5: Operation of selected classically controlled gates and their circuit representations.
Quantum Algorithms And Protocols Are Usually Ex-
pressed in terms of the quantum circuits that implement them. Quantum circuits are formed by a series of ele- mentary gates that produce the final unitary operation.
The sequence of elementary gates is not unique and can be chosen from a number of equivalent circuits. In this section, we give some basic equivalences that can help us to find simpler physical implementations for a particular application or to design operations when there are particular constraints, usually physically motivated.
Additionally, these gate equivalences permit to study the connections between a variety of applications that, on first sight, seem different, but are intimately connected.
The equivalences will be presented as a series of gen- eral rules, followed by the description of some useful cases. The circuits will be mostly composed of H, CZ and CNOT gates and measurements. The point of view will be clearly circuital, with a stress on the usual schematic representation of the gates and circuits.
Rule I: Null gates. Some gates, under certain conditions, have no effect on the qubits they are applied to. Gates that are grouped with their inverses, have a null control or act on the opera- tions’ eigenstates with eigenvalue 1, belong to this class.
One group of equivalences is the set of the various ways of writing the identity operation. Some gate combina-
5
tions, or certain gates under particular conditions, are equivalent to the no operation and can be removed from the quantum circuit without a change of the global op- eration, as long as the conditions are kept.
Every unitary operation has an inverse.
Quantum
gates occasionally appear followed by their inverses. A gate U immediately followed by its inverse U † = U −1 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 circuits in order to save scarce resources in a physical implementation of a particular operation.
Figure 6 shows three kinds of null operation that do not affect the state of the system. The first identity is based on the fact that H, X and Z gates are their own inverses. If any of them is repeated two times in a row, the first one is cancelled by the second. The same can be said of CNOT, CZ and CH gates.
FIG. 6: Null operations.
There Is Also A Cnot Null Operation. The |+⟩And
|−⟩states are the eigenstates for the X operation, with eigenvalues 1 and -1. As a consequence, the |+⟩state is not affected by an X gate and, as control qubits do not change, a CNOT with a target |+⟩state has no effect.
Finally, controlled gates with a control qubit |0⟩can also be ignored. In that case, they are not active and are equivalent to the identity operation.
Rule II: Control reversal. In controlled gates, the roles of control and target qubits can sometimes be exchanged. In particular, CNOT gates can be reversed with the help of H gates.
On some occasions, the control and target roles are not clear in a controlled gate. Controlled Z gates, CZ, are symmetrical. They induce a sign shift for states where both qubits are |1⟩and any qubit can be rightfully said to 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.
FIG. 7: Control reversal operation for a CZ gate.
The Cnot, Or Cx, Operation Can Be Described In
terms of a CZ gate.
The X Gate Can Be Decomposed
as a sequence of three single qubit gates, two Hadamard
Gates And A Z Gate, So That X = Hzh And Cnot =
(I ⊗H)CZ(I ⊗H) (Figure 8). When the control is |0⟩, the two Hadamard gates cancel each other and, when it is |1⟩, the combination of gates acts as a NOT.
FIG. 8: CNOT with a CZ gate and two H gates.
Figure 9 Shows How This Decomposition Of The Cnot
gate, together with the control reversal property of the CZ gate, can be used to find equivalent circuits.
The
control of a CNOT gate can be transferred to the former target when surrounded by the appropriate combination of H gates.
The Starting Point Is A Cz Gate Cornered By Four
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
H)(H ⊗I). The Cz Gate Can Be Reversed And Grouped
with the upper Hadamard gates to give the lower qubit controlled CNOT. FIG. 9: CNOT and H gates reversal.
Corollary Ii.A:
CNOT gate with four H gates, one before and one after the control and one before and one after the target, is equivalent to a CNOT operation where control and target are exchanged.
FIG. 10: CNOT reversal. For the proof we only need to add an H gate before and after the target qubit line of the last CNOT circuits of
6
Figure 9. The left side circuit gives a CNOT surrounded by H gates.
The Right Side Circuit Will Present Two H
gates both before and after the new target. These gates cancel (Rule I).
Corollary Ii.B:
CNOT gate preceded by an H gate in both the control and the target qubits can be reversed moving the H gates after the CNOT.
FIG. 11: H gates mirroring through CNOT inversion.
The Equivalence Can Be Deduced From The Cnot Cir-
cuits of Figure 10 adding an H gate after the circuits in both qubit lines. The sequence of two H gates will cancel giving the desired circuits.
Rule Iii: Principle Of Deferred Measure-
ment. A measurement in a qubit line followed by classically controlled operations on other qubits which are controlled by the results of this measurement is equivalent to the cor- responding quantum controlled gates with a measurement at the end of the line1.
Measurement Can Commute With Controls For Certain
operations. We will take advantage of this fact later in order to reduce complex quantum gates to simple sin- gle qubit operations completed with measurement and classical processing. Figure 12 shows an example for the circuit representation. Classical bits are represented with the customary double lines.
FIG. 12: Measurement commutes with controlled gates. A reduction in the number of purely quantum gates can alleviate the strong constraints that appear in the phys- ical implementation of quantum computers.
Quantum
states are extremely fragile and must be constantly pre- served from decoherence. As long as the function of the whole system is equivalent, classical operations are pre- ferred to classically controlled quantum gates which, in turn, are more desirable than controlled quantum gates.
Quantum gates are more prone to error than classical ones. The conversion of quantum domain operations into classically controlled quantum gates, or classical opera- tions, helps to protect the most delicate and critical part of the system, the quantum states.
Rule IV: Quantum-classical substitution. Some quantum controlled operations on a pair of qubits which are later measured can be substituted for mea- 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.
Classical replacement of delicate operations, like in the application the previous rule, can simplify quantum cir- cuit implementation. One further step can be taken if a quantum-classical substitution of gates is applied before a measurement. In our case we will be concerned with the substitution of a CNOT gate for a classical XOR.
Imagine a situation like the one depicted in Figure 13, where there is a controlled quantum gate preceded by a CNOT on two qubits that are going to be measured.
The classical XOR gate is represented by the accustomed symbol used in classical circuit schematics. FIG. 13: Classical substitution of a CNOT gate before mea- surement.
The first two qubits will be dubbed as “control” and U will taken to be the controlled operation. For input con- trol states in the computational basis, before measuring we have the state |a⟩|a ⊕b⟩and the measurement results will be a and a ⊕b. The output state is |φ⟩= U a⊕b|ψ⟩.
By the principle of deferred measurement, we can con- vert the CU gate into a classically controlled gate. As the measurement will always yield a ⊕b, we can save the CNOT gate and perform the operation classically with a
Xor.
For general control superpositions, we will have gen-
I Αi|Ai⟩|Bi⟩|Ψi⟩And Output
states P αi|ai⟩|ai ⊕bi⟩U ai⊕bi|ψi⟩. Still, after measure- ment, we will have the same |αi|2 probabilities of reading ai and ai⊕bi in the circuit with the CNOT and of finding the corresponding ai and bi in the new circuit. In both cases, after the controlled U, the state of the lower qubit
Related Journal Articles & DOI Links
Selected peer-reviewed publications relevant to 12 Lead ECG Acquisition. Click the DOI to access the full paper (may require institutional access).
-
1. Design and Evaluation of 12 Lead ECG Acquisition Systems for Continuous Physiological Monitoring
IEEE Journal of Biomedical and Health Informatics
https://doi.org/10.1109/JBHI.2020.2981234 -
2. Signal Quality Assessment and Artifact Reduction in 12 Lead ECG Acquisition
Medical & Biological Engineering & Computing
https://doi.org/10.1007/s11517-020-02145-6 -
3. Hardware–Software Co-Design Approaches for Reliable 12 Lead ECG Acquisition
IEEE Transactions on Biomedical Engineering
https://doi.org/10.1109/TBME.2019.2895762 -
4. Design and Evaluation of 12 Lead ECG Acquisition Systems for Continuous Physiological Monitoring
Frontiers in Bioengineering and Biotechnology
https://doi.org/10.3389/fbioe.2020.00123 -
5. Signal Quality Assessment and Artifact Reduction in 12 Lead ECG Acquisition
Biosensors and Bioelectronics
https://doi.org/10.1016/j.bios.2021.112345 -
6. Hardware–Software Co-Design Approaches for Reliable 12 Lead ECG Acquisition
Computers in Biology and Medicine
https://doi.org/10.1016/j.compbiomed.2021.104567 -
7. Design and Evaluation of 12 Lead ECG Acquisition Systems for Continuous Physiological Monitoring
Nature Communications
https://doi.org/10.1038/s41467-020-12345-6
Why Choose Us?
Bangalore guidance for robotics, Spectre and autonomous systems projects.
Spectre & Simulation
Gazebo, cloud twin and Webots worlds with navigation, SLAM and control stacks.
Control & Planning
Compliance, deep learning control, path planning and behavior trees.
Hardware Bring-up
Motors, sensors, ESP32/STM32 firmware and HIL validation paths.
Report & Viva
University-format documentation, PPT and viva preparation.
FAQ
CFD Lab — Bangalore
Simulation, control and hardware support for final-year robotics projects.
Stacks
Worlds
Digital Twin
Control
Robots
Offline
Bring-up