Quantum Comp-For Students
Quantum Comp-For Students
Introduction
Quantum computing uses a combination of bits to perform specific computational tasks with
greater efficiency than their classical counterparts. Even though quantum computers are not
going to replace classical computers, quantum technology is significantly changing the way the
world operates. The quantum computer gains much of its processing power through the ability
for bits to be in multiple states simultaneously. They can perform tasks using a combination of
1’s, 0’s and both 1 and 0 at a time
Brief History
In 1981, Paul Benioff at Argonne National Labs came up with the idea of a computer that
operates with quantum mechanical principles. In 1984, David Deutsch of Oxford University
provided the critical idea behind quantum computing research and the possibility of designing a
computer that is based exclusively on quantum rules.
Gordon Moore did not call his observation as "Moore's Law," nor did he set out to create a
"law". Moore made this statement based on noticing emerging trends in chip manufacturing at
the semiconductor industry. Eventually, Moore's insight became a prediction, which in turn
became the golden rule known as Moore's Law.
Moore's Law implies that computers, machines that run on computers, and computing power all
become smaller, faster, and cheaper with time, as transistors on integrated circuits become more
efficient.
Here is a graphic representation for microprocessors
Moore’s Law has had a direct impact on the progress of computing power. What this means
specifically, is that transistors in integrated circuits have become faster. Transistors conduct
electricity, which contain carbon and silicon molecules that can make the electricity run faster
across the circuit. The faster the integrated circuit conducts electricity, the faster the computer
operates.
The electronic industry for computers grows hand-in-hand with the decrease in size of the
integrated circuits. This miniaturization is necessary to increase computational power, that is, the
number of floating-point operations per second (FLOPS) a computer can perform. In 1950’s,
electronic computers were capable of performing approximately 103 FLOPS while present
supercomputers have a power greater than 1013 FLOPS. According to Moore’s law, the number
of transistors that may be placed on a single integrated circuit chip doubles approximately every
18 – 24 months. The present limit is approximately 108 transistors per chip and the typical size
of circuit components is of the order of 100 nano meters. That means, we have reached the
atomic size for storing a single bit of information and quantum effects have become unavoidably
dominant.
Taking all these factors into consideration, it is necessary to look for alternative ways of
computing outside of the electrons and silicon transistors. One such alternative is quantum
computing.
Quantum computers are based on quantum bits (qubits) and use quantum effects like
superposition and entanglement to their benefit, hence overcoming the miniaturization problems
of classical computing.
Comparison of Classical and Quantum Computing
The quantum computer operates with a two-mode logic gate. In a quantum computer, a number
of elemental particles such as electrons or photons can be used. Each particle is given a charge
or polarization, acting as a representation of 0 and/or 1. Each particle is called a quantum bit, or
qubit. The nature and behaviour of these particles form the basis of quantum computing. The
two most relevant aspects of quantum physics are the principles of superposition and
entanglement.
Bit: A digital computer stores and processes information using bits, which can be either 0 or 1.
Physically, a bit can be anything that has two distinct configurations: one represented by “0”,
and the other represented by “1”. It could be a light bulb that is on or off, a coin that is heads or
tails, or any other system with two distinct and distinguishable possibilities. In modern
computing and communications, bits are represented by the absence or presence of an
electrical signal, encoding “0” and “1” respectively
Qubit is the physical carrier of quantum information. It is the quantum version of a bit, and its
quantum state can be written in terms of two levels, labelled |0⟩ and |1⟩. | ⟩ this notation is
known as ‘ket’ notation and | is known as ‘brac’ notation. Both are together called as Dirac
notations ‘Ket’ is analogous to a column vector.
They are also called basis vectors and represented by two-dimensional column vectors as follows
1 0
⟩ ⟩
|0 = [ ] |1 = [ ]
1
0
The qubit can be in any one of the two states as well as in the superposed state simultaneously
In quantum computation two distinguishable states of a system are needed to represent a bit of
data. For example, two states of an electron orbiting a single atom is shown in the following
figure. Spin up is taken as |1⟩ and spin down is taken as |0⟩. Similarly ground state energy
level is |0⟩ and excited state level is |1⟩
Excited level
|0⟩ |1⟩
Ground level
This is the abstract notion of a qubit. The quantum computers actually use a physical type of
qubit called a superconducting qubit is made from superconducting materials (of course, there
are other approaches also to build the qubits)
NOTE:
In quantum computing the vectors are members of complex vector space . Each member
of this space is represented as column vector of n dimensions with single 1 at the location
corresponding to a particular basis vector.
It is as follows
1 0 0 0
𝖥01 𝖥11 𝖥01 𝖥01
I I I I I I I I
|0⟩ = I . I |1⟩ = I . I |2⟩ = I . I … …. |𝑁 − 1⟩ = I0. I
0 0 1
I. I. I. I.I
I I I [1]
[0] [0] [0]
Complex vector space is a vector space which contains complex numbers
Here we use only two dimensions (or only two sets). Hence we write as
1 0
⟩ ⟩
|0 = [ ] |1 = [ ]
1
0
The difference between qubits and classical bits is that a qubit can be in a linear combination
(superposition) of the two states |0⟩ and |1⟩. For ex, if and are the probability amplitudes of
electron in ground state (ie, in |0⟩ state) and in excited state (ie, in |1⟩ state) then the linear
combination of two states is
|ψ⟩ = α |0⟩ + β|1⟩
The numbers α and β are complex but due to normalization conditions
|𝖺|2 + |𝛽|2 = 1.
Here |𝖺|2is the probability of finding |𝜓⟩ in state |0⟩ and |𝛽|2is the probability of finding |𝜓⟩ in
state |1⟩. So, we have to keep in mind that when a qubit is measured, it only gives either ‘0’ or
‘1’ as the measurement result – probabilistically
1 1
|Ψ⟩ = |0⟩ + |1⟩
√2 √2
11
∴𝖺=𝑎𝑛𝑑 𝛽 =
√2√2
|𝖺|2 = |𝛽|2 = 1
2
This means that with 50% probability the qubit will be found in |0⟩ state as well as in |1⟩ state.
The superposed states are also called as space states where as |0⟩ and |1⟩ are called basis
states.
Properties of qubits
1. Qubits make use of discrete energy state particles such as electrons and photons
2. Qubits exists in two quantum state |0⟩ and |1⟩ or in a linear combination of both states. This
is known as superposition. This property allows for exponentially many logical states at
once (and no classical computer can achieve it)
3. Unlike classical bits, qubit can work with the overlap of both 0 & 1 states. For ex, a 4-bit
register1 can store one number from 0 to 15 (because of 2n = 24=16), but 4-qubit register can
store all 16 numbers
4. When the qubit is measured, it collapses to one of the two basis states |0⟩ or |1⟩
5. Quantum entanglement and quantum tunnelling are two exclusive properties of qubit
6. State of the qubits is represented using Bloch sphere
1
Register – is a group of flip-flops. Its basic function is to hold information within a digital system so as to
make it available to the logic units during the computing process. However, a register may also have
additional capabilities associated with it.
After studying the physics of qubits it is now time to look at the mathematics of qubits. Let us
start with the representation of qubit using Bloch sphere in a vector space. Later on we proceed
towards single qubit, multi qubit, tensor operation, operators and matrix representation
NOTE: Vector space is a set of elements (or vectors) which are added together or multiplied by real numbers.
Addition of two vectors or multiplication of a vector by a scalar is satisfied here. It should not be confused with
vector field
Bloch sphere
Bloch sphere is an imaginary sphere which is used to represent pure single-qubit states as a point
on its surface. It has unit radius. Its North Pole and South Pole are selected to represent the basis
states namely |0⟩ and |1⟩. North Pole represents |0⟩ (say spin up) and South Pole represents |1⟩
(say spin down ). All other points on the sphere represent superposed states (ie, state space).
Bloch sphere allows the state of a qubit to be represented in spherical coordinates (ie, r, and ).
It is as follows
The state qubit |ψ⟩ on the Bloch sphere makes an angle with z-axis and its projection (azimuth)
makes angle with x-axis as shown. It is clear from the fig that 0 < < and 0 < < 2. |ψ⟩ is
represented as
|ψ⟩ = α |0⟩ + β|1⟩
It can be proved that
|Ψ⟩ 𝜃 𝜃
= 𝑐𝑜𝑠 |0⟩ + 𝑒 𝑖𝜙 𝑠𝑖𝑛 |1⟩ − − − (1)
2 2
Using this equation we can represent |ψ⟩ for different and as follows
𝜋 𝜋
|Ψ⟩ = 𝑐𝑜𝑠 |0⟩ + 𝑒 𝑖0 𝑠𝑖𝑛 |1⟩
4 4
1 1
|Ψ⟩ = |0⟩ + |1⟩
√2 √2
|0⟩ + |1⟩
|Ψ⟩ =
√2
𝜋 𝜋
|Ψ⟩ = 𝑐𝑜𝑠 |0⟩ + 𝑒 𝑖𝜋 𝑠𝑖𝑛 |1⟩
4 4
1 1
|Ψ⟩ = |0⟩ − |1⟩
√2 √2
|0⟩ − |1⟩
|Ψ⟩ =
√2
In the above discussion we have represented only single qubit state. Bloch sphere is a nice
visualization of single qubit states.
Multiple Qubits
Single qubits are interesting, but individually they offer no computational advantage. We will now
look at how to represent multiple qubits, and how these qubits can interact with each other.
Two qubits
Consider two qubits. They can be in any one of four possible states represented as |00⟩, |01⟩, |10⟩ and
|11⟩. The interaction among these qubits is described by creating a new vector space2 using a special
kind of operation called tensor product or Kronecker product. It is as follows
2
Vector space is a set of elements (or vectors) which are added together or multiplied by real numbers or scalars.
Addition of two vectors or multiplication of a vector by a scalar is satisfied here. It should not be confused with vector
field
𝑥1𝑥2
𝑥1𝑦2
𝑈⊗𝑉=[ ]
𝑦1 2
𝑦1𝑦2
1] 1
|0⟩ ⊗ |0⟩ = [ 1 0 0
[ ]=[ ]
0 [10] 0
0
1
0
|00⟩ = [ ]
0
0
Similarly
0 0 0
|01⟩ = [1] |10⟩ = [0] and |11⟩ = [0]
0 1 0
0 0 1
For 2 qubit system we have 4 complex amplitudes namely 00, 01, 10 and 11. According to
normalization condition
Similarly if there are 3 qubits there will be 8 complex amplitudes and in general for n qubits we will
have 2n complex amplitudes. This means that a basis state is represented by a number 0 to 2n-1. The
superposition state is represented as
𝟐𝒏−𝟏
|⟩ = ∑ 𝖺𝒙 |x⟩
𝒙=𝟎
Qubit has two quantum states similar to the classical binary states. The qubit can be in any one of the
two states as well as in the superposed state simultaneously.
In Quantum mechanics, Brac-Ket notation is a standard notation for describing quantum states. The
notation | ⟩ is known as ‘ket’ notation and | is known as ‘brac’ notation. Both are together called as
Dirac notations.
The ‘ket’ vector typically represented as a column vector and ‘brac’ vector typically represented as a
row vector as follows
1 0
⟩ ⟩
|0 = [ ] |1 = [ ] − − − − − −ket notations 1
0
⟨0| = [1 0] ⟨1| = [0 1] − − − − − brac notations
iv. In a complex vector space for every ket there is unique brac. Brac is the Hermitian
conjugate of the ket.
𝐴
If |𝐴⟩ = [ 1] then ⟨𝐴| = [𝐴∗ 𝐴∗ ]
𝐴2 1 2
An operator is a mathematical rule that transform a given function into another function.
Ex:
i.
√4 = 2. Here is a square root operator. It transforms 4 to 2
𝑑
ii. 𝐷 = is a differentiate operator. It transforms 2x3 to 6x2
𝑑𝑥
Similar to this we have the following example. In this case operator ‘A’ transforms the vector |𝑎⟩
to another vector |𝑏⟩
𝐴̂|𝑎⟩ = |𝑏⟩
There are different types of operators like Linear operator, Identity operator, Null operator, Inverse
operator, Singular & non-singular operator etc.
The identity operator is an operator which, operating on a function, leaves the function unchanged
i.e.
𝐼 |𝑎⟩ = |𝑎⟩
It is given in matrix form by
1 0
𝐼=[ ]
0 1
This is also called as identity matrix. There will be no change when I operates on either |0⟩ state
or |1⟩ state. It is explained as follows
1 0 1 1
𝐼 |0⟩ = [ ] ]=[
0 1 0[ 0 ]
∴ 𝐼 |0⟩ = |0⟩
Similarly
1 0 0 0
𝐼 |1⟩ = [
] [ ] = [ 1]
0 1 1
∴ 𝐼 |1⟩ = |1⟩
Conjugate matrices
If the elements in a matrix A are complex numbers, then the matrix obtained by the
corresponding conjugate complex elements is called the conjugate of A and is denoted by 𝐴∗.
For ex
0 𝑖 0 −𝑖
If 𝐴 = [ ] then
−𝑖 0 𝐴 =[ ]
∗ 𝑖 0
If 𝐴 = [ 𝑖 2𝑖 + 1 ∗ −𝑖 −2𝑖 + 1
] then 𝐴 = [ ]
−𝑖 1 𝑖 1
1 2𝑖 1 −2𝑖
If 𝐴 = [ ] then 𝐴∗ = [ ]
4𝑖 + 1 0 −4𝑖 + 1 0
1 𝑖
If 𝐴 = [ ∗ 1 −𝑖
] then 𝐴 = [ ]
−𝑖 1 𝑖 1
Transpose matrices
If columns and rows of a matrix A are interchanged then the resultant matrix is transpose of A and
represented as AT. For ex,
0 1 0 −𝑖
If 𝐴 = [ ] then 𝐴𝑇 = [ ]
−𝑖 0 1 0
1 0
If 𝐴 = [ 𝑇 1 −2
] then 𝐴 = [ ]
−2 1 0 1
1 2𝑖 1 4𝑖 + 1
If 𝐴 = [ ] then 𝐴𝑇 = [ ]
4𝑖 + 1 0 2𝑖 0
Hermitian matrices
The transpose of complex conjugate of a matrix is known as Hermitian operator (also called as
adjoint operator) and the resultant matrix is known as Hermitian matrix. It is represented by 𝐴†
Let A be a matrix, A* be its complex conjugate and 𝐴∗𝑇 is its transpose then its Hermitian matrix is
𝐴† = 𝐴∗𝑇
Ex: 1 2𝑖 1 −2𝑖
If 𝐴 = [ ] then 𝐴∗ = [ ]
4𝑖 + 1 0 −4𝑖 + 1 0
1 −4𝑖 + 1
𝐴† = [−2𝑖 0 ]
Unitary matrices
Matrix A is said to be unitary if it produces an identity matrix I when multiplied by its conjugate
transpose
𝐴𝐴† = 𝐼
In other words, A is a unitary matrix if its conjugate transpose is equal to its reciprocal, ie
𝐼 1
𝐴† = = = 𝐴−1
𝐴 𝐴
1 1+𝑖 1−𝑖
we can show that 𝐴 = [ ] is a unitary matrix
2 1−𝑖 1+𝑖
Inner product
Introduction
Let 𝑈 = 𝑥1𝑖 + 𝑦1𝑗 + 𝑧1𝑘 and 𝑉 = 𝑥2𝑖 + 𝑦2𝑗 + 𝑧2𝑘 be the two vectors in real space then their dot
product is
𝑈. 𝑉 = 𝑥1𝑥2 + 𝑦1𝑦2 + 𝑧1𝑧2
If U = V then 𝑈. 𝑈 = |𝑈|2 = 𝑥2 + 𝑥2 + 𝑥2
1 2 3
The length of the resultant vector is |𝑈| = √𝑈. 𝑈 = √𝑥2 + 𝑦2 + 𝑧2
1 1 1
This dot product is also called as inner product. In real space inner product is same as dot product of
two vectors and it finally gives a scalar quantity.
In quantum computing the vectors are the members of complex space and the inner product gives a
complex number
The inner product of two vectors U and V in the complex space is a function that takes U and V
as inputs and produces a complex number as output
⟨𝑈|𝑉⟩ = 𝑐
𝑥1 𝑥2
Let |𝑈⟩ = [ ] and|𝑉⟩ = [ ] be the two vectors. Their inner product is written as ⟨𝑈|𝑉⟩
𝑦1 𝑦2
1 1 [𝑦 ] = 𝑥1𝑥2 + 𝑦1 𝑦2
2
The square root of the inner product of a vector with itself is also called as norm or the length of the
vector. It is given by
|𝑈| = √〈𝑈|𝑈〉
𝟑+𝒊 𝟑𝒊
𝐄𝐱: 𝐅𝐢𝐧𝐝 𝐭𝐡𝐞 𝐢𝐧𝐧𝐞𝐫 𝐩𝐫𝐨𝐝𝐮𝐜𝐭 𝐨𝐟|𝑼⟩ = [ 𝐚𝐧𝐝 |𝑽
𝒊 ⟩
𝟒−
First we shall find the conjugate transpose of |𝑈⟩
|𝑈∗⟩ 3−𝑖
=[ ]
4+𝑖
|𝑈⟩† = [3 − 𝑖 4 + 𝑖]
∴ ⟨𝑈| = |𝑈⟩† = [3 − 𝑖 4 + 𝑖]
⟨𝑈|𝑉⟩ = [3 − 𝑖 4 + 𝑖] [3𝑖]
4
⟨𝑈|𝑉⟩ = (3 − 𝑖) × 3𝑖 + (4 + 𝑖) × 4
⟨𝑈|𝑉⟩ = 9𝑖 + 3 + 16 + 4𝑖
⟨𝑈|𝑉⟩ = 13𝑖 + 19
𝒂
𝐄𝐱: 𝐅𝐢𝐧𝐝 𝐭𝐡𝐞 𝐢𝐧𝐧𝐞𝐫 𝐩𝐫𝐨𝐝𝐮𝐜𝐭 𝐨𝐟 |𝑨⟩ = [ ] 𝒘𝒊𝒕𝒉 𝒊𝒕𝒔𝒆𝒍𝒇
𝒊𝒃
𝟏−𝒊
𝐄𝐱: 𝐟𝐢𝐧𝐝 𝐭𝐡𝐞 𝐧𝐨𝐫𝐦 𝐨𝐟 |𝑼⟩ = [
𝟐 ]
|𝑈| = √〈𝑈|𝑈〉
|𝑈| = √[1 + 𝑖 2] [1 − 𝑖]
2
|𝑈| = √(1 + 𝑖)(1 − 𝑖) + 2 × 2 = √1 + 1 + 4 = √6
Orthogonality
If the inner product of two vectors is equal to 0 then they are said to be orthogonal (or perpendicular)
to each other
If ⟨𝑈|𝑉⟩ = 0 then |𝑈⟩ and |𝑉⟩ are perpendicular.
Consider,
1 0
⟩ ⟩
|0 = [ ] |1 = [ ]
1
0
Then
0
⟨0|1⟩ = [1 0] [ ] = 0
1
The most important property of the inner product of a vector with itself is equal to
This is known as normalization condition. The physical significance of normalization is that the
"probability amplitude" of the quantum system is1
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 (ortho + normalization = orthonormalization)
Pauli Matrices
These are the 2 × 2 complex matrices introduced by Pauli in order to account for the interaction of
the spin with an external electromagnetic field. They are given by
0 1
𝜎1 = 𝜎𝑗 = 𝑋 = [
]
1 0
0 −𝑖
𝜎 =𝜎 =𝑌= [ ]
2 𝑘 𝑖 0
1 0
𝜎 =𝜎 =𝑍= [ ]
3 0 −1
NOTE: X, Y and Z are also called as X – gate, Y- gate and Z- gate
Properties of Pauli matrices
The most important property of Pauli matrices is that square of all the three matrices gives
an identity matrix I. For ex,
2 0 1 0 1 1 0
𝜎1 = [ ][ ]=[ ]
1 0 1 0 0 1
∴ 𝜎2 = 𝐼
1
In general
𝜎𝜎 = 1 †
1
𝜎† = = 𝜎−1
𝜎
So, they are unitary
Another property of Pauli matrices is that they are Hermitian. Let A be a matrix, A* be its complex
conjugate and 𝐴† 3 is its transpose. If A = 𝐴†then the matrix is Hermitian. For ex,
0 −𝑖
𝜎 =[ ]
2 𝑖 0
0 𝑖
𝜎 ∗
=[ ]
2 −𝑖 0
0 −𝑖
𝜎 †
=[ ]
2 𝑖 0
∴ 𝜎2† = 𝜎2
Three Pauli matrices X, Y and Z act on basis states |0 and |1 as follows
Since X inverts each input (ie, |0 becomes |1 and |1 becomes|0) it is also called as bit-flip gate
If a superposed qubit goes through X gate, the result will be
0 1 𝛼 𝛽
𝑋|Ψ⟩ = [ ⟩ ⟩
] [ ] = [ ] = 𝛼|1 + 𝛽|0
1 0 � 𝛼
So,
𝑋|Ψ⟩ = 𝛼|1⟩ + 𝛽|0⟩
3
Transpose means convert rows into column and columns into row
ii. Y operating on |0 and |1
⟩ 0 −𝑖 1 0 × 1 + (−𝑖) × 0 0+0 0 0
𝑌|0 = [ ][ ]=[ 𝑖×1+0×0 ]=[ ] = [ ] = 𝑖 [ ] = 𝑖|1 ⟩
𝑖 0 0 𝑖+0 1
𝑌|1 = [ 0 −𝑖 ] [0 ] = [0 × 0 + (−𝑖) × 1 ] = [ 0 − 𝑖 ] = [ −𝑖 1
⟩ 𝑖 ] = −𝑖 [ 0] = −𝑖|0 ⟩
0 1 𝑖×0+0×1 0+0
So, 0
𝑌|0⟩ = 𝑖|1⟩
Similarly
𝑌|1⟩ = −𝑖|0⟩
⟩ 1 0 ] [1 ] = [ 1 × 1 + 0 × 0 ] = [ 1 + 0 1
𝑍|0 = 0 × 1 + (−1) × 0 ] = [ ] = |0 ⟩
[
0 −1 0 0+0 0
𝑍|1⟩ = −|1⟩
𝑍|Ψ = [1 0 ] [𝛼] = [ 1 × 𝛼 + 0 × 𝛽 𝛼
] = [ ] = 𝛼|0⟩ − 𝛽|1⟩
⟩ 0 −1 𝛽 0 × 𝛼 + (−1) × 𝛽 −𝛽
So,
𝑍|Ψ⟩ = 𝛼|0⟩ − 𝛽|1⟩
𝛼|0⟩ + 𝛽|1⟩
X 𝛼|1⟩ + 𝛽|0⟩
Y
𝛼|0⟩ + 𝛽|1⟩ 𝑖𝛼|1⟩−𝑖𝛽|0⟩
Z
𝛼|0⟩ + 𝛽|1⟩ 𝛼|0⟩ − 𝛽|1⟩
Using only the Pauli-gates it is impossible to move our initialized qubit to any state other than |0⟩ or |1⟩,
i.e. we cannot achieve superposition. This means we can see no behaviour different to that of a
classical bit. To create more interesting states we need more gates
Quantum Gates
In classical computers gates are a small set of circuit elements that are used to implement the
combination of binary variables 0’s and 1’s. Most commonly known gates are AND gate, OR gate
and NOT gate.
A quantum gate, a counterpart of classical gate, is a very simple computing device that performs
quantum operation on qubits. Quantum gates are one of the essential parts of a quantum computer
and are the building blocks of all quantum algorithms.
Quantum gates are mathematically represented as transformation matrices that are unitary and the
operations performed by these gates are reversible. Each unitary transformation U has inverse
transformation 𝑈† so that
𝑈𝑈† = 𝐼
𝐼 1
𝑈† = = = 𝑈−1
𝑈 𝑈
Now, the basic question is that why quantum gates shall be unitary in nature? It can be explained as
follows
A fundamental property of qubits is that they are restricted by the normalization condition, i.e. sum of
amplitudes square is equal 1.
𝑖𝑒, |𝖺|2 + |𝛽|2 = 1
Quantum gates operate on set of qubits and transform them to another quantum state. These
operations must preserve the normalization throughout the whole process. The only possible
operation for this purpose is unitary matrices. Hence the quantum gates are inevitably unitary
Another important feature of quantum gate is that they are always reversible. The outputs can be
calculated from inputs and inputs can be retrieved from outputs. This is because all unitary matrices
are reversible as explained earlier
Note:
1. If the product of a number and its reciprocal is equal to 1, then the number is reversible. For
ex
1
2× =1
2
There are different types of quantum gates. Single-qubit gates can flip a qubit from 0 to 1 as well as
allowing superposition states to be created. Two-qubit gates allow the qubits to interact with each
other and can be used to create quantum entanglement (a strange phenomenon that can’t be
explained by classical physics).
Some of the important single qubit gates are discussed here. They all are represented by 2 × 2 matrix.
(Note that X, Y and Z gates are already discussed earlier under the heading Pauli’s matrices. So, it is
a sort of repetition)
1. X – Gate
When X operates on |0 and |1 the output will be inverted (ie, |0 becomes |1 and |1 becomes|0)
0 1 1 0
𝑋|0⟩ = [ ⟩
1 0 ]0 ] 1 ]=
0 1 0 1
𝑋|1⟩ = [ ⟩
1 0 ]1 ] 0 ]=
Since X inverts each input it is also called as bit-flip gate. If a superposed qubit goes through X gate,
the result will be
0 1 𝛼 𝛽
𝑋|Ψ⟩ = [ ⟩ ⟩
] [ ] = [ ] = 𝛼|1 + 𝛽|0
1 0 � 𝛼
So,
𝑋|Ψ⟩ = 𝛼|1⟩ + 𝛽|0⟩
𝛼|0⟩ + 𝛽|1⟩
X 𝛼|1⟩ + 𝛽|0⟩
2. Y – Gate
⟩ 0 −𝑖 0 0 × 0 + (−𝑖) × 1 −𝑖 1
𝑌|1 = [ ][ ]=[ 𝑖×0+0×1 ] = [ ] = −𝑖 [ ] = −𝑖|0 ⟩
𝑖 0 1 0 0
So,
𝑌|0⟩ = 𝑖|1⟩ and 𝑌|1⟩ = −𝑖|0⟩
𝛼|0⟩ + 𝛽|1⟩
Y 𝑖𝛼|1⟩−𝑖𝛽|0⟩
3. Z – Gate
1 0
𝑍= [ ]
0 −1
When Z operates on |0 and |1 the phase will change. Hence this is also called as phase-flip gate
⟩ 1 0 ] [1 ] = [ 1 × 1 + 0 × 0 ] = [ 1
𝑍|0 = 0 × 1 + (−1) × 0 ] = |0 ⟩
[
0 −1 0 0
1×0+0×1 ]=[ 0 0
𝑍|1 = [10 0 0
−1 ] [1] = [ 0 × 0 + (−1) × 1
⟩
⟩ ] = − [ ] = −|1
So, −1 1
𝑍|Ψ = [1 0 ] [𝛼] = [ 1 × 𝛼 + 0 × 𝛽 𝛼
] = [ ] = 𝛼|0⟩ − 𝛽|1⟩
⟩ 0 −1 𝛽 0 × 𝛼 + (−1) × 𝛽 −𝛽
So,
𝑍|Ψ⟩ = 𝛼|0⟩ − 𝛽|1⟩
𝛼|0⟩ + 𝛽|1⟩
Z 𝛼|0⟩ − 𝛽|1⟩
The truth tables for X, Y and Z gates are as follows
X- gate Y-gate Z-gate
Input Output Input Output Input Output
|0⟩ |1⟩ |0⟩ 𝑖|1⟩ |0⟩ |0⟩
|1⟩ |0⟩ |1⟩ −𝑖|0⟩ |1⟩ −|1⟩
𝛼|0⟩ + 𝛽|1⟩ 𝛼|1⟩ + 𝛽|0⟩ 𝛼|0⟩ + 𝛽|1⟩ 𝑖𝛼|1⟩−𝑖𝛽|0⟩ 𝛼|0⟩ + 𝛽|1⟩ 𝛼|0⟩ − 𝛽|1⟩
The Hadamard Gate is a well-known gate that brings a qubit into a superposition state. Similar to the
Pauli-X gate, the Hadamard Gate acts on a single qubit, and can be represented by a 2 x 2 matrix as
follows
1
(11
𝐻= 1
−1 )
√
2
Let us find out what happens when Hadamard gate operates on a qubit that is in the |0⟩ state.
1 1 1 1 1 1×1+1×0 1 1
𝐻|0⟩ = ( ) [ ]= [ ]= [ ]
√2 1 −1 0 √2 1 × 1 + −1 × 0 √2 1
1 1 1 |0⟩ + |1⟩
𝐻|0⟩ = ]= (|0⟩ + |1⟩) =
√ [1
√2 √2
2
|0⟩ + |1⟩
𝐻|0⟩ = − − − (1)
√2
Let us find out what happens when Hadamard gate operates on a qubit that is in the |1⟩ state.
1 1 1 0 1 1×0+1×1 1 1
𝐻|1⟩ = ( ) [ ]= [ ]= [ ]
√2 1 −1 1 √2 1 × 0 + −1 × 1 √2 −1
1 1 1 |0⟩ − |1⟩
𝐻|1⟩ = [
]= (|0⟩ − |1⟩) =
√2 −1 √2 √2
|0⟩ − |1⟩
𝐻|1⟩ = − − − (2)
√2
1 1 1 𝛼 1 11××𝛼𝛼++−1
1 ××𝛽𝛽 1 𝛼𝛼 −
+ 𝛽𝛽
𝐻|𝜓⟩ = ( ) [𝛽] = [ ]= [ ]
√2 1 −1 √2 √2
𝐻|𝜓⟩ = 𝛼 + 𝛼−
𝛽 |0⟩ + 𝛽 |1⟩
√2 √2
|0⟩ + |1⟩ |0⟩ − |1⟩
𝐻|𝜓⟩ = +𝛽 − − − (3)
𝛼 √ √
2 2
The above equations shows that, after applying the Hadamard gate to a qubit that are in |0⟩ & |1⟩
states enter a new superposed states. This is the major difference between X, Y, Z and H gates. In X,
Y and Z gates we get only single state whereas in H gate we get superposed state.
INPUT OUTPUT
|0⟩ + |1⟩
|0⟩
√2
|0⟩ − |1⟩
|1⟩
√2
|0⟩ + |1⟩ |0⟩ − |1⟩
|𝜓⟩ = 𝛼|0⟩ + 𝛽|1⟩ 𝛼 +𝛽
√2 √2
H
|0⟩ + |1⟩ |0⟩ − |1⟩
𝛼|0⟩ + 𝛽|1⟩ 𝛼 +𝛽
√ √
5. Phase Gate (S Gate)
The Phase gate or S gate is a gate that transfers |0⟩ into |0⟩ and |1⟩ into 𝑖|1⟩. It is represented as
1 0
𝑆=[
0 𝑖 ]
Input Output
|0⟩ |0⟩
|1⟩ 𝑖|1⟩
𝛼|0⟩ + 𝛽|1⟩
6. T- Gate
S 𝛼|0⟩ + 𝑖𝛽|1⟩
1 0
𝑇=[ 𝑖𝜋 ]
0 𝑒4
1 0 1 1
𝑇|0⟩ = [ 𝑖𝜋] [0 ] = [ 0]
0 𝑒 4
𝑇|0⟩ = |0⟩
𝑖𝜋
If the input is |1⟩ then the output state is 𝑒 4 |1⟩
1 0 0 0
] = 𝑒 4 [0 ]
𝑖𝜋
𝑇|1⟩ = [ 𝑖𝜋 ][ ]= 𝑖𝜋
[
0 𝑒4 1 1
𝑒( 4 )
𝑖𝜋
𝑇|1⟩ = 𝑒 4 |1⟩
1 0 𝛼 𝛼
𝑇|𝜓⟩ = [ 𝑖𝜋] [ ] = [
𝛽
𝑖𝜋]
0 𝑒4 𝛽𝑒 4
The following figure shows quantum T- gate and the table gives the truth table.
𝛼|0⟩ + 𝛽|1⟩
T 𝛼|0⟩ + 𝑒𝑖𝜋⁄4𝛽|1⟩
The truth table is as follows
Input Output
|0⟩ |0⟩
𝑖𝜋
|1⟩ 𝑒 4 |1⟩
𝛼|0⟩ + 𝛽|1⟩ 𝛼|0⟩ + 𝑒𝑖𝜋⁄4𝛽|1⟩
The CNOT gate is a two-qubit operation, where the first qubit is referred as the control qubit (A) and
the second qubit as the target qubit (B). If the control qubit is |1⟩ then it will flip the target qubit
state from|0⟩ to |1⟩ or from |1⟩ to |0⟩. When the control qubit is in state |0⟩ then the target qubit
remains unchanged. In fact CNOT applies X on target whenever its control is in state |1⟩
The symbolic representation is as follows. The upper line represents control qubit and bottom line
represents target qubit
In the combined qubit, first term is control qubit and the second term is target qubit. For ex, in |𝐴𝐵⟩,
A is control qubit and B is target qubit
1. Input state |00⟩ (Control qubit = 0, Target qubit = 0): Both the bits remain unaltered. Hence,
the output state is the same as the input state or |00⟩ → |00⟩
2. Input state |01⟩ (Control qubit = 0, Target qubit = 1): Both the bits remain unaltered. Again,
the output state is the same as the input state or |01⟩ → |01⟩
3. Input state |10⟩ (Control qubit =1, Target qubit = 0): The target qubit is flipped to 1.
Therefore, the output state has both qubits 1 or |10⟩ → |11⟩
4. Input state |11⟩ (Control qubit =1, Target qubit = 1): The target qubit is flipped to 0.
Therefore, the output state becomes |10⟩ or |11⟩ → |10⟩.
The truth table of a CNOT gate is as follows
Input Output
|00⟩ |00⟩
|01⟩ |01⟩
|10⟩ |11⟩
|11⟩ |10⟩
We know that two qubits can be in any one of four possible states represented as |00⟩ |01⟩|10⟩ and |
11⟩. The matrix form of them are
1 0 0 0
0 1
|00⟩ = [ ] |01⟩ = [ ] 0 0
|10⟩ = [ ] |11⟩ = [ ]
0 0 1 0
0 0 0 1
The state qubit is |⟩ = 00|00⟩ + 01|01⟩ + 10|10⟩ + 11|11⟩. When it is operated by CNOT we
get CNOT( 00|00⟩ + 01|01⟩ + 10|10⟩ + 11|11⟩) = 00|00⟩ + 01|01⟩ + 10|11⟩ + 11|10⟩
From this we can construct the matrix form of CNOT gate as follows (it is 4 ×4 matrix)
1
0
The |00⟩remains same as |00⟩. Hence the first column is [ ]
0
0
0
The |01⟩remains same as |01⟩. Hence the second column is [1]
0
0
0 0
0 0
The |10⟩changes to |11⟩. Hence the third column changes from [ ] to [ ]
1 0
0 1
0 0
The |11⟩changes to |10⟩. Hence the fourth column changes from [0] to [0]
0 1
1 0
Hence the matrix form of CNOT gate is
1 0 0 0
𝐶𝑁𝑂𝑇 = [0 1 0 0]
0 0 0 1
0 0 1 0
1 0 0 0 1
CNOT|00⟩ = [0 1 0 0] [0]
0 0 0 1 0
0 0 1 0 0
1+0+0+0 1
CNOT|00⟩ = [0 + 0 + 0 + 0] = [0]
0+0+0+0 0
0+0+0+0 0
∴ CNOT|00⟩ = |00⟩
1 0 0 0 0
CNOT|01⟩ = [0 1 0 0] [1]
0 0 0 1 0
0 0 1 0 0
1+0+0+0 0
CNOT|01⟩ = [0 + 1 + 0 + 0] = [1]
0+0+0+0 0
0+0+0+0 0
∴ CNOT|01⟩ = |01⟩
1 0 0 0 0
CNOT|10⟩ = [0 1 0 0] [0]
0 0 0 1 1
0 0 1 0 0
0+0+0+0 0
CNOT|10⟩ = [ 0 + 0 + 0 + 0 0
]=[ ]
0+0+0+0 0
0+0+1+0 1
∴ CNOT|10⟩ = |11⟩
1 0 0 0 0
CNOT|11⟩ = [0 1 0 0] [0]
0 0 0 1 0
0 0 1 0 1
0+0+0+0 0
CNOT|11⟩ = [ 0 + 0 + 0 + 0 0
]=[ ]
0+0+0+1 1
0+0+0+0 0
∴ CNOT|11⟩ = |10⟩
2. Swap Gate
In quantum computation sometimes we need to move state between two qubits, ie from control to
target and vice versa. This is nothing but swapping of the states and the gate used for this purpose is
known as SWAP gate.
SWAP gate is a two qubit operation gate and swaps the state of the two qubits involved in the
operation. It contains 3 CNOT gates.
The action of SWAP gate is explained by taking two CNOT gates as follows where |10⟩ is swapped to
|01⟩
But for effective swapping of the states there must be minimum of 3 CNOT gates. The SWAP circuit
is as given below
It is also represented as
1 0 0 0
𝑆𝑊𝐴𝑃 = [0 0 1 0]
0 1 0 0
0 0 0 1
Ex (1) S.T the state |00⟩ remains undisturbed by the SWAP gate operation
1 0 0 0 1 1+0+0+0 1
0 0 1 0] [0] = [0 + 0 + 0 + 0] = [0]
𝑆𝑊𝐴𝑃|00⟩ = [
0 1 0 0 0 0+0+0+0 0
0 0 0 1 0 0+0+0+0 0
∴ 𝑆𝑊𝐴𝑃|00⟩ = |00⟩
Ex (2) S.T the state |10⟩ is swapped to |01⟩ by SWAP gate operation
1 0 0 0 0 0+0+0+0 0
0 0 1 0 0 0 + 0 + 1 + 0 1
𝑆𝑊𝐴𝑃|10⟩ = [ ][ ] = [ ]=[ ]
0 1 0 0 1 0+0+0+0 0
0 0 0 1 0 0+0+0+0 0
∴ 𝑆𝑊𝐴𝑃|10⟩ = |01⟩
Input Output
|00 |00
|01 |10
|10 |01
|11 |11
3. Controlled-Z Gate
CNOT gate can be extended in a way that it can work on two qubits based upon a single control
qubit. C-Z gate is one such gate. In this gate there is one control qubit and Z unitary matrix as target
qubit. If the control qubit is in state |1 then it acts on target Z and will flip the state (ie, there is 180 0
phase change)
|0 |0
|1
Z |1 |0 Z|0 |1
Z -|1
Z Control bit acts on Control bit acts on
No change
No change because control target but there is no target and flip |1 to
because control bit is |0 flip of |0 -|1
bit is |0
Input Output
|00 |00
|01 |01
|10 |10
|11 -|11
1 0 0 0
𝑈 = [ 00 1 0 0 ]
� 0 1 0
0 0 0 −1
Ex (1): S.T the state |10 remains un affected when operated by C-Z gate
1 0 0 00 0+0+0+0 0
0 1 0 00 0 + 0 + 0 + 0 0
𝑈𝑍|10⟩ = [ ][ ] = [ ]=[ ]
0 0 1 0 1 0+0+1+0 1
0 0 0 −1 0 0+0+0+0 0
∴ 𝑈𝑍|10⟩ = |10⟩
Ex (2): S.T the state |11 flips to - |11 when operated by C-Z gate
1 0 0 0 0 0+0+0+0 0
0 1 0 0
𝑈𝑍|11⟩ = [ ] [ ] = [0 + 0 + 0 + 0] = − [0]
0
0 0 1 0 0 0+0+0+0 0
0 0 0 −1 1 0+0+0−1 1
∴ 𝑈𝑍|11⟩ = − |11⟩
4. Toffoli Gate
The Toffoli gate or controlled-controlled-NOT (CCNOT) gate is a logic gate having three input
qubits. 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 (ie, changes from 0 to 1 or 1 to 0) if both the control bits are 1;
else it does not change.
The circuit and the truth table are as follows
A A/ Input Output
A B C A /
B/ C/
0 0 0 0 0 0
B B/ 0 0 1 0 0 1
0 1 0 0 1 0
0 1 1 0 1 1
C C/ 1 0 0 1 0 0
1 0 1 1 0 1
1 1 0 1 1 1
1 1 1 1 1 0
|0 |0
|1 |1 | |1 | |1
1 1
|0 |0
|1 |1 | |1 | |0
0 1
1 0 0 0 0 0 0 0
𝖥
0 1 0 0 0 0 0 01
0 0 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 0 1 0 0
I0 0 0 0 0 0 0 1 I
. [0 0 0 0 0 0 1 0 ]
NOTE:
This is a reversible (no information is lost) and universal (all reversible logic circuits can
be built using Toffoli gates).
It can be verified that this matrix is unitary and thus the Toffoli gate is a legitimate
quantum gate. The quantum Toffoli gate can be used to simulate irreversible classical
logic gates and ensures that the quantum gates are capable of performing any
computation that a classical computer can do
As of now there are some technical difficulties and limitations in building quantum computers. Some
of them are
As the number of quantum gates in a network increases, more interacting qubits are involved,
and it is very difficult to monitor their interactions
The surrounding environment will affect the interactions of qubits (both superposition and
entanglement). As a result the quantum information will spread outside the quantum
computer and be lost into the environment, thus spoiling the computation. This process is
called de- coherence. How long quantum information will survive before it is spread out is
known as de- coherency time
The number of operations that can be performed before the information is lost due to de-
coherency is therefore limited.
Quantum chips must be kept at very low temperature to create super positions and
entanglement of qubits
The final output of the quantum computers is in the form of a probability. When the question
is repeated, the answer changes. Hence repeated operations are required to get correct
answer.
Some physicists are pessimistic about the prospects of substantial further progress in quantum
computer technology. Some optimistic researchers believe that practical quantum computers will
appear in a matter of years rather than decades. We tend towards the optimistic end because