Quantum Computing Notes
Quantum Computing Notes
QUANTUM MECHANICS
Louis de Broglie attempted to develop a theory of radiation in terms of light quanta or photons.
He was led to the new conception of matter waves by the following considerations:
i) Since radiation has been shown to possess dual nature, wave and particle, matter must also
possess dual nature.
ii) Radiation is supplemented with particle characteristics to explain certain optical phenomena,
such as photoelectric effect. On similar lines material particles have to be supplemented with a
wave aspect for a full understanding of their behaviour.
iii) According to Bohr, the stable states of electrons in the atom were governed by 'integer' rules.
In an atom electrons of the permitted orbits have the angular momentum integer multiples of
h/2π. In physics, interference and modes of vibration of stretched strings involve integers. Both
of them imply wave motion. Hence electrons in stable orbits must also be supplemented with
wave aspect.
Based on the above concepts, de Broglie made a bold suggestion in his doctorate thesis and
presented the new idea of matter waves. For this he was honored with the award of the Nobel
Prize in 1929. In his thesis he claimed that there should be intimate connection between waves
and corpuscles not only in the case of radiation but also in the case of matter. To study the path
of a beam of radiation, we use the wave theory, while to calculate the amount of energy of the
same beam we use the quantum theory i.e., we adopt the concept of photon. In a similar manner,
electrons observed as a particle while we calculate the mass, charge and energy must be treated
as a wave when we find the path of the electrons. When electrons are reflected by an object, we
must treat them as though they were a beam of waves.
De-Broglie hypothesis:-
E = mc2 ……………..(2)
c is velocity of light
According to the De Broglie theory,
p = mv
Where p is momentum of electron
m is mass of electron
v is velocity of electron
From equation (3),
ℎ ℎ
λ= =
p mv
Therefore,
ℎ ℎ ℎ
𝜆= = = ……………(4)
𝑚𝐶 𝑚𝑣 𝑃
The above equation (4) represents the De-Broglie wavelength
4. Whether the particle is charged or not, matter wave is associated with it. This reveals that these waves are not
electromagnetic but a new kind of waves.
5. It can be proved that the matter waves travel faster than light.
As the particle velocity v cannot exceed velocity of light c, ω is greater than velocity of light.
6. No single phenomena exhibits both particle nature and wave nature simultaneously.
7. While position of a particle is confined to a particular location at any time, the matter wave associated with it has
some spread as it is a wave. Thus, the wave nature of matter introduces an uncertainty in the location of the position of
the particle. Heisenberg’s uncertainty principle is based on this concept.
Here, we have two methods to verify the dual nature of matter waves. They are
1. Davisson and Germer’s experiment
2. G.P. Thomson’s experiment
Principle: The e’s which are coming from the source are incident on the target and the e’s get diffracted.
These diffracted e’s produce a diffraction pattern. It shows (explains) the wave nature of matter waves.
Experimental Arrangement:-
Construction:
The experimental setup is shown in above figure. It consists of mainly 3-parts
(i) Filament
(ii) Target
(iii) Circular scale arrangement.
It also consists of a low-tension battery (LTB), High tension battery (HTB) & a cylinder (A).
In their experimental arrangement (in 1927) for electron diffraction, Davisson and Germer
accelerated the electrons from a hot tungsten filament F by maintaining a steady potential
difference between F and the plate P (Fig. 1). The electrons emerge through a fine opening O
in the plate and fall normally on the surface of a nickel crystal N. Using a Faraday cylinder C
as collector, the intensity of scattered electrons is measured in all directions. The collector C is
capable of rotation about an axis passing through the point of incidence of the electrons on the
crystal N. Thus the intensity of the scattered beam can be determined as a function of the
scattering angle. The collector has two walls which are insulated from each other. A retarding
potential is maintained between them so that only fast-moving electrons coming from the
electron gun may enter inside it. The secondary electrons, if any, generated at the surface of
nickel are stopped by the retarding potential. Thus the galvanometer connected to Faraday
cylinder C shows deflection due to electrons from the electron gun only.
Working:
When tungsten filament ‘F’ is heated by a LTB then e’s are produced. These e’s are accelerated
by High voltage (HTB). The accelerated e’s are collimated into a fine beam of pencil by
passing them through a system of pin-holes in the cylinder ’A’. This beam of electrons is
allowed to incident on nickel crystal which acts as target. Then e’s are scattered in all the
directions. The intensity of scattered e’s is measured by the circular scale arrangement. In this
arrangement, an electron or movable collector (Double walled faraday cylinder) is fixed to
circular scale which can collect the electrons and can move along the circular scale. The
electron collector (Double walled faraday cylinder) is connected to a sensitive galvanometer
to measure the intensity of electron beam entering the collector at different scattering angles
(∅).
The Faraday cylinder was moved over the circular scale and for a given accelerating voltage
V, the scattering curve was drawn. For an electron accelerated by 54 volts applied, and electron
beam incident normal to the crystal surface, the pronounced scattering direction was found to
be 50° (Fig. 2(a)). Under this condition, as shown in Fig. 2(b), the surface rows of atoms act
like the rulings of a diffraction grating, producing the first order spectrum of 54 volts electrons
at θ = 50°.
A graph is plotted between the scattering angle (∅) and the number of scattered
electron’s as shown in above figure.
The intensity of scattered e’s is maximum at ∅ = 50° & accelerating voltage =54V.
From eq-(3) & eq-(4) it was been proved both the practical & theoretical wavelengths are almost equal.
Hence the wave nature of particle is proved experimentally.
A wave packet that represents and symbolizes all about the particle and moves with a group
velocity describes a de Broglie wave. According to Bohr’s probability interpretation, the particle
may be found anywhere within the wave-packet. This implies that the position of the particle is
uncertain within the limits of the wave packet. As the wave packet has a velocity spread, there is an
uncertainty about the momentum of the particle.
Thus according to uncertainty principle states that the position and the momentum of
a particle in an atomic system cannot be determined simultaneously and accurately.
If Δx is the uncertainty associated with the position of a particle and Δpx the
uncertainty associated with its momentum, then the product of these uncertainties will always be
equal or greater than h/4π.
As a direct consequence of the dual nature of matter, in 1927, Heisenberg proposed a
very interesting principle known as the uncertainty principle. If a particle is moving, based on
classical mechanics, at any instant we can find its position and momentum. In wave mechanics, we
regard a moving particle as a wave group. The particle that corresponds to this wave group may be
located anywhere within the group at any given time. Of course, in the middle of the group, the
probability of finding the particle is more but the probability of finding the particle at any other
point inside the wave group is not zero. Narrower the wave group (as in Fig. 4a) higher will be the
accuracy of locating the particle. At the same time, one cannot define the wavelength λ of the wave
accurately when the wave group is narrower.
“It is impossible to know both the exact position and exact momentum of an object at
the same time.”
If Δx and Δp are the uncertainties in the position and momentum measurements then,
according to the uncertainty principle,
Δx Δp ≥ h / 4π (8)
Thus the uncertainty principle is a direct consequence of the wave nature of particles.
Another form of the uncertainty concerns energy and time. In an atomic process, let energy E be
emitted during the time interval Δt. If the energy is emitted in the form of e.m. waves, we cannot
measure the frequency ν of the waves accurately in the limited time available. Let the minimum
uncertainty in the number of waves that we count in a wave group be one wave.
Since frequency = number of waves / time interval
Δν ≥ 1 / Δt
ΔE = hΔν
and so ΔE ≥ h / Δt
or ΔEΔt ≥ h
A more precise calculation based on the nature of wave groups modifies this result to
ΔEΔt ≥ h / 4π (9)
This gives uncertainty in the measurement of energy and time of a process.
“It is impossible to specify precisely and simultaneously the values of both members of a
particular pair of physical variables that describe the behavior of an atomic system.”
Δx Δpx ≥ h/4π
ΔE Δt ≥ h/4π
Δω Δθ ≥ h/4π
We know that the radius of atom is of the order of 10−14m. Thus, if an electron exists inside
the nucleus then the maximum uncertainty in its position is given by
(∆𝑥)𝑚𝑎𝑥 = 2 × 10−14m
Using the uncertainty relation ∆𝑥. ∆𝑝 = ℏ
Since the minimum uncertainty in the momentum of electron should be equals to its
momentum, i.e.,
𝑝 = (∆𝑝) = 5.278 × 10−21 𝑘𝑔 − 𝑚/𝑠
The corresponding energy of the electron is given by
Thus, if an electron exists inside the nucleus, then its energy should be of the order of 97MeV.
But experiments shows that no electrons in the atom possess K.E greater than 4 Mev.
Hence no electrons can exist in inside the nucleus.
• Born suggested that, the value of wave function associated with a moving particle at the position co-
ordinates (x, y, z) in space, and at the time instant ‘t’ is related in finding the particle at certain location
and certain period of time ‘t’.
• If 𝛙 represents the probability of finding the particle, then it can have two cases. Case 1: certainty of its
Presence: +ve probability Case 2: certainty of its absence: - ve probability, but –ve probability is
meaningless, Hence the wave function 𝛙 is complex number and is of the form a+ib
• Even though 𝛙 has no physical meaning, the square of its absolute magnitude |𝛙2 | gives a definite
meaning and is obtained by multiplying the complex number with its complex conjugate then |𝛙2 |
represents the probability density ‘p’ of locating the particle at a place at a given instant of time. And has
real and positive solutions.
𝐩 = 𝛙𝛙∗ = |𝛙2 | = 𝑎 2 + 𝑏 2 𝑎𝑠 𝑖 2 = −1
• If the particle is moving in a volume ‘V’, then the probability of finding the particle in a volume
element dv, surrounding the point x,y,z and at instant ‘t’ is
1.8 Schrödinger Wave Equation (Qualitative): Basic form and conceptual understanding
Schrödinger Time-Dependent Wave Equation
The time-dependent form describes how the wave function changes with time
iħ ∂Ψ/∂t = ĤΨ
Where, ħ = h/2π (reduced Planck’s constant)
Ĥ = Hamiltonian operator = (−ħ²/2m)∇² + V(x, t)
Ψ = wave function of the system
or equivalently,
(-ħ² / 2m) (d²Ψ/dx²) + V(x, t)Ψ = iħ ∂Ψ/∂t
Where, ħ = h/2π (reduced Planck’s constant)
Ψ = wave function of the system and V(x, t) is the potential energy
Schrödinger Time-Independent Wave Equation
For systems where the potential energy does not depend on time, the equation simplifies to
ĤΨ = EΨ
or equivalently,
(-ħ² / 2m) (d²Ψ/dx²) + V(x)Ψ = EΨ
Here, E = total energy of the particle
V(x) = potential energy
Ψ = wave function
Meaning and Importance
➢ The Schrödinger equation provides a complete description of the behaviour of a quantum system.
➢ It allows us to calculate possible energy levels and probability distributions of particles.
➢ Unlike classical mechanics, it does not give a definite path but predicts the probability of finding a
particle in a given region.
➢ This equation is the foundation for understanding phenomena like atomic structure, chemical bonding,
quantum tunneling, and semiconductor behaviour.
6 Angular Momentum (l) lₓ, lᵧ, l_z l̂ₓ, l̂ᵧ, l̂_z l̂ₓ = −iħ(y∂/∂z − z∂/∂y)
l̂ᵧ = −iħ(z∂/∂x − x∂/∂z)
l̂_z = −iħ(x∂/∂y − y∂/∂x)
Figure 3.7. Schematic to represent bits and qubits and also exemplify the fundamental difference
between bits and qubits.
[Link]
Figure 3.8. Physical implementation of a qubit: (a) electron’s spin, (b) photon polarization, (c)
atom, (d) trapped ions, (e) superconducting circuits.
3.5. Representation of single and multiple qubits using Dirac notion
The state of n qubits, |𝜓⟩ is typically described using Dirac notation as a vector in complex vector
2n
space, using the following mathematical equation.
2n −1
|ψ⟩ = ∑ αi |i⟩
i=0
|ψ⟩ = ∑ αi |i⟩
i=0
0 + 1 = 1 …………………….(3.3.)
2 2
The parameters 𝛼0 and 𝛼1 are also known as (quantum) probability amplitudes as their magnitudes
squared |𝛼0|2 and |𝛼1|2 represent probabilities of finding the state |𝜓⟩ in basis states |0⟩ and |1⟩,
respectively.
𝑃(|0⟩) = |𝛼0|2
𝑃(|1⟩) = | 𝛼1|2
Notably, the sum of the probabilities is always equal to 1,
𝑃(|0⟩) +𝑃(|1⟩) = |𝛼0|2 + | 𝛼1|2 = 1 (normalization condition).
The computational basis is represented in matrix form as follows:
1 0
|0⟩ = ( ) and |1⟩ = ( )
0 1
Based on the presentation, the arbitrary state of the single qubit is written as
Multiple qubits:
Definition: A system with more than one qubit is called multiple qubit system.
Two-qubit system:
The state of a two-qubit system, |𝜓⟩ is represented as a vector in a four-dimensional complex vector
space ℂ4. For example, a two-qubit is a state vector (|𝜓⟩) defined by the linear combination of basis
states {|00⟩, |01⟩, |10⟩, and |11⟩}:
For equation 3.1.
2n −1
|ψ⟩ = ∑ αi |i⟩
i=0
|ψ⟩ = ∑ αi |i⟩
i=0
1 0 0 0
|00⟩ = [0], |01⟩ = [1], |10⟩ = [0], |11⟩ = [0]
0 0 1 0
0 0 0 1
Based on the presentation, the arbitrary state of the two-qubit system is written as
1 0 0 0 α0
α1
|ψ⟩ = α0 |00⟩ + α1 |01⟩ + α2 |10⟩ + α3 |11⟩ = α0 [0] + α1 [1] + α2 [0] + α3 [0] = [α ]
0 0 1 0 2
0 0 0 1 α3
Three-qubit system:
The state of a three-qubit system, |𝜓⟩ is represented as a vector in a four-dimensional complex
vector space ℂ8. For example, a three-qubit is a state vector (|𝜓⟩) defined by the linear combination
of basis states {|000⟩, |001⟩, |010⟩, |011⟩, |100⟩, |101⟩, and |110⟩and |111⟩}:
For equation 3.1.
2n −1
|ψ⟩ = ∑ αi |i⟩
i=0
|ψ⟩ = ∑ αi |i⟩
i=0
|ψ⟩ = ∑ αi |i⟩
i=0
where | 𝜓 ⟩ is the state of 𝑛 qubits, 𝛼𝑖 are complex probability amplitudes, and the summation is
taken over all possible basis states labeled by 𝑖.
Example: Electron’s spin superposition
Electron spin is an intrinsic quantum property that behaves like a tiny magnet moment. The spin
of an electron is measured along a specific axis (for example, z- axis), it can only be one of the
two states:
spin-up, denoted by |0⟩
spin-down, denoted by |1⟩
The state of a single electron’s spin (single qubit), | 𝜓 ⟩ can be written as superposition of |0⟩ and
|1⟩ (see Figure 3.9. (a)).
|𝜓⟩ = 𝛼|0⟩ + 𝛽|1⟩……………..(3.7.)
For the case of two electrons, the superposition state of these two electrons’ spin is given by (see
Figure 3.9. (b)).
|ψ⟩ = α0 |00⟩ + α1 |01⟩ + α2 |10⟩ + α3 |11⟩ … … … … … . (3.8. )
Physical significance:
i. Reveals the quantum reality
Superposition proves that quantum particles do not behave like the classical particles,
i.e., it can exist in multiple states at the same time.
ii. Foundation of quantum computing power
For the system of N qubits, superposition allows 2N possible state to exist
simultaneously. N classical bits represent only one out of 2N states at a time whereas N
qubits represent all 2N states simultaneously. This parallelism gives the quantum
computer exponential power.
iii. Enables entanglement and quantum communication
Superposition aids the particles to be entangled, means measurement of one instantly
determines the other, no matter how far they are.
Superposition is necessary for entanglement and entanglement powers:
• quantum communication networks
• quantum cryptography
• quantum teleportation
Figure 3.9. The superposition state of (a) single electron’s spin and (b) two electrons’ spin.
3.6.2. Entanglement
Entanglement is a phenomenon in which two or more quantum particles become linked in a such
a way that the measurement of the state of one particle determines instantaneously the state of
other, even if they are separated physically by very large distances. Einstein called this as “spooky
action at a distance”.
Therefore, the combined state of the entangled particles cannot be written as the tensor product of
the individual states of the particles.
Examples:
For example, consider a system of two particles, such as electrons (see Figure 3.10.) or photons
(see Figure 3.11.), and it is known that electron can only be one of the two states:
spin-up, denoted by |0⟩
spin-down, denoted by |1⟩
and photon can also only be one of the two states:
horizontally polarized, denoted by |0⟩
vertically polarized, denoted by |1⟩
if their quantum states are entangled, its entangled state is often denoted as
+ =
( 01 + 10 )
2
Here, |01⟩ and |10⟩ denote the states where the first particle (electron or photon) is in state |0⟩ and
the second (electron or photon) is in state |1⟩, and vice versa.
In the entangled state, if you measure the state of one of the particles, say the first one, and find it
to be in state |0⟩, then the state of the other particle collapses instantly to |1⟩, and vice versa. This
instantaneous correlation between the particles’ states, regardless of the distance between them, is
what characterizes entanglement.
Electron’s spin:
Two-qubit:
z 0 0 0
-z π 0 1
x 0 0 +1
2 2
-x π 0 −1
2 2
y 0 +i 1
2 2 2
-y 3 0 −i 1
2 2 2
Unit IV: Quantum Logic Gates
Quantum logic gates are the basic components of quantum circuits, just as classical logic gates
form the building blocks of classical circuits. Quantum gates act on one or more qubits by
changing their quantum state through specific quantum operations defined by unitary
matrices. A single-qubit gate might, for instance, rotate the state vector of a qubit on the Bloch
sphere, while multi-qubit gates can entangle the states of qubits to perform complex
operations. The actions of these gates are mathematically described by matrix-vector
multiplication, transforming the input state of a qubit into a new state. The most widely used
quantum logic gates include the Pauli X, Pauli Y, Pauli Z, Hadamard, CNOT, SWAP gates, etc.
These gates perform particular operations and are utilised in various quantum algorithms. The
use of quantum logic gates affords quantum computers the capability to perform operations and
resolve problems that are beyond the reach of classical computers.
A single-qubit gate is represented by a 2 × 2 unitary matrix U that transforms the state |ψ⟩ as:
U |ψ⟩ = |ψ′⟩
For an n-qubit system, the gate is represented by a 2n × 2n unitary matrix.
i/p I o/p
i/p X o/p
X-Gate:
Input Output
|0⟩ |1⟩
|1⟩ |0⟩
α|0⟩ + β|1⟩ α|1⟩ + β|0⟩
[Link] Pauli-Y Gate: The Pauli-Y gate introduces a phase shift and swaps the amplitudes of
state |0⟩ and |1⟩.
In a circuit diagram, the Pauli Y gate is represented by the following symbol
i/p Y o/p
Y-Gate:
Input Output
|0⟩ i|1⟩
|1⟩ -i|0⟩
α|0⟩ + β|1⟩ iα|1⟩-i β|0⟩
i/p Z o/p
i/p H o/p
h
The Hadamard gate is represented by the following matrix:
1 1 1
H= [ ]
√2 1 −1
Action of H-gate on inputs:
When the Hadamard gate is applied to the qubit state |0⟩, it creates an equal superposition of
the basis states |0⟩ and |1⟩
1 1 1 1 1 1 1 1 0 1
H |0⟩ = [ ] [ ] = [ ] = ([ ] + [ ] ) = (|0⟩+|1⟩)
√2 1 −1 0 √2 1 √2 0 1 √2
1
The resulting state after applying the Hadamard gate to the |0⟩ state is |+⟩ = (|0⟩ + |1⟩).
√2
Similarly, when the Hadamard gate is applied to the qubit state |1⟩, it also creates an equal
superposition of the basis states |0⟩ and |1⟩:
1 1 1 0 1 1 1 1 0 1
H |1⟩ = [ ] [ ] = [ ] = ([ ] − [ ] ) = (|0⟩-|1⟩)
√2 1 −1 1 √2 −1 √2 0 1 √2
1
The resulting state after applying the Hadamard gate to the |1⟩ state is |-⟩ = (|0⟩ - |1⟩). In
√2
summary, the Hadamard gate creates superposition, transforming |0⟩ into an equal
superposition of |0⟩ and |1⟩, and transforming |1⟩ into an equal superposition with a relative
negative phase.
Truth Table:
Hadamard Gate:
Input Output
α|0⟩ + β|1⟩ α(
|0⟩+|1⟩
)+β(
|0⟩−|1⟩
)
√2 √2
i/p S o/p
The matrix of S gate is represented by h
1 0
S=[ ]
0 𝑖
Action of S gate on inputs:
Applying the S gate to a qubit in the |0⟩ state results in the |0⟩ state
1 0 1 1
S|0⟩ = [ ] [ ] = [ ] = |0⟩
0 𝑖 0 0
Applying the S gate to a qubit in the |1⟩ state transforms the state to i|1⟩.
1 0 0 0
S|1⟩ = [ ] [ ] = i [ ] = i|1⟩
0 𝑖 1 1
Truth Table:
S-Gate
Input Output
|0⟩ |0⟩
|1⟩ i|1⟩
α|0⟩ + β|1⟩ α|0⟩ + iβ|1⟩
Single qubit gates play a crucial role in quantum computing, allowing for the manipulation of
qubit states and the creation of superpositions which form the basis for quantum algorithms
and quantum information processing.
|c⟩ |c⟩
|t⟩ |c t⟩
Here, the first qubit is the control |c⟩ qubit, and the second qubit is the target qubit |t⟩
Matrix representation:
1 0 0 0
1
CNOT= [0 0 0]
0 0 0 1
0 0 1 0
Action of CNOT Gate on inputs:
When the CNOT gate is applied to the qubits, the operation depends on the state of the control
qubit |c⟩.
If the control qubit |c⟩ = |0⟩, the target qubit |t⟩ remains unchanged.
If the control qubit |c⟩ = |1⟩, the target qubit |t⟩ undergoes a bit-flip
The application of the CNOT gate to basis states in a two-qubit system can be represented as
follows:
1 0 0 0 1 1
CNOT |00⟩ = [0 1 0 0] [ ] = [0] = |00⟩
0
0 0 0 1 0 0
0 0 1 0 0 0
1 0 0 0 0 0
CNOT |01⟩ = [0 1 0 0] [1] = [1] = |01⟩
0 0 0 1 0 0
0 0 1 0 0 0
1 0 0 0 0 0
1 0
0] [ ] = [0] = |11⟩
CNOT |10⟩ = [0 0
0 0 0 1 1 0
0 0 1 0 0 1
1 0 0 0 0 0
CNOT |11⟩ = [0 1 0 0] [0] = [0] = |10⟩
0 0 0 1 0 1
0 0 1 0 1 0
In summary, the CNOT gate performs a bit-flip on the target qubit if and only if the control
qubit is in the state |1⟩, while leaving the target qubit unchanged when the control qubit is in
the state |0⟩.
Truth Table:
Input Output
|c⟩ |t⟩ |c c⊕ t ⟩
|0⟩ |0⟩ |00⟩
|0⟩ |1⟩ |01⟩
|1⟩ |0⟩ |11⟩
|1⟩ |1⟩ |10⟩
qubit 1 qubit 2
qubit 1
qubit 2
The SWAP gate can be decomposed into three CNOT gates, as shown below
qubit 1
qubit 2
The SWAP gate plays an essential role in quantum computing when you need to rearrange the
order of qubits in a quantum circuit or when you want to move information from one qubit to
another.
SWAP Gate matrix:
1 0 0 0
0
[0 1 0]
0 1 0 0
0 0 0 1
Mathematically, the SWAP gate's action on a quantum state is
SWAP (|ϕ1⟩⊗|ϕ2⟩) = |ϕ2⟩⊗|ϕ1⟩
1 0 0 0 1 1
SWAP |00⟩ = [0 0 1 0] [0] = [0] = |00⟩
0 1 0 0 0 0
0 0 0 1 0 0
1 0 0 0 0 0
SWAP |01⟩= [0 0 1 0] [ ] = [0] = |10⟩
1
0 1 0 0 0 1
0 0 0 1 0 0
1 0 0 0 0 0
SWAP |10⟩= [0 0 1 0] [0] = [1]= |01⟩
0 1 0 0 1 0
0 0 0 1 0 0
1 0 0 0 0 0
SWAP |11⟩= [0 0 1 0] [ ]=[0]=
0
|11⟩
0 1 0 0 0 0
0 0 0 1 1 1
Truth Table:
Input Output
|00⟩ |00⟩
|01⟩ |10⟩
|10⟩ |01⟩
|11⟩ |11⟩
1 0 0 0
0 1 0 0
0 0 1 0
|000⟩ = 0 |001⟩ = 0 |010⟩ = 0 |011⟩ = 1
0 0 0 0
0 0 0 0
0 0 0 0
[0] [0] [0] [0]
0 0 0 0
0 0 0 0
0 0 0 0
|100⟩ = 0 |101⟩ = 0 |110⟩ = 0 |111⟩ = 0
1 0 0 0
0 1 0 0
0 0 1 0
[0] [0] [0] [1]
|c1⟩ |c1⟩
|c2⟩ |c2⟩
1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 1 0 0 0 0
CCNOT= 0
0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 1
[0 0 0 0 0 0 1 0]
1 0 0 0 0 0 0 0 1 1
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
T |000⟩ = 0 = 0 = |000⟩
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 0 0
[0 0 0 0 0 0 1 [
0] 0 ] [ 0]
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 1 1
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
T |001⟩ = 0 = 0 = |001⟩
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 0 0
[0 0 0 0 0 0 1 [
0] 0 ] [ 0]
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 1 1
0 0 1 0 0 0 0 0
T |010⟩ = 0 = 0 = |010⟩
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 0 0
[0 0 0 0 0 0 1 0] [ 0 ] [ 0]
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 1
T |011⟩ = 0 = 1 = |011⟩
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 0 0
[0 0 0 0 0 0 1 0] [0] [0]
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
T |100⟩ = 0 = 0 = |100⟩
0 0 0 0 1 0 0 0 1 1
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 0 0
[0 0 0 0 0 0 1 0] [ 0] [ 0]
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
T |101⟩ = 0 = 0 = |101⟩
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 1 1
0 0 0 0 0 0 0 1 0 0
[0 0 0 0 0 0 1 [
0] 0 ] [ 0]
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 = 0 = |111⟩
T |110⟩ = 0
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 1 0
[0 0 0 0 0 0 1 0] [0] [1]
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
T |111⟩ = 0 = 0 = |110⟩
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 0 1
[0 0 0 0 0 0 1 0] [ 1] [ 0]
0 0 0 0 0 0
0 0 1 0 0 1
0 1 0 0 1 0
0 1 1 0 1 1
1 0 0 1 0 0
1 0 1 1 0 1
1 1 0 1 1 1
1 1 1 1 1 0
In summary, the Toffoli gate performs a bit-flip on the target qubit if and only if both control
qubits are in the state |1⟩, while leaving the target qubit unchanged in all other cases.