Physics Final Module 3 (CSE)
Physics Final Module 3 (CSE)
Department: Physics
Subject: Applied Physics for CSE stream
Subject Code: BPHYS102/202
Applied Physics for CSE stream
Module 3
Quantum Computing
Introduction:
Course syllabus:
Principles of Quantum Information & Quantum Computing:
Introduction to Quantum Computing, Moore’s law & its end, Differences between
Classical & Quantum computing. Concept of qubit and its properties. Representation of
qubit by Bloch sphere. Single and Two qubits. Extension to N qubits.
Dirac representation and matrix operations:
Matrix representation of 0 and 1 States, Identity Operator I, Applying I to|0⟩and |1⟩
states, Pauli Matrices and its operations on |0⟩and |1⟩states, Explanation of i) Conjugate
of a matrix and ii) Transpose of a matrix. Unitary matrix U, Examples: Row and Column
Matrices and their multiplication (Inner Product), Probability, and Quantum
Superposition, normalization rule. Orthogonality, Orthonormality. Numerical Problems.
Quantum Gates:
Single Qubit Gates: Quantum Not Gate, Pauli – X, Y 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.
Where, θ and Ф define a point on the Unit three dimensional sphere as shown in figure
of Bloch sphere.
For θ =0 and Ф = 0, the state |ψ corresponds to |0 and it is along + Z- axis.
For θ =180 and Ф = 0, the state |ψ corresponds to |1 and it is along - Z- axis.
1
When θ = 90° and Ф = 90°, | ψ = (|0 + i |1) is a superposition state along + Y-axis.
√2
1
When θ = -90° and Ф = 90°, | ψ = (|0 - i |1) is a superposition state along - Y-axis.
√2
3.6. Single qubit: It is a vector | = |0 + |1 premised by two complex numbers
satisfying ||2 + |β|2 = 1.Operation on qubit must preserve this norm under described by
2 x 2 unitary matrix.
The basis states of single qubit are |0 and |1 or linear combination of both states.
|1 = 1 X 20 = 1 X 1 = 1 {0 , 1}
0 1
Take as all basis as column of matrix then we get an identity matrix I = ( )
1 0
The most general state | of a single qubit is represented by a vector of the form
𝜃 𝜃
|ψ= cos ( ) |0 + eiθ sin ( ) |1
2 2
A single qubit represented by operators on the two dimensional vector space as 2 X 2
matrices.
0 1 0 −𝑖 1 0
Ex. σ x = σ 1 = X = ( ) σ y= σ 2 = Y= ( ) σ z= σ 3 = Z = ( )
1 0 𝑖 0 0 −1
All Pauli matrices are single qubit state vector operations.
1
3.7. Two qubit: It is a vector represented by | ψ = √2
(|0 |0 + |1 |1) , and the
state is entangled with these number of particle values. 0, 1, 0, 1.
|00 = 0 X 21 + 0 X 20 = 0 + 0 = 0 |01 = 0 X 21 + 1 X 20 = 0 + 1= 1
|10 =1 X 21 + 0 X 20 = 2 + 0 X 1 =2 |11 = 1 X 21 + 1 X 20 =2 + 1 X 1 = 3
1 0 0 0
0 1 0 0
( ) = I 4 =D [1111]
0 0 1 0
0 0 0 1
1 0
0 1
. 0
. .
|00……00 = |01……01 = etc.
. .
. .
. .
(0) (0)
1 0 . . . . . 0
0 1 . . . . . 0
. . . . . . . .
. . . . . . . .
I8 =
. . . . . . . .
. . . . . . . .
. . . . . . . .
(0 . . . . . . 1)𝑛𝑋𝑛
The notation | indicates that the object is a vector. | is called as “ket vector”
The complex conjugate of ket vector is represented by “Bra vector “. ψ| read as “bra
psi”.
Hence the bra vector is a transpose of complex conjugate of ket vector & vice versa
Hence ket and bra vectors are transpose of complex conjugate of each other.
The scalar or inner product of bra and ket vectors can be represented by matrix as
(x1 )
(x2 )
ψ| ψ = [ψ*(x1 ψ*(x2
), )........................... ψ*(xn .
)] .
.
( (xn ) ).
1 0
Î=( )
0 1 2𝑋2
1 0 1 0
|0 =( ) and |1=( ) and identity operator Î = ( )
0 1 0 1
1 0 1 1+0 1
Let Î |0 = ( )( ) = ( ) = ( ) = |0 …… (1)
0 1 0 0+0 0
1 0 0 0+0 0
Î |1 = ( ) ( ) =( ) = ( ) = |1 ……… (2)
0 1 1 0+1 1
From the above proof of equation (1) and (2) it can be concluded that when Identity
operator Î operates on any qubit, basis states left unchanged. The Î operators doesn’t
change the state of the systems.
Hence when identity operator operates on any input state of quantum logic gate of
quantum circuit, the out state remains same.
1 0 0 1
σ0 = I = ( ) σX = σ1 = X = ( )
0 1 1 0
0 −𝑖 1 0
σy = σ2 = Y= ( ) σz = σ3 = Z = ( )
𝑖 0 0 −1
Most of the cases σ0 = I is excluded because it is generally used as identity matrix.
3.12.1. The operations of Pauli matrices on |0 and |1 states operations of Pauli
matrices on |0 State:
1 0 1 1+0 1
(i) σ0 |0 = I |0 = ( )( ) = ( ) = ( ) =|0 I |0 = |0 No change
0 1 0 0+0 0
0 1 1 0+0 0
(ii) σx |0 = X |0 = ( )( ) = ( ) = ( ) = |1 X |0 = |1
1 0 0 1+0 1
0 −𝑖 1 0+0 0 0
(iii) σy |0 = Y |0 = ( )( ) = ( ) = ( ) = i ( ) Y |0 =i|1
𝑖 0 0 i+0 i i
1 0 1 1+0 1
(iii) σz |0 = Z |0 = ( )( ) = ( ) =( ) Z |0 = |0 No change
0 −1 0 0+0 0
1 0 0 0+0 0
(i) σ0 |1 = I |1 = ( )( ) = ( ) = ( ) = |1 I |1 = |1 No change
0 1 1 0+1 1
0 1 0 0+1 1
(ii) σx |1 = X |1 = ( )( ) = ( ) = ( )= X |1 X |1 = |0
1 0 1 0+0 0
0 −𝑖 0 0−𝑖 −𝑖 1
(iii) σy |1 = Y |1 = ( )( ) = ( ) = ( )= −𝑖 ( ) = - i|0
𝑖 0 1 0+0 0 0
1 0 0 0+0 0 0
(iv) σz |1 = Z |1 = ( )( ) = ( ) = ( )= - ( ) = - |1
0 −1 1 0−1 −1 1
1 𝑖 1 −𝑖
Eg: Let A = ( ) A* = ( )
−𝑖 1 𝑖 1
All the imaginary elements of a given matrix are replaced by opposite sign i.e., + i to – i &
-i to + i
If all the elements are complex then A* = -A, the matrix is purely imaginary.
1 2 4
Ex: A= (6 9 10)
7 11 0
Ex:
A† A = I
Note: The symbol A † (read as dagger) represents the transpose of complex conjugate
of a given matrix A. A† = (A*)T
Note: The inner product or multiplication of two unitary matrixes is again unitary
matrix or dot product.
(ii) Column Matrix: A matrix having one column and m row is called column matrix.
Thus the matrix is of the order m x 1 represented as
a11 a1
a21 a2
Eg: [A]= . = .
. .
a a
( m1 ) ( n )𝑚𝑥 1
2
0
[A] = (1 2 0 4 5)1𝑥5 [𝐵] = 4
5
(6)5𝑥1
A.B = 2 + 0 + 0 + 20 + 30 = 52
= 1 ∗ 1+ 2 ∗ 2
⟨ | ϕ ⟩ is called the inner product and the result is always a scalar product.
3.17. Probability
1 0
Consider a quantum state |⟩ = α( ) + β ( )
0 1
|⟩ = α|0 + β|1
|⟩ =( )
= * + β*
= 2 + β 2
We know that *= 2 represents the probability
We have ⟨ |⟩ = 2= 2 + β 2= 1
This implies |⟩ is normalized.
3.18. Orthogonality
Consider the inner product of |0 and |1
0
⟨0|1⟩ = (1 1) ( )
1
= 1.0+0.1
=0
If the inner product of two abstract state vectors is zero, then they are said to be
orthogonal.
i,e. ⟨0|1⟩ = 0
3.19. Orthonormality
Two states |⟩ and |ϕ⟩ are said to be orthonormal if
(1) |⟩ and |ϕ⟩ normalized
(2) |⟩ and |ϕ⟩ are orthogonal to each other.
Input output
|0 |1
|1 |0
α|0 + β|1 α|1 + β|0
⟨0|0⟩ = 1, ⟨1|1⟩ = 1
⟨0|1⟩ = 1, ⟨1|0⟩ = 0
0 1
X=( )
1 0
Inner Product:
0 1 1
X |0⟩ = ( )( )
1 0 0
0 + 0)
=( )
1+0
0
X |0⟩ =( ) = |1⟩
1
0 1 1
X |1⟩ = ( )( )
1 0 0
0 + 0)
=( )
1+1
0
X |1⟩ =( ) = |0⟩
1
Outer Product:
σx |0⟩ |1⟩
⟨0| 0 1
⟨1| 1 0
Pauli X gate when operates on |0⟩ flip to |1⟩ and |1⟩ to |0⟩, where two states are inverted.
0 −𝑖
Y= ( )
𝑖 0
Inner product:
0 −𝑖 1 0+0 0
Y |0⟩ = ( )( ) = ( ) = ( ) = i|1⟩
𝑖 0 0 𝑖+0 i
Y |0⟩= i|1⟩----------------------------------------- (3)
0 −𝑖 0 0−𝑖 −i 1
Y |1⟩ = ( )( ) = ( ) = ( ) =-i ( ) = i|0⟩
𝑖 0 1 0+0 0 0
Y |1⟩= -i|0⟩------------------------------------------(4)
Outer Product:
σx |0⟩ |1⟩
⟨0| 0 -i
⟨1| i 0
Inner product:
It leaves |0⟩ unchanged and inverts the sign of |1⟩ to give -|1⟩.
1 0 1 1
Z |0⟩ = ( ) ( ) = ( )= |0⟩
1 −1 0 0
Z |0⟩ = |0⟩
1 0 0 0
Z |1⟩ =( ) ( ) = ( )= -|1⟩
1 −1 1 −1
Z |1⟩ = -|1⟩
Outer product:
σx |0⟩ |1⟩
⟨0| 1 0
⟨1| 0 -1
3.3.3. Hadamard Gate: Hadamard gate is also called H-gate. The Hadamard gate is a
type of single qubit quantum gate a basic operation that can be applied to a qubit. Like all
quantum gates, the Hadamard gate is a unitary transformation on a vector space.
Inner Product:
1
√2 1 1 1 1 0
H|0⟩= (−1 )= ( )= [( ) +( ) ]
√2 −1 √2 0 −1
√2
1
H|0⟩= (|0⟩ − |1⟩)
√2
1 0
H2 =I = ( )
0 1
Outer product:
σx |0⟩ |1⟩
⟨0| 1 1
√2 √2
⟨1| 1 −1
√2 √2
𝟏
H= [|𝟎⟩ ⟨𝟎| + |𝟎⟩⟨𝟏| + |𝟏⟩ ⟨𝟎| − |𝟏⟩⟨𝟏|]
√𝟐
1
H|0⟩ = [|0⟩⟨0|+|0⟩⟨1| + |1⟩⟨0| − |1⟩⟨1|]|0⟩
√2
1
H|0⟩ = 2 [|0⟩ ⟨0|0⟩ + |0⟩⟨1|0⟩ + |1⟩ ⟨0|0⟩ − |1⟩⟨1|0⟩]
√
1
H|0⟩ = 2 [|0⟩. 1 + |0⟩. 0 + |1⟩. 1 – |1⟩. 0]
√
1
H|0⟩ = 2 [|0⟩ + |1⟩]
√
1
H|1⟩ = [|0⟩ ⟨0|1⟩ + |0⟩⟨1|1⟩ + |1⟩ ⟨0|1⟩ − |1⟩⟨1|1⟩
√2
1
H|1⟩ = 2 [|0⟩. 0 + |0⟩. 1 + |1⟩. 0 – |1⟩. 1]
√
1
H|1⟩ = 2 [|0⟩ − |1⟩]
√
1 0 1 0
S=( ) or ( 𝑖𝜋/2 )
0 𝑖 0 𝑒
The S gate is also known as the Phase gate or Z 90˚ gate, because it represents a 90˚ degree
rotation around the Z axis
Inner Product:
1 0 1 1+0 1
S|0⟩ = ( ) ( )=( ) = ( ) = |0⟩
0 𝑖 0 0+0 0
1 0 0 0+0 0
S|1⟩=( ) ( )=( ) = ( ) = 𝑖|1⟩
0 𝑖 1 0+i i
Outer Product:
σx |0⟩ |1⟩
⟨0| 1 0
⟨1| 0 i
S= [|0⟩⟨0| + i |1⟩⟨1|]
3.3.5. T gate
The T gate is a single qubit operation defined by,
1 0
S= ( )
0 𝑒 𝑖𝜋/4
The S gate is also known as the π/8 gate
Inner Product:
1 0 1 1+0 1
T|0⟩ = ( ) ( )=(
𝑖𝜋 ) = ( ) = |0⟩
0 𝑒 40 0 + 0 0
1 0 0 0+0 0 0
T|1 ⟩=( ) ( )=( ) = ( 𝑖𝜋/4 ) = 𝑒 𝑖𝜋/4 ( ) = 𝑒 𝑖𝜋/4 |1⟩
0 𝑒 𝑖𝜋/4 1 0 + 𝑒 𝑖𝜋/4 𝑒 1
Outer Product:
σx |0⟩ |1⟩
⟨0| 1 0
⟨1| 0 𝑒 𝑖𝜋/4
𝛼1 𝛽1
𝛼 𝛽2
|ψ⟩ ⊗ |Ф⟩= ( 1 )
𝛼2 𝛽1
𝛼2 𝛽2
1
1 1 0
Ex: |00⟩ = |0⟩ ⊗ |0⟩ = ( ) ⊗ ( ) = ( )
0 0 0
0
|01 = 0X 21+1X 20 = 1
|01 = 1X 21+0X 20 = 2
|11 = 1X 21+1X 20 = 3
1
1 1 0
|0 x |0 = ( ) 𝑋 ( ) = ( )
0 0 0
0
1 0
0 1
|00 = ( ) |01 = ( )
0 0
0 0
0 0
0 0
|10 = ( ) |11 = ( )
1 0
0 1
Take column matrix of all above basis state write as column of matrix we will get,
1 0 0 0
0 1 0 0
( )=I4
0 0 1 0
0 0 0 1
All the basis states of three qubit quantum logic gates can be written as,
0 1 2 3 4 5 6 7
(0 to 23-1)
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
|000 = |001 = |010 = |011 =
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
0 0 0 0
|100 = |101 = |110 = |111 =
1 0 0 0
0 1 0 0
0 0 1 0
(0 ) (0) (0) (1 )
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
I8 =
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 0 0 0 0 1)
In case of controlled gate “If A is true then do B”. A is generally known as the control qubit
and B as 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.
However, the control qubit remains unaltered in both the cases.
CNOT gate
If the control qubit (A) of the gate is set to 0, then the target qubit (B) is not altered. IF the
control qubit is set to 1, then the target qubit is inverted.
(a) 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
(b) Input state |01 (Control qubit = 0, Target qubit = 1): Both the bits remain unaltered.
Hence, the output state is the same as the input state or
|01 |01
(c) 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
(d) 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
Input Output
|00 |00
|01 |01
|10 |11
|11 |10
Swap gate
The output of the first CNOT gate is |a, a b. This is fed as input to the second gate which
also does modulo 2 addition but the result is placed in the first qubit now. Its output becomes
|a (ab), ab = |b, ab.This is now fed to the third gate which performs modulo 2
addition and places the result in the second qubit. The output finally becomes |b, (ab) b)
= |b, a. Thus, the overall effect is that the two qubits have been swapped.
The truth table of a Swap gate is given below.
Input Output
|00 |00
|01 |10
|10 |01
|11 |11
Controlled-Z gate
1 0 0 0
0 1 0 0
Uz = ( )
0 0 1 0
0 0 0 −𝟏
containing only reversible elements, by using a reversible gate called Toffoli Gate. Below
figure shows a Toffoli gate and the truth table.
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
I8 =
0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 𝟏
(0 0 0 0 0 0 𝟏 0)
Numerical Problems:
Problem 1:
Consider A be the linear operator from V to V such that A |0 = |1 and A |1 = |0 .Given
matrix representation of A.
𝑥11 𝑥12 1 0
Let A = (𝑥 𝑥22 ) and We know that |0 = (0) & |1 = (1)
21
Now
A|0 = |1
𝑥11 𝑥12 1 0
(𝑥 𝑥22 ) (0) = (1)
21
𝑥11 + 0 0 𝑥11 0
(𝑥 + 0) =( ) = ( 𝑥 ) =( )
21 1 21 1
Department of Engineering Physics, HKBKCE Page 26
Applied Physics for CSE stream
𝑥11 = 0 𝑥21 = 1
A|1 = |0
𝑥11 𝑥12 0 1
(𝑥 𝑥22 ) (1) = (0)
21
0+ 𝑥12 1 𝑥12 1
( ) =( ) = ( 𝑥 ) =( )
0+ 𝑥22 0 22 0
𝑥12 = 1 𝑥22 = 0
0 1
X=( )
1 0
Problem 2:
1 1
(√2 √2
Show that the matrix A = 𝑖 −𝑖 ) is unitary
√2 √2
1 −𝑖
A † = (√2
1
√2
𝑖
)
√2 √2
1 −𝑖 1 1 1 1 1 1
+ −2
) (√2 √2
A† A = (√2
1
√2
𝑖 𝑖 −𝑖 ) = (21 21 2
1 1)
−2 +2
√2 √2 √2 √2 2 2
1 0
=( )=I
0 1
A† A =I
Problem 3:
Find the Inner product of states |0 & |1 and draw conclusions on the result:
Solution:
1 0
We know that |0 = ( ) |1=( )
0 1
⟨0| = (0 1)
1
⟨1|0⟩ = (0 1) ( ) = (0+0) = 0
0
Problem 4:
0 −𝑖
Given A = ( ) Prove that A † = A
i 0
0 −𝑖 0 +𝑖
Solution: A = ( ) A* = A = ( )
i 0 −i 0
0 −𝑖
A † = (A * )T = ( ) =A
i 0
Hence A † = A
Problem 5:
|ψ = A [ 2|0 + 3i|1 find ⟨ψ|ψ⟩
1 0 2 0 2
Solution: |ψ = A[ 2 ( ) + 3i ( ) = A [( ) + ( )] = A[( )]
0 1 0 3i 3i
⟨ψ| = A [ 2 3i]
2
⟨ψ|ψ⟩ = A [ 2 -3i] .A[( )]
3i
⟨ψ|ψ⟩=A2 [4+9] = A2 .[13]
|ψ|2 = A2 .[13]
1= A2 .[13]
A=1/√13
Problem 6:
1 1 1 1
Check the orthogonality |i = ( ) |-i = ( )
√2 i √2 −i
1 1 1 1
⟨i|-i⟩ = ( ). ( )
√2 i √2 −i
1 1
= 2 (1 + 𝑖 2 ) =2 (1 − 1) = 0
Problem 7:
Solution:
1 1 2
α1 ( ) + α2 ( ) + α3 ( )
−1 2 1
α1 |v1+ α2 |v2+ α3 |v3 = 0
α1 + α2 + 2α3 = 0 -------------------------------(1)
-α1 + 2α2 + α3 = 0
__________________
3α2 + 3α3 =0
α1 – α3 + 2 α3 = 0
α1 + α3 =0 => α1 = - α3
Put α3 =1 => α2 =-1
α1 =-1
1 1 2
α1 ( ) + α2 ( ) + α3 ( ) =0
−1 2 1
1 1 2
=> (-1) ( ) + (-1) ( ) + (1) ( ) =0
−1 2 1
−1 −1 2
( )+ ( ) + ( ) =0
1 −2 1
-1-1+2 =0 hence they are linearly dependent.
1-2+1=0
Problem:8
α1 β1
Given |ψ⟩ = (α ) |Ф⟩= ( ) Prove that ⟨ψ|Ф⟩ =⟨Ф|ψ⟩*
2 β2
α1
Solution: |ψ⟩ = (α ) ⟨ψ|= (α1 ∗ α2 ∗ )
2
β1
|Ф⟩= ( ) ⟨ Ф | = (β1 ∗ β2 ∗ )
β2
β
⟨ψ|Ф⟩ = (α1 ∗ α2 ∗ ) ( 1 ) = α1 ∗ β1 + α2 ∗ β2 -------------(1)
β2
α1
⟨Ф|ψ⟩ = (β1 ∗ β2 ∗ ) (α ) = α1 β1 ∗ + α2 β2 ∗ -------------(2)
2
⟨ψ|Ф⟩* = ⟨ψ*|Ф*⟩
= ⟨ψ*|=|ψ⟩ , ⟨Ф*|=|Ф⟩
=⟨Ф|ψ⟩
⟨ψ|Ф⟩ =⟨Ф|ψ⟩*
Solution:
1 1 1
Consider H = ( ) unitary operator means H †.H = I
√2 1 −1
1 1 1
H † = (H * )T = ( )=H
√2 1 −1
1 1 1 1 1 1
H †.H = ( ). ( )
√2 1 −1 √2 1 −1
1 1+1 1−1 1 2 0 1 0
= 2( )=2 ( )=( )
1−1 1+1 0 2 0 1
H †.H = I
Problem 10:
Solution:
1 0 1 0
T=( ) = ( 𝑖𝜋 1/2 )
1 𝑒 𝑖𝜋/4 1 𝑒( 2 )
1/2
1 0
=( 𝑖𝜋 ) = √𝑠
1 𝑒( 2 )
T= √𝑠 or T2 = S
Problem 11:
Using matrix multiplication show that on applying Hadamard gate twice to a |0⟩ results in its
original gate.
1 1 1
H= ( )
√2 1 −1
1 1 1 1 1 1
H.H = ( ). ( )
√2 1 −1 √2 1 −1
1 1+1 1−1 1 2 0 1 0
= 2( )=2 ( )=( )
1−1 1+1 0 2 0 1
Department of Engineering Physics, HKBKCE Page 30
Applied Physics for CSE stream
H.H =I when H2 operates on |0⟩ or I operates |0⟩the resultant will be original Qugate.
|0⟩ H
Hh H |0⟩
Problem 12: Using two gates that two N0T gates in series are equivalent to a quantum
wire.
Solution
Two Qugates NOT operation on basis state |0⟩ and |1⟩ from a quantum wire
1 0 1 0 1 0
X=( ) and X.X = ( ). ( )
0 1 0 1 0 1
0+1 0+0
=( )
0+0 1+0
1 0
=( )=I
0 1
X.X|0⟩ =|0⟩ or X.X =I