M3 - Quantum Computing - 2022-23
M3 - Quantum Computing - 2022-23
Quantum Computing
Syllabus:
Quantum Gates: Single Qubit Gates: Quantum Not Gate , Pauli X-Gate, Y-Gate and Z
Gates, Hadamard Gate , Phase Gate (or S Gate), T Gate
Multiple Qubit Gates: Controlled gate, CNOT Gate, (Discussion for 4 different input
states). Representation of Swap gate, Controlled -Z gate, Toffoli gate.
Prerequisites: Matrices
Quantum computers can perform computational tasks such as factorizing a number or carry
out searches in database. Quantum computer networks can efficiently transmit and receive
information in unusual ways. They find immense potential in the science of cryptography
(science of maintaining secrecy and security in communication).
Moore’s law & its end:
In 1965, Gordon Moore observed that the number of transistors on a microchip doubles
every two years. This is known as Moore’s law. The computer industry has followed his
prediction throughout for 45 years. Because of this, conventional computers have increased
the speed and miniaturisation at an exponential rate. So, we might reach a stage where a
number of electrons to be small as 10 per device. Clearly there is an upper limit for the
miniaturisation. A physical device of such microscopic dimensions may not behave the same
way as a device of bigger dimensions. The present day research in the field of
nanotechnology suggests that materials behave differently at such small scales. Also,
miniaturisation will have direct impact on the progress of computing power. What this
means specifically, is that transistors in integrated circuits have become faster. The faster the
integrated circuit conducts electricity, the faster the computer operates. This means that
computers are projected to reach their limits because transistors will be unable to operate
within smaller circuits at increasingly higher temperatures. This is due to the fact that
cooling the transistors will require more energy than the energy that passes through the
transistor itself. So, Moore’s law should come to an end soon. All these observations have
encouraged the development of new computing system.
The units of information processing system in classical system are bits. A bit has just two
possible states (namely, ‘0’ and ‘1’). In quantum information system the units used for
information processing are qubits. A qubit has two basic states represented by |0⟩ and |1⟩.
But it can also exist in a superposition state, which is a state other than |0⟩ or |1⟩. A single
qubit can thus encode an infinite number of classical bits. In classical information processing
the joint states of bits are changed and manipulated by means of classical logic gates.
Quantum information processing is also achieved by the operation of gates. As in the
classical case, the states of qubits making up a quantum register can be changed step by step
by the action of a number of quantum gates that constitute a universal set, where there can be
more than one possible set of universal gates.
This basic unit of information in quantum computing is called the qubit, which is short for
quantum bit. There is a fundamental difference between a classical bit and a qubit. Like a bit,
a qubit can also be in one of two states. We label these two states by |0⟩ and |1⟩. But it can
also exist in a superposition state, which is a state other than |0⟩ or |1⟩ . In other words, the
state of a qubit is a vector in a two-dimensional complex vector space. The special states |0⟩
and |1⟩ are known as computational basis states. For example if white and black colours
correspond to state |0⟩ and |1⟩ then a qubit is imagined to be to have any shade of grey.
The superposition state is a linear combination of the states |0⟩ and |1⟩. If we label this state
|𝜓⟩, a superposition state is written as
Here α, β are complex numbers. That is, the numbers of the form z = x + iy, where i = √−1
The laws of quantum mechanics tell us that the modulus squared of α, β in the above equation
gives us the probability of finding the qubit in state|0⟩ or |1⟩. In other words,
|α|2: Tells us the probability of finding |𝜓⟩ in state |0⟩
Therefore, when we measure a qubit we get either the result 0, with probability |α|2, or the
result 1, with probability |β|2. Also, the total probability |α|2 + |β|2 = 1, according to theory of
probability. Thus, we cannot examine a qubit to determine its quantum state, that is, the
values of α and β. Instead, quantum mechanics tells us that we can only acquire much more
restricted information about the quantum state. It is because a qubit can exist in a continuum
of states between |0⟩ and |1⟩ until it is observed. So, we have to keep in mind that when a
qubit is measured, it only gives ‘0’ or ‘1’ as the measurement result – probabilistically.
1 1
By comparing with equation (1) we get α = and β =
√2 √2
1
Which means |α|2= |β|2 = 2 , Therefore, the measurement gives 0 fifty percent of the time and
1 another fifty percent of the time. Hence we often return the state represented by | +⟩.
1. Two states of an electron orbiting a single atom are as shown in Figure. In the atom
model, the electron can exist in either the ‘ground’ or ‘excited’ states, which we call
|0⟩ and |1⟩, respectively. By shining light on the atom, with appropriate energy and
for an appropriate length of time, it is possible to move the electron from the |0⟩ to
|1⟩ and vice versa. But, by reducing the time we shine the light, an electron initially in
the state |0⟩ can be moved ‘halfway’ between |0⟩ and |1⟩, into the | +⟩ state.
2. Two different polarisations of a photon.
3. Alignment of a nuclear spin in a uniform magnetic field.
To represent qubits geometrically, we use a three dimensional sphere of unit radius called
Bloch sphere. It provides a useful means of visualising the state of a single qubit.
𝑥 = 𝑟𝑐𝑜𝑠𝜃
𝑦 = 𝑟𝑠𝑖𝑛𝜃
𝑍 = 𝑟(𝑐𝑜𝑠𝜃 + 𝑖𝑠𝑖𝑛𝜃) = 𝑟𝑒 𝑖𝜃
We know that a superposed state is represented by the equation |𝜓⟩ = α|0⟩+ β|1⟩.
Since |α|2 + |β|2 = 1, we can rewrite the superposed state as
𝜃 𝜃
|𝜓⟩ = 𝑐𝑜𝑠 ( ) |0⟩ + 𝑒 𝑖∅ 𝑠𝑖𝑛 ( ) |1⟩
2 2
Where 𝜃 and ∅ define a point on the Bloch sphere as shown in figure.
For ∅ = 0o and 𝜃 = 0, the state |𝜓⟩ corresponds to |0⟩ and is along +Z- axis.
For ∅ = 0o and 𝜃 = 180o, the state |𝜓⟩ corresponds to |1⟩ and is along -Z- axis.
1
For ∅ = -90o, |𝜓⟩ = (|0⟩- 𝑖|1⟩), is a superposition state along - y axis.
√2
1
For ∅ = 0o, |𝜓⟩ = (|0⟩+ |1⟩), is a superposition state along + x axis.
√2
1
For ∅ = 180o, |𝜓⟩ = (|0⟩ −|1⟩), is a superposition state along - x axis.
√2
For a classical computer the states the two logical states 0 and 1 are represented by poles of
the sphere. In contrast, the state of a qubit can be represented by any point on the sphere.
Since there are infinite points on the sphere, a qubit has capacity to store more information
compared to classical bit.
Two qubits:
In case we have two classical bits the possible configurations are 00, 01, 10 and 11. Suppose
we have two qubits, they can be in one of the four computational basis states denoted by
|00⟩, |01⟩, |10⟩ and |11⟩. Similarly a pair of qubits can also exist in superposition of these
four states, so that
These four states define various possibilities. Thus a two qubit system can store all four
numbers simultaneously. An interesting feature with two qubit system is the occurrence of
entangled states. They are known as Bell states or EPR (Einstein-Podolsky-Rosen) states.
These states enormously enhance the power of computation and communication. The Bell
state is represented by
|00⟩ + |11⟩
√2
If we measure the first qubit, then with 50% probability we obtain the result 0. The resulting
post-measurement state will be |00⟩ so measuring the second qubit will also give a result of
0.
On the other hand, if we measure the first qubit as 1 with 50% probability, then the resulting
post-measurement state will be |11⟩, so measuring the second qubit will now give a result of
1. In general for n-qubit states, there will be superposition involving 2n terms and can be
represented by
𝑛
|𝜓⟩ = ∑2𝑥=0
−1
𝑎𝑥 |𝑥⟩
Where 𝑥 within the symbol | ⟩ (this symbol is called ket) is written in the binary notation.
Thus in general a system of L qubits can store up to 2L numbers at the same time in
superposition.
In quantum mechanics 0 and 1 states are represented by kets |0⟩ and |1⟩. They are given by
the column matrices
1 0
|0⟩ = [0] and |1⟩ = [1]
Identity Operator I:
1 0
The Identity Operator I is given by 𝐼 = [ ]
0 1
It is the simplest operator, and does nothing to any ket on application, ie. I|𝑢⟩ = |𝑢⟩
1 0 1 1
[ ] [0] = [0]
0 1
1 0 0 0
[ ] [1] = [1]
0 1
Pauli matrices:
These are 2 by 2 matrices, which go by a variety of notations. The matrices, and their
corresponding notations, are shown below. The Pauli matrices are very useful in the study of
quantum computation and quantum information.
1 0
𝜎0 = 𝐼 = [ ]
0 1
0 1
𝜎1 = 𝜎𝑋 = 𝑋 = [ ]
1 0
0 −𝑖
𝜎2 = 𝜎𝑌 = 𝑌 = [ ]
𝑖 0
1 0
𝜎3 = 𝜎𝑧 = 𝑍 = [ ]
0 −1
Operation of Pauli matrices on |𝟎⟩ and |𝟏⟩ basis states
0 1 1 0∗1 + 1∗0 0
X|0⟩ = [ ] [ ] =[ ] = [1] = |1⟩
1 0 0 1∗1 + 0∗0
0 1 0 0∗0 + 1∗1 1
X|1⟩ = [ ] [ 1] = [ ] = [0] = |0⟩
1 0 1∗0 + 0∗1
As noted above, since X transforms one basis state into the other, it is sometimes called the
NOT operator.
0 −𝑖 1 0∗1 − 𝑖∗0 0
Y|0⟩ = [ ] [0] = [ ] = [ 𝑖 ] = 𝑖|1⟩
𝑖 0 𝑖∗1 + 0∗0
0 −𝑖 0 0∗0 − 𝑖∗1 −𝑖
Y|1⟩ = [ ] [1] = [ ] = [ 0 ] = −𝑖|0⟩
𝑖 0 𝑖∗0 + 0∗1
1 0 1 1∗1 + 0∗0 1
Z|0⟩ = [ ] [ ] =[ ] = [0] = |0⟩
0 −1 0 0∗1 − 1∗0
1 0 0 1∗0 + 0∗1 0
Z|1⟩ = [ ] [ ] =[ ] = [−1] = −|1⟩
0 −1 1 0∗0 − 1∗1
Conjugate of a matrix:
If a matrix A consists of a complex number as elements, then the matrix obtained by the
corresponding conjugate complex elements is called the conjugate of A and is denoted by 𝐴∗
0 𝑖 0 −𝑖
If A = [ ] then 𝐴∗ = [ ]
𝑖 0 −𝑖 0
𝑖 0 −𝑖 0
If A = [ ] then 𝐴∗ = [ ]
𝑖 0 −𝑖 0
1 𝑖 1 −𝑖
If A = [ ] then 𝐴∗ = [ ]
1 𝑖 1 −𝑖
1 + 3𝑖 1+𝑖 1 − 3𝑖 1−𝑖
If A = [ ] then 𝐴∗ = [ ]
2𝑖 1 − 4𝑖 −2𝑖 1 + 4𝑖
Transpose of a matrix:
1 𝑖 1 1
If A = [ ] then 𝐴𝑇 = [ ]
1 𝑖 𝑖 𝑖
0 1 0 𝑖
If A = [ ] then 𝐴𝑇 = [ ]
𝑖 0 1 0
1 + 3𝑖 2𝑖 1 + 3𝑖 1+𝑖
If A = [ ] then 𝐴𝑇 = [ ]
1+𝑖 1 − 4𝑖 2𝑖 1 − 4𝑖
Unitary Matrix U:
where I is a unit matrix (a square matrix having unit elements in the principal diagonal or
leading diagonal and zero element everywhere else). Unitary operators are important because
they describe the time evolution of a quantum state.
𝛼
ie |𝜓⟩ = (𝛼1 ) which also means ⟨𝜓| = (𝛼1∗ 𝛼2∗ )
2
𝛼
Now, the inner product is ⟨𝛽|𝜓⟩ = (𝛽1 𝛽2) (𝛼1 ) = 𝛼1 𝛽1 + 𝛼2 𝛽2
2
𝑖̂ = (10) 𝑗̂ = (01)
𝑎
|𝜓⟩ = (𝑖𝑏) |𝜓 † ⟩ = (𝑎 − 𝑖𝑏)
𝑎
|𝜓 † ⟩|𝜓⟩ = (𝑎 − 𝑖𝑏) (𝑖𝑏 ) = 𝑎2 + 𝑏 2 -------gives probability
Orthogonality:
0
For example: ⟨0| = (1 0) and |1⟩ = (1)
0
Therefore ⟨0|1⟩ = (1 0) (1) = 0 + 0= 0
Orthonormality:
If each element of a set of vectors is normalized and the elements are orthogonal with respect
to each other, we say the set is orthonormal.
Quantum Gates
Single Qubit Gates
Quantum Not Gate: A quantum NOT gate for a qubit is a process that takes the state |0⟩ to
the state |1⟩ and vice-versa. It is the quantum analogue for the NOT gate. In case of
superposition, the quantum NOT gate acting linearly in the state α|0⟩+ β|1⟩ is taken to the
state α|1⟩+ β|0⟩.
0 1
𝑋=[ ]
1 0
𝛼
If the quantum state α|0⟩+ β|1⟩ is written in vector notations as [𝛽 ]
𝑋 [𝛽𝛼 ] = [01 1 𝛼
0
𝛽
] [𝛽 ]=[𝛼 ] or α|1⟩+ β|0⟩
𝛽 1 𝛽 𝛼
Then the output becomes 𝑋[𝛼 ] = [01 0
] [𝛼 ]=[𝛽 ] or α|0⟩+ β|1⟩
Following are the figure and truth table for quantum NOT gate
Input Output
|0⟩ |1⟩
|1⟩ |0⟩
α|0⟩+ β|1⟩ α|1⟩+ β|0⟩
Pauli Z gate:
1 0
𝑍=[ ] (Recall Pauli matrices)
0 −1
If it operates on |0⟩, we get
1 0 1 1
[ ] [0]= [0] ie Z|0⟩= |0⟩
0 −1
1 0 0 0
[ ] [1]= [−1] ie Z|1⟩= −|1⟩
0 −1
Following are the figure and truth table for Pauli Z gate
Input Output
|0⟩ |0⟩
|1⟩ −|1⟩
α|0⟩+ β|1⟩ α|0⟩- β|1⟩
0 1
𝑋=[ ] (Recall Pauli matrices)
1 0
0 −𝑖
𝑌=[ ]
𝑖 0
and similar kind of operation can be carried out on |0⟩ and |1⟩ as shown in the truth table
below:
Hadamard Gate:
1 1 1
𝐻= [ ]
√2 1 −1
𝛼
If the quantum state α|0⟩+ β|1⟩ is written in vector notations as [𝛽 ]
Therefore
Following are the figure and truth table for Hadamard gate
Input Output
|0⟩ (|0⟩ + |1⟩)
√2
|1⟩ |0⟩ − |1⟩
√2
1 0
𝑆=[ ]
0 𝑖
The effect of phase gate on |0⟩
1 0 1 1
[ ] [0]= [0]
0 𝑖
1 0 0 0
[ ] [1]= [ 𝑖 ]
0 𝑖
1 0 𝛼 𝛼
[ ] [𝛽 ]= [𝑖𝛽 ]
0 𝑖
Following are the figure and truth table for S or phase gate
Input Output
|0⟩ |0⟩
|1⟩ 𝑖|1⟩
α|0⟩+ β|1⟩ α|0⟩+ 𝑖 β|1⟩
T Gate:
1 0
𝑇=[ 𝑖𝜋 ]
0 𝑒𝑥𝑝( )
4
If the input is |0⟩, then the output is
1 0 1 1
𝑒𝑥𝑝( 4 )] [0] = [0]
[0 𝑖𝜋
1 0 0 0
[0 𝑒𝑥𝑝( )] [1]= [exp(𝑖𝜋4)]
𝑖𝜋
4
𝑖𝜋
i.e the state is 𝑒𝑥𝑝( 4 ) |1⟩,
1 0 𝛼 𝛼
[0 𝑒𝑥𝑝( 4 )] [𝛽]= [βexp(𝑖𝜋4)]
𝑖𝜋
𝑖𝜋
to α|0⟩+ βexp( 4 )|1⟩
The following are the truth table and figure for a T Gate
Input Output
|0⟩ |0⟩
|1⟩ 𝑖𝜋
exp( )|1⟩
4
𝑖𝜋
α|0⟩+ β|1⟩ α|0⟩+𝛽exp( 4 )|1⟩
Multiple Qubit Gates:
Controlled gate:
A controlled gate is one in which the operation is of the kind “If A is true then B is also true”.
A is usually referred to as control qubit and B is the target qubit. If the control qubit is 0, then
the target qubit is not altered. If the control qubit is 1, then the target qubit is transformed
(inverted). However, the control qubit remains unaltered in both cases.
The circuit of CNOT Gate control qubit A and target qubit B is shown below
For input state |00⟩ (control qubit = 0 and target qubit = 0): Both the bits remain unaltered
and hence the output state becomes |00⟩, which is same as input state.
For input state |01⟩ (control qubit = 0 and target qubit = 1): Both the bits remain unaltered
and hence the output state becomes |01⟩, which is same as input state.
For input state |10⟩ (control qubit = 1 and target qubit = 0): The target qubit is flipped to 1.
Therefore the output state becomes |11⟩
For input state |11⟩ (control qubit = 1 and target qubit = 1): The target qubit is flipped to 0.
Therefore the output state becomes |10⟩.
Input Output
|00⟩ |00⟩
|01⟩ |01⟩
|10⟩ |11⟩
|11⟩ |10⟩
In a Swap Gate the output of the first CNOT Gate is fed as input to the second Gate and this
result is fed to the third Gate. Therefore two qubits are swapped in the final output.
Input Output
|00⟩ |00⟩
|01⟩ |10⟩
|10⟩ |01⟩
|11⟩ |11⟩
Controlled -Z gate:
Input Output
|00⟩ |00⟩
|01⟩ |01⟩
|10⟩ |10⟩
|11⟩ −|11⟩
Toffoli Gate:
It is a reversible Gate having three inputs (a, b, c) and three output bits (a’, b’ c’). The first
two bits are control bits which remain unaffected by the action of Toffoli Gate. The third is
the target bit which is inverted if both the control bits are 1; else it does not change. The
quantum Taffolli Gate can be used to simulate irreversible classical logical Gates and ensures
that they are capable of doing any computation.
Truth table for Toffoli Gate
Input Output
a b c a’ b’ c’
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
NOTE:
While the basic unit of information in quantum computation is the qubit, the arena in which
quantum computation takes place is a mathematical abstraction called a vector space. It turns
out that quantum states behave mathematically in an analogous way to physical vectors—
hence the term vector space. This type of space is one that shares most basic properties that
vectors have with physical vectors— for example, a length.