Module 3 Quantum Computing Quantum Gates
Module 3 Quantum Computing Quantum Gates
1|P age
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
Introduction
Quantum Computing is the area of study focused on developing computing methods based on the
principle of quantum theory. Quantum Physics explains the nature and behaviour of energy and
matter on the quantum (atomic and subatomic) scale. Elementary particles such as protons,
neutrons and electrons can exist in two or more states at a time. This fundamental behaviour is
utilized in designing the quantum computation processing units. Quantum computing uses a
combination of bits of 1’s, 0’s and both 1 and 0 at a time to perform computational tasks with
greater efficiency.
In Quantum computing, the information is encoded in quantum system such as atoms, ions or
quantum dots.
According to Moore’s law, the number of transistors per integrated circuit chip is doubles
approximately every 18 – 24 months. The present limit is approximately 10 8 transistors per chip and
the typical size of circuit components is of the order of 100 nanometers. 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
2|P age
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
alternative ways of computing methods. 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 problems of classical computing.
3|P age
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
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’ are analogous to a column vector. They are also
called basis vectors and represented by two-dimensional column vectors as follows
⟩ ⟩
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. 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⟩
Superposition of two states:
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 |∝|2 is the probability of finding | ⟩ in state |0⟩ and
| |2 is the probability of finding | ⟩ in state |1⟩.
So, that when a qubit is measured, it only gives either ‘0’ or ‘1’ as the measurement result –
probabilistically.
Consider the following example of qubit representation
⟩ ⟩ ⟩
∴∝= =
|∝|2 = | |2 = 1/2
4|P age
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
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.
3. Unlike classical bits, qubit can work with the overlap of both 0 & 1 states.
For ex, a 4-bit register can store one number from 0 to 15 (because of 2 n = 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.
5|P age
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
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
|Ψ⟩ = ( /2) |0⟩ + ( /2) |1⟩ − − − (1)
Using this equation we can represent |ψ⟩ for different and as follows
Case-1: let = 0 and = 0, then eq (1) becomes
0
|Ψ⟩ = 0|0⟩ + 0|1⟩ = |0⟩ + 0
∴ |Ψ⟩ = |0⟩
Case-2: let = and = 0, then eq (1) becomes
0
|Ψ⟩ = ( /2)|0⟩ + ( /2)|1⟩ = 0 + |1⟩
∴ |Ψ⟩ = |1⟩
Case-3: let = /2 and = 0, then eq (1) becomes
0
|Ψ⟩ = ( /4)|0⟩ + ( /4)|1⟩
⟩ ⟩ ⟩
⟩ ⟩
⟩
⟩ ⟩ ⟩
⟩ ⟩
⟩
In the above discussion we have represented only single qubit state. Bloch sphere is a nice
visualization of single qubit states.
6|P age
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
⟩ ⟩
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.
The ‘ket’ vector typically represented as a column vector and ‘bra’ vector typically
represented as a row vector. The matrix for of the states |0⟩ and |1⟩ as follows;
⟩ ⟩ ket notations
7|P age
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
Identity operator I :
The identity operator is an operator which, operating on a function, leaves the function
unchanged i.e. | ⟩ = | ⟩ It is given in matrix form by
This is also called as identity matrix. There will be no change when I operate on either |0⟩
state or |1⟩ state. It is explained as follows
∴ ⟩ ⟩
Similarly
∴ ⟩ ⟩
Identity matrix acts as number 1. It is always a square matrix.
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 example
∗
if then
∗
if then
Transpose matrices
If columns and rows of a matrix A are interchanged then the resultant matrix is transpose of A and
represented as AT .
8|P age
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
For example ,
∗
if then
∗
if then
Hermitian matrices:
The transpose of complex conjugate of a matrix is known as Hermitian 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 = ∗T
∗
if then
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
∗ ∗
Here,
Thus the Bra is the complex conjugate of ket and vice versa.
9|P age
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
Inner product: 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.
In terms of Dirac notation, the inner product is given as ⟨ | ⟩ = C
In matrix form U and V are written a
⟩ ⟩
∴⟨ | ⟩=[ 1
∗ ∗
1 ] = ∗
1 2 + ∗
1 2
The square root of the inner product of a vector with itself is also called as norm or the
⟩ ⟩
⟩
∴ ⟨ |= ⟩ =
∗ ∗
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,
⟩ ⟩
⟨ ⟩
10 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
The most important property of the inner product of a vector with itself is equal to one ie,
⟨ | ⟩=1
This is known as normalization condition. The physical significance of normalization is that
the "probability amplitude" of the quantum system
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.
⟨ ⟩ normalized
⟨ ⟩ orthogonal
⟨ ⟩ normalized
⟨ ⟩ orthogonal
Probability
Let us consider a Quantum State
| ⟩= |0⟩ + |1⟩
⟨ ⟩ ∗ ∗ ∗ ∗
∗ ∗
∗
This could also be written as
Thus the above equation represents Probability Density. As per the principle of
Normalization
∗ ⟨ ⟩
Thus it implies | ⟩ is normalized.
11 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
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
Similarly,
Since X inverts each input (ie, |0 becomes |1 and |1 becomes|0).
12 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
⟩
⟩
Y operating on |0 and |1
If a superposed qubit goes through Y gate, the result will be
⟩
⟩
Z operating on |0 and |1
If a superposed qubit goes through Y gate, the result will be
⟩
⟩
Quantum Gates:
A quantum 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.
13 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
There are different types of quantum gates. Single-qubit gates and multiple qubit gates.
These gates can flip a qubit from 0 to 1 as well as allowing superposition states to be
created.
Single-Qubit Gates:
Single qubit inputs are |0⟩ to |1⟩ and can be represented by matrix forms as
Single Qubit Gates are X- gate, Y-gate, Z- gate, H –gate, S-gate, T-gate.
Action of the X-gate on inputs: When X gate operates of inputs |0, |1, ⟩;
When X operates on |0 and |1 the output will be inverted (ie,|0 becomes |1 and
|1 becomes|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
⟩
⟩
Gate representation is
14 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
Truth table is
X -gate
Input Output
|0⟩ |1⟩
|1⟩ |0⟩
|0⟩ + |1⟩ |1⟩ + |0⟩
2. Y – Gate : Y-gate is the single qubit input gate. This is also called as Pauli Y – gate.
The matrix form of Y gate is
If a superposed qubit goes through Y gate, the result will be
⟩
⟩
Gate representation is
Truth table is
Y -gate
Input Output
|0⟩ |1⟩
|1⟩ − |0⟩
|0⟩ + |1⟩ |1⟩− |0⟩
15 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
3. Z – Gate : Z-gate is the single qubit input gate. This is also called as Pauli Z – gate.
The matrix form of Z gate is
Action of Z gate on inputs: When Z operates on |0 and |1 the phase will change.
Hence this is also called as phase-flip gate
If a superposed qubit goes through Y gate, the result will be
⟩
⟩
Gate representation is
Z-gate
Input Output
|0⟩ |0⟩
|1⟩ -|1⟩
|0⟩ + |1⟩ |0⟩ − |1⟩
superposition. H gate acts on single qubit input and produce superposition state
output. Matrix form of H gate and its symbol is
16 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
⟩ ⟩
⟩ ⟩
Let us find out what happens when Hadamard gate operates on a qubit that is in the
|1⟩ state.
⟩ ⟩
⟩ ⟩
⟩ ⟩
⟩ ⟩ ⟩ ⟩
Gate representation is
|0⟩ + |1⟩ H ⟩ ⟩ ⟩ ⟩
o
The truth table is as follows
Input Output
⟩ ⟩
|0⟩
⟩ ⟩
|1⟩
⟩ ⟩ ⟩ ⟩
|0⟩ + |1⟩
17 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
⟩
⟩
If S gate apply to a state |1⟩ it will be transformed into |1⟩
⟩
⟩
S gate apply to the state |0⟩ + |1⟩ it transforms to the state |0⟩ + |1⟩
⟩ ⟩
The S gate representation is as follows
|0⟩ + |1⟩ S ⟩ ⟩
Input Output
18 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
⟩
⟩
If T gate operates on input is |1⟩ then the output is also |1⟩
⟩
⟩
If T gate operates on superposed state |0⟩ + |1⟩, It transforms to |0⟩ +
|1⟩
⟩ ⟩
⟩ ⟩
T Gate representation is
|0⟩ + |1⟩ T ⟩ ⟩⟩
Multiple Qubit gates: Quantum gates operating on multiple qubits are called as multiple
qubit gates. Multiple Qubit Gates operate on Two or More input Qubits. Multiple qubit
consists of control gate and target gate. The action of gate as follows;
i) The Target qubit is altered only when the control qubit is |1⟩, and
For three qubits, inputs qubits are |000⟩, |001⟩, |010⟩, |011⟩, |100⟩, |101⟩, |110⟩ and |111⟩
19 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
In multiple qubit gate, the input qubit applied in the form like | ⟩, first term | ⟩ goes to
control qubit and the second term | ⟩ goes to target qubit.
Some of the multiple qubit gate are as follows; Controlled gate (CNOT gate), Swap gate,
Controlled Z gate and Toffoli gate (CCNOT gate)
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
Matrix form of CNOT Gate is given by
20 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
Input Output
|00⟩ ⟩
|01⟩ ⟩
|10⟩ ⟩
|11⟩ ⟩
2. 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 Matrix representation of the Swap Gate is as follows
The schematic symbol of swap gate circuit and its equivalent is shown in figure below.
21 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
The swap gate is a combined circuit of 3 CNOT gates (1 st CNOT gate, 2nd CONT gate and
3rd CNOT gate) and the overall effect is that two input qubits are swapped at the output.
Gate representation is
2 ⊕ ⟩ ⊕ ⟩
3 ⊕ ⟩ ⟩
Truth table of the swap gate
Input Output
|00⟩ ⟩
|01⟩ ⟩
|10⟩ ⟩
|11⟩ ⟩
22 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
Control Qubit. If the control Qubit is | ⟩ = |1⟩ then only the Z gate transforms the Target
Qubit | ⟩ as per the Pauli-Z operation. The action of Controlled Z-Gate could is specified
by a matrix as follows.
Input Output
|00⟩ ⟩
|01⟩ |01⟩
|10⟩ |10⟩
|11⟩ ⟩
23 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
4. Toffoli Gate:
The Toffoli Gate is also known as CCNOT Gate (Controlled-Controlled-Not). It has
three inputs out of which two are Control Qubits and one is the Target Qubit. The
Target Qubit flips only when both the Control Qubits are |1⟩. The two Control
Qubits are not altered during the operation.
Gate representation:
|a⟩ |a’⟩
==
|a’ |b⟩ |b’⟩
|c⟩ ⟩
|c’⟩=
24 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
25 | P a g e
MODULE 3 : Quantum Computing & Quantum Gates CSE streams:2022scheme
∗
17. Given ⟩ and ⟩ prove that
26 | P a g e