Quantum computing
Quantum computing
DEPARTMENT OF PHYSICS
Course Title: Applied Physics
Course Code: P22PHCS102/202
Unit – V
Quantum Computing Notes
2024-25
1
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
Syllabus
Wave Function in Ket Notation: Matrix form of wave function, Identity Operator, Pauli Matrices
(its operations on 0 and 1 states), Mention of Conjugate and Transpose, Unitary Matrix U, Examples:
Row and Column Matrices and their multiplication (Inner Product), Probability, Orthogonality.
Quantum computers: Difference between classical and quantum computers, Moore’s law and its
end. Dirac bracket notations, Qubits and their different types, Bloch sphere, quantum logic gates: single
qubit logic gates - Quantum Not Gate, Pauli - Z Gate, Hadamard Gate, Phase Gate (or S Gate), T Gate.
Multi qubit logic gates - Controlled gate, CNOT Gate and 4 different input states. Representation of Swap
Practical component:
2
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
A matrix is a set or group of numbers arranged in a square or rectangular array enclosed by two brackets.
4 2 𝑎 𝑏
Example: [1 −1] [ ] [ ]
−3 0 𝑐 𝑑
Matrix algebra has at least two advantages:
Order of Matrix:
Matrices are defined as a rectangular array, it is two dimensional. Basically, a two dimensional matrix
consists of the number of rows (m) and number of columns (n). Order of matrix is equal to 𝑚 × 𝑛 (also
pronounced as m by n).
1 2 3
Example: [ ]
4 5 6 2×3
Square Matrix: A matrix where the number of rows and columns are equal.
2 3 𝑖
Example: [6 3 1]
0 2 5 3×3
Column Matrix: A matrix with one column and any number of rows.
2
Example: [ 3 ]
−𝑖 3×1
Row Matrix: A matrix with one row and any number of columns.
3
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
Matrix Operations:
Matrix operations mainly involve three algebraic operations which are addition, subtraction and
multiplication.
To add or subtract matrices the order of matrix must be identical and for matrix multiplication the number
of columns in the first matrix equals the number of rows in the second matrix.
If A[𝑎𝑖𝑗 ] and B[𝑏𝑖𝑗 ] are two matrices of the same order, then sum A+B or difference A-B is a
𝑚×𝑛 𝑚×𝑛
matrix and each element of that matrix is the sum or difference of the corresponding elements.
Example: consider the two matrices A and B of the order 2× 2. Then the sum is given by:
1 2 3 2 1+3 2+2 4 4
A+B = [ ]+[ ]=[ ]=[ ]
−1 4 1 5 −1 + 1 4+5 0 9
Example: consider the two matrices A and B of the order 2× 2. Then the difference A-B is given by:
1 2 3 2 1−3 2−2 −2 0
A-B = [ ]+[ ]=[ ]=[ ]
−1 4 1 5 −1 − 1 4−5 −2 −1
Properties of matrix addition /subtraction: If A, B and C are matrices of same order, then
Scalar Multiplication: Each entry in the matrix is multiplied by the given scalar.
1 2 3 3 6 9
A = 3[ ]= [ ]
0 −1 −2 0 −3 −6
2 2
A = [4 5 8]1×3 & B = [6] A× 𝐵 = [4 5 8] × [6] = [4(2) 5(6) 8(9)] = [110]1×1
9 3×1 9
If A and B are the row and column vectors, the inner product/dot product of the vectors are always a
scalar or 1× 1 matrix.
4
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
Dirac Notation:
The Dirac notation is a concise and convenient way to describe the state of the quantum system, such as
momentum, spin etc., there are two types of vectors in Dirac notation: the bra vector and the ket vector, so
named because when put together they form a bracket or inner product. If 𝜓 is the column vector, then
you can write it in Dirac notation as |𝜓〉 , where the |. 〉 denotes that it is a unit column vector, known as
ket vector. Similarly, the row vector 𝜓† is expressed as 〈𝜓|, refered as bra vector (anti-ket). The brac-ket
notation directly implies that 〈𝜓|𝜓〉 is the inner product of vector 𝜓with itself, which is by definition 1.
More generally, if 𝜓 and 𝜙 are quantum state vectors, then there inner product is 〈𝜙|𝜓〉 . This inner
product implies that the probability of measuring the state |𝜓〉 to be |𝜙 〉 is |〈𝜙 |𝜓〉|2 .
The following convention is used to describe the quantum states that encode the values of zero and one
(the single – qubit computational basis state):
1 0
[ ] = |0〉 & [ ] = |1〉
0 1
Consider two ket vector |𝑎〉 𝑎𝑛𝑑 |𝑏 〉 and arbitrary complex number c1 and c2 then the linear combination
of ket vector is given by, |𝑣 〉 = 𝑐1 |𝑎〉 + 𝑐2 |𝑏 〉
Similarly linear combination of bra vector can be written as 〈𝑣 | = 𝑐1∗ 〈𝑎| + 𝑐2∗ 〈𝑏 |
The scalar product of two states of vectors |𝜓1 〉 and |𝜓2 〉 can be written as
∞
〈𝜓1 |𝜓2 〉 = ∫−∞ 𝜓1 (𝑥 ) 𝜓2 (𝑥)𝑑𝑥
5
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
The state of a physical system is represented by wave function 𝜓, and then the state of system can be
written in terms of Eigen function as
𝜓 = 𝑐1 𝜙1 + 𝑐2 𝜙2 + 𝑐3 𝜙3 + ⋯ + 𝑐𝑛 𝜙𝑛
Where, 𝜙1 , 𝜙2 , 𝜙3 , … . 𝜙𝑛 are the Eigen functions and 𝑐1 , 𝑐2 , 𝑐3 , … . 𝑐𝑛 are the co-efficient of the Eigen
functions, which can be real or complex.
Where , 𝜙1∗, 𝜙2∗ , 𝜙3∗ … 𝜙𝑛∗ are the complex conjugate of Eigen functions and 𝑐1∗ , 𝑐2∗ , 𝑐3∗ , … 𝑐𝑛∗ are the complex
conjugate co-efficient of 𝑐1 , 𝑐2 , 𝑐3 , … . 𝑐𝑛 respectively.
〈𝜙1 |𝜓〉 𝑐1
〈𝜙2 |𝜓〉 𝑐2
|𝜓〉 = 〈𝜙3 |𝜓〉 = 𝑐3
⋮ ⋮
[〈𝜙𝑛|𝜓〉] [𝑐 𝑛]
∗ ∗ ∗ ∗
The bra vector 〈𝜓| = 〈𝜙1 |𝜓〉 , 〈𝜙2 |𝜓〉 , 〈𝜙3 |𝜓〉 … , 〈𝜙𝑛 |𝜓〉 = [𝑐1∗ , 𝑐2∗ , 𝑐3∗ , … 𝑐𝑛∗ ]
Identity Operator:
The operator which operating on functions and leaves the function unchanged is known as identity
operator, i.e., Ȋ |𝑎〉 = |𝑎〉 or Ȋ |𝜓〉 = |𝜓〉
An identity matrix is a square matrix in which all the elements of principal axis are one, a nd all other
elements are zeros and the matrix representation is given as follow
1 0 0 ⋯ 0
1 0 0 0 1 0 ⋯ 0
1 0 ⋯
Ȋ=[ ] , Ȋ = [0 1 0] ……. , I n = 0 0 1 0
0 1 2×2 ⋮ ⋮ ⋮ ⋱ ⋮
0 0 1 3×3
[0 0 0 ⋯ 1]
6
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
1 0
Consider |0〉 and |1〉 states, expressed in matrix form as |0〉 = [ ] , |1〉 = [ ] and the identity operator,
0 1
From the above proof of equation 1 and 2, it verifies that, when an identity operator Ȋ operates on any
qubit basis states, leaves it unchanged. Such that, when identity operator operates on any input state of
quantum logic gate of quantum circuit the output state remains same.
Pauli Matrices:
The Pauli matrices / pauli spin matrices are set of three 2 × 2 matrices which are Hermitian and unitary.
They are denoted by,
1 0
Apart from this three matrices, 𝜎0 = ( ) is also considered in few cases which is an Identity matrix.
0 1
i.e., 𝜎0 = 𝐼.
7
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
Conjugate of Matrix:
The complex conjugate of a given matrix is that matrix whose elements are the complex conjugate of the
corresponding elements of a given matrix. If the elements of matrix are real then no change, if the
elements of matrix are complex, then each complex element change its conjugate, that means sign of the
elements changes from –i to i and i to –i.
1 𝑖 1 −𝑖
Example: let A = [ ] , 𝐴∗ = [ ]
−𝑖 1 𝑖 1
2𝑖 4+𝑖 1 −2𝑖 4−𝑖 1
A = (6 − 𝑖 3 + 5𝑖 4 − 9𝑖 ) → Ᾱ = (6 + 𝑖 3 − 5𝑖 4 + 9𝑖 )
−6𝑖 7 + 2𝑖 0 6𝑖 7 − 2𝑖 0
A and 𝐴∗ are conjugate to each other. All imaginary elements of a given matrix is replaced by opposite
sign.
If all the elements are complex then 𝐴∗ = −𝐴, the matrix is purely imaginary.
Transpose of a Matrix:
The transpose of a given matrix is obtained by inter changing rows and columns of the given matrix. The
transpose of the matrix is denoted by using the letter “T” in the superscript of the given matrix. For
example, if “A” is the given matrix then the transpose of the matrix is represented by A′ or AT.
Let us consider a matrix A defined by 𝑚 × 𝑛 (‘m’ rows and ‘n’ columns, read as m by n matrix)
1 2 4 1 6 7 4
Ex: A = [6 9 11] AT = [2 9 10] , A = [4 5 8]1×3 AT = [5]
7 10 0 3×3 4 11 0 3×3 8 3×1
8
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
The symbol 𝐴† (read as dagger) represents the transpose of the complex conjugate of a given matrix A,
i.e., 𝐴 † = (𝐴∗ )𝑇 .
The complex conjugate transpose of a matrix interchanges the row & column index for element,
reflecting the elements across the main diagonal and it is denoted by Ϯ (dagger).
𝑖 1 𝑖 0 −𝑖 0
𝐸𝑥: 𝐴=[ ] 𝐴∗ = [ ] 𝐴Ϯ = [ ]
0 2 − 3𝑖 1 2 − 3𝑖 1 2 + 3𝑖
Hermitian Matrix:
The matrix that is equal to its conjugate transpose is called Hermitian matrix.
3 3+𝑖 3 3−𝑖
𝐸𝑥: 𝐴=[ ] 𝐴∗ = [ ]
3−𝑖 2 3+𝑖 2
3 3−𝑖
𝐴𝑇 = [ ]
3+𝑖 2
3 3+𝑖
(𝐴∗ )𝑇 = [ ]
3−𝑖 2
(𝐴∗ )𝑇 = 𝐴 𝐴Ϯ = 𝐴 ( (𝐴∗ )𝑇 = 𝐴Ϯ )
Unitary Matrix:
The complex matrix which is multiplied by its conjugate transpose, which is equal to the identify matrix
is called unitary matrix.
9
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
NOTE: The inner product or multiplication of two unitary matrix is again a unitary matrix.
The matrix multiplication between two matrixes exists only when the number of columns of first matrix
must be equal to number rows of second matrix. In vector space this is called as dot or inner product of
two vectors which must be scalar quantity.
0
2 −1 7
Example: A = [ ] B = [−2]
0 6 −3 2×1
3 3×1
(2 × 0) + (−1)(−2) + 7×3 23
A.B = [ ] =[ ]
0×0+ 6 × (−2) + (−3) × 3 2×1 −21 2×1
Probability (or) Quantum Superposition: is the ability of a quantum system exists in multiple states at
the same time until it is measured.
1 0
i.e., |0〉 = [ ] and |1〉 = [ ]which are the states of quantum mechanical system or physical object which
0 1
are called quantum binary digits or simply qubits.
The qubits exists not only in |0〉 and |1〉 but are also in the linear combination of states often called
superposition. |𝜓〉 = 𝛼 |0〉 + 𝛽 |1〉.
Where 𝛼 and 𝛽 are complex numbers, 𝜓 is a state of quantum mechanical system or wave function.
Orthogonality:
We say that two vectors are orthogonal if they are perpendicular to each other. i.e., the dot product of the
two vectors is zero. (or ) we say that a set of set vectors {v1,v2,….,vn} are mutually orthogonal, if every
pair of vectors is orthogonal.
i.e., 〈𝜙 |𝜓〉 = 0
Orthonormality:
10
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
Quantum Computers
Quantum computers are the machines that perform calculations based on the laws of quantum mechanics.
Quantum computing is the computer technology based on the principles of superposition and quantum
theory, which explains the nature and behaviour of energy and matter in the atomic and subatomic level.
In quantum computing, the information is encoded in quantum system such as atoms, ions or quantum dots.
Sl.
Classical Computer Quantum Computer
No.
Quantum computers use Qubits i.e. 0, 1 and
Classical computers use binary codes i.e.
1 both of them simultaneously to run machines
bits 0 or 1 to represent information.
faster.
In classical computers information In quantum computers information storage is
2 storage is bit based on voltage or charge Quantum bit based on direction of an electron
etc. spin.
Quantum computers can perform many
It is large scale integrated multi-purpose calculations in parallel, making them much
3
computer. faster than classical computers for certain
types of problems.
Operations are defined by linear algebra over
Operations are defined by Boolean
4 Hilbert Space and can be represented by
Algebra.
unitary matrices with complex elements.
Information processing is carried out by Information processing is carried out by
5
logic gates e.g. NOT, AND, OR etc. Quantum logic gates.
Classical Computers use bits in the form A Qubit can be as simple as a single Photon,
6 of transistors which take either of two Electron, Ion/Atom.
values – 0 or 1.
Information is obtained through
11
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
In 1965, Gordon E. Moore, cofounder of Intel, predicted that roughly every two years, the number of
transistors on microchips (computer processor) will double. Commonly referred to as Moore’s Law, this
phenomenon suggests that computational progress (speed, size and capability) will become significantly
faster, smaller, and more efficient over time.
According to expert opinion, Moore’s Law is estimated to end sometime in the 2020s. In a 2005
interview, Moore himself stated that his law “can’t continue forever.” The above graphical representation
shows the growing number of transistors per chip with time and the declining trend in the number of
electrons in a transistor.
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.
A quantum bit or qubit (sometimes qbit) is a unit of quantum information. A qubit of data is represented
by a single atom that is in one of the two states denoted by 0 and 1 . A single bit of this form is known
as a qubit.
Example: white and black colour corresponds to the states 0 and 1 , then a qubit can be imagined to
have shade of grey.
Qubit: 0 1
The above equation represents the quantum superposition of states |0⟩ and |1⟩.
1 0
0 1
Where and are complex numbers. These complex numbers are amplitudes.
Single qubit:
A Single qubit has two computational basis states |0⟩ and |1⟩. Then the single qubit is represented as
follows 0 1
12
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
Two qubits:
A two-qubit system has 4 computational basis states denoted as |00⟩, |01⟩, |10⟩, |11⟩. Then the two qubit is
represented as follows
1 1 0 1 1 and 2 2 0 2 1
1 2
N qubits:
A multi-qubit system of N qubits has 2𝑁 computational basis states. For example a state with 3 qubits has
23 computational basis states. Thus for N qubits the computational basis states are denoted as |00 ・・・00⟩,
|00・・ 01⟩, |00・・ ・ 10⟩, |00 ・ ・ ・ 11⟩ ・ ・ ・ |11 ・ ・ ・ 11⟩.
We use a specific type of notation called bra-ket notation in quantum mechanics to represent vectors in a
more condensed form. Let’s look at the most basic vectors, the “0” vector and the “1” vector, in bra -ket
notation:
The “bra” “<|” form of a vector is just the conjugate transpose of the original, shown below:
0 1 0 , 1 0 1
The pure state space qubits (Two Level Quantum Mechanical Systems) can be visualized using an
imaginary sphere called Bloch Sphere. It has a unit radius.
The Arrow on the sphere represents the state of the Qubit. The north and
south poles are used to represent the basis states |0⟩ and |1⟩ respectively.
The other locations are the super positions of |0⟩ and |1⟩ states and
represented by 𝛼 |0⟩ + 𝛽 |1⟩ with 𝛼2 + 𝛽2 = 1. Thus a Qubit can be any
point on the Bloch Sphere.
The Bloch sphere allows the state of the qubit to be represented unit
spherical co-ordinates. They are the polar angle 𝜃 and the azimuth angle
𝜙. The block sphere is represented by the equation
13
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
cos 0 e i sin 1
2 2
here 0 ≤ 𝜃 ≤ 𝜋 and 0 ≤ 𝜙 ≤ 2𝜋.
For 90 0 ,
1
0 i 1 , is a superposition state along + y-axis.
2
For 90 0 ,
1
0 i 1 , is a superposition state along - y-axis.
2
For 0 0 ,
1
0 1 , is a superposition state along + x-axis.
2
For 180 0 ,
1
0 1 , is a superposition state along - x-axis.
2
In quantum computing a quantum logic gate is a basic quantum circuit operating on a small number of
qubits. The quantum calculations are achieved by performing a series of fundamental operations, known
as quantum logic gates.
In Quantum Computing the quantum NOT gate for qubits changes the state |0⟩ to |1⟩ and |1⟩ to |0⟩.
The X-gate is represented by the Pauli-X matrix. (The Pauli-X Gate is nothing but Quantum Not Gate).
The Matrix representation of Quantum Not Gate is given by
0 1
1 0
0 1 1 0
0 1
1 0 0 1
14
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
0 1 0 1
1 0
1 0 1 0
The circuit symbol and the truth table of Quantum Not Gate are as follows.
Pauli – Z Gate:
The Matrix representation and the operation of Z-Gate on |0⟩ and |1⟩ are as follows
1 0 1 1
Z 0 0
0 - 1 0 0
1 0 0 0 0
Z 1 - - 1
0 - 1 1 - 1 1
The circuit symbol and the truth table of Z-Gate are as follows.
15
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
Hadamard Gate:
The Hadamard Gate is a truly quantum gate and is one of the most important in quantum computing. It is
used to create the superpositions of |0⟩ and |1⟩ states.
0 1
1. For input |0⟩ the output is
2
0 1
2. For input |1⟩ the output is
2
1 1 1
H
2 1 1
The operation of Hadamard Gate on |0⟩ and |1⟩ input states are represented as follows
The circuit symbol and the truth table of Hadamard Gate are as follows.
16
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
1 0 1 1
S 0 0
0 i 0 0
1 0 0 0
S1 i1
0 i 1 i
The circuit symbol and the truth table of S Gate are as follows.
i
i exp 8 0
T exp
8 i
0 exp
8
The operation of T - Gate on |0⟩ and |1⟩ are represented as follows
17
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
1 0
1 1
T 0 0 1 i 0
0 0
2
1 0 0
0 1 i 1 i
T1 0
1 2 1
1 i
2 2
The circuit symbol and the truth table of S Gate are as follows.
Truth table of T - Gate Gate
8
Input Output
|0⟩ |0⟩ (No change)
i
|1⟩ exp |1⟩
4
Multiple Qubit Gates operate on two or more input Qubits. Usually one of them is a control qubit.
Controlled Gates:
The gate has two input qubits known as the control bit and target bit respectively.This tells us that the first
qubit is the controlled, and the second qubit is the target. The target qubit is altered (flipped) only when
the control qubit is |1⟩. The control qubit remains unaltered when the controlled qubit is |0⟩.
1. When control qubit is |0⟩ then the target remains unchanged (|0⟩).
2. When control qubit is |1⟩ it changes (flips) the Target.
18
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
1 0 0 0
0 1 0 0
U CN
0 0 0 1
0 0 1 0
The circuit diagram and the truth table of CNOT Gate are as follows.
Operations of CNOT gate on the four inputs |00⟩, |01⟩, |10⟩ and |11⟩:
(1) Operation of CNOT Gate for input |00⟩ (Control qubit = 0 and Target qubit = 0):
Here in the inputs the control qubit is |0⟩. Hence no change in the state of Target qubit |0⟩
|00⟩ → |00⟩
(2) Operation of CNOT Gate for input |01⟩ (Control qubit = 0 and Target qubit = 1):
Here in the inputs the control qubit is |0⟩. Hence no change in the state of Target qubit |1⟩
|01⟩ → |01⟩
(3) Operation of CNOT Gate for input |10⟩ (Control qubit = 1 and Target qubit = 0):
Here in the inputs the control qubit is |1⟩. Hence the state of Target qubit flips (changes) from |0⟩ to |1⟩.
|10⟩ → |11⟩
(4) Operation of CNOT Gate for input |11⟩ (Control qubit = 1 and Target qubit = 1):
Here in the inputs the control qubit is |1⟩. Hence the state of Target qubit flips (changes) from |1⟩ to |0⟩.
|11⟩ → |10⟩
19
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
Swap Gate:
1. For input |00⟩ and |11⟩ the output remains unchanged (|00⟩ and |11⟩)
2. For input |01⟩ and |10⟩ the output changes to |10⟩ and |01⟩
1 0 0 0
0 0 1 0
U SWAP
0 1 0 0
0 0 0 1
The swap gate is a combined circuit of 3 CNOT gates and the overall effect is that two input qubits are
swapped at the output. The action and truth table of the swap gate is as follows.
Controlled Z Gate:
In Controlled Z Gate, The operation of Z Gate is controlled by a Control Qubit. If the control Qubit is |𝐴⟩
= |1⟩ then only the Z gate transforms the Target Qubit |𝐵⟩ as per the Pauli-Z operation.
1. For input |00⟩, |01⟩ and |10⟩ the output remains unchanged (|00⟩, |01⟩ and |10⟩)
2. For input |11⟩ the output changes to -|11⟩
20
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
1 0 0 0
0 1 0 0
UZ
0 0 1 0
0 0 0 1
The circuit symbols of controlled Z gate and the truth table are as follows
Toffoli Gate:
The Toffoli Gate is also known as CCNOT Gate (Controlled-Controlled-NOT Gate). 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.
1. For input |000⟩, |001⟩, |010⟩, |011⟩, |100⟩ and |101⟩ the output remains same.
2. For input |110⟩ and |111⟩ the output changes to |111⟩ and |110⟩
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 0 0
UT
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
The circuit symbols of Toffoli Gate and the truth table are as follows
21
Applied Physics: (P22PHCS102/202) Unit – IV: Photonics PESCE, Mandya
22