Module III_Quantum Computation
Module III_Quantum Computation
• By 2020 to 2025, transistors will be so small and it will generate so much heat that
standard silicon technology may eventually collapse.
• If scale becomes too small, electrons tunnel through micro-thin barriers between
wires corrupting signals.
• Since atoms/photons/electrons obey the law quantum mechanics, the algorithms are
also written based on quantum principles.
• It is so powerful that a search engine can search every part of internet in half an hour.
Moore’s Law
• In the year 1965, Gardon Moore observed increasing
performance in the first few generations of the integrated-
circuit (IC) technology.
• Moore predicted that “the number of transistors per
square inch has doubled approximately every 2years
or 18 months” i.e. computing power doubles every 18
months”.
• The computer industry has followed this prediction since
then.
• The capabilities of many digital electronic devices are strongly linked to Moore’s law.
-Processing speed, memory capacity, sensors and even the number and size of pixels in digital cameras.
Plot shows the 50 years of Moore’s law
End of Moore’s Law
The question that arises is how long can Moore’s law
continues to hold and what are the ultimate
limitations……….!!!?.
8
Qubits Properties
✓ Superposition: A qubit, |ψ⟩, is a superposition of both |0⟩ &|1⟩ : i.e., |ψ⟩ = α |0⟩ + β |1⟩
✓ If measurements are carried out with a qubit in superposed state then the results will
be probabilistic. The total probability of a qubit must be 100%. i.e. |α|2 +|β|2 =1
(Normalization rule)
✓ Due to quantum nature, the qubit changes its state during its measurement. This
means, one cannot copy information from qubits the way we do in the present
computers, as there will be no similarity between the copy and the original. This is
known as ”no cloning principle”. 9
Representation of Qubit by Bloch Sphere
✓ Arrow represents the state of the Qubit.
✓ North & south poles are used to represent
the basis states |0⟩ and |1⟩.
✓ other locations are the superposition of
|0⟩ and |1⟩; |ψ⟩=α |0⟩ + β |1⟩ with α2 + β2 = 1.
✓ Hence Qubit can be any point on Bloch Sphere.
✓ Bloch sphere allows the state of the qubit
to be represented by spherical co-
ordinates (θ, ϕ) as;
10
here 0 ≤ θ ≤ π & 0 ≤ ϕ ≤ 2π
Single and Two Qubit and Extension to N Bits
✓ A Single Qubit has two computational basis states |0⟩ and |1⟩. The pictorial
representation of the single qubit is as follows.
|0⟩
|1⟩
✓ let us examine a system of single qubit. Consider a electron in H2, regarded as 1-state quantum system:
✓ Since electron can be in either of the ground or excited state, classically the electron is in one of two
states – 0 or 1 – and represent 1 bit of classical information.
✓ By superposition principle, the quantum state of electron can be linear combination of these two states:
|0⟩ |0⟩
|1⟩ |1⟩
✓ let us examine Two qubits: Consider two electrons in H2, each regarded as 2-state quantum system:
✓ Since electron can be in either of the ground or excited state, classically the two electrons are in one of
four states – 00, 01, 10, or 11 – and represent 2 bits of classical information.
✓ By superposition principle, the quantum state of electron can be linear combination of these four states:
··· ···
|1⟩ |1⟩ |1⟩ |1⟩
13
Fundamentals of matrix
Matrix algebra has at least two advantages:
✓ Reduces complicated systems of equations to simple expressions
✓ Adaptable to systematic method of mathematical treatment and well suited to
computers
Definition:
A matrix is a set or group of numbers arranged in a square or rectangular array
enclosed by two brackets
𝒂𝟏𝟏 𝒂𝟏𝟐 𝒂𝟏𝟑 ⋯ 𝒂𝟏𝒏
4 2 a b 𝒂𝟐𝟏 𝒂𝟐𝟐 𝒂𝟐𝟑 ⋯ 𝒂𝟐𝒏
1 −1 − 3 0 c d ⋮ ⋮ ⋮ ⋱ ⋮
𝒂𝒎𝟏 𝒂𝒎𝟐 𝒂𝒎𝟑 ⋯ 𝒂𝒎𝒏
Fundamentals of matrix
Order of matrix
1 2 3
Dimension 4 5 6 2×3
Rows × columns
Square matrix – A matrix, where the number of rows and columns are equal
2 3 𝑖
A= 6 3 1
0 2 5 3×3
– A matrix with one column and any number of rows A =
3
−𝑖
6 3×1
Row matrix – A matrix with one row and any
number of columns 𝐴 = −1 𝑜 𝑖 1×3
Fundamentals of matrix operations
Matrix Operations:
• Matrix addition and subtraction
– Both matrices must have same order
– Add or subtract corresponding elements
– COMMUTATIVE 3 1 0 −1 𝟑 𝟎
0 2 + −2 −3 = −𝟐 −𝟏
−4 −1 −4 −5 −𝟖 −𝟔
• Scalar multiplication
– Multiply matrix with number
– Distribute 1 2 3 𝟑 𝟔 𝟗
𝑨= 3 =
0 −1 −2 𝟎 −𝟑 −𝟔
Fundamentals of matrix operations
• Matrix multiplication
-N0. of columns in 1st = N0. of rows in 2nd
𝒎×𝒏 ∙ 𝒏×𝒑
-Order of product m × p
-Order is important
A= 4 5 8 B= 2
1×3
6 1x3 = 3x1
9 3×1
Now, A x B.
2
Multiplication of a
4 5 8 × 6 = 4 (2) + 5 (6) + 8(9) = 110 Column by a Row
9
Fundamentals of matrix
Identity Matrix – This acts like “number one” for matrices, denoted as I. This matrix
must be a square matrix and have the number 1 in the main diagonal and 0’s everywhere else.
1 0 0
1 0 𝐼= 0 1 0
𝐼= 𝐴𝐼 = 𝐴
0 1 2×2 0 0 1 3×3
2 3 𝑖 2 6 0 3
𝐴= 6 3 1 𝐴𝑇 = 3 3 2 𝐴 = −𝑖 𝐴𝑇 = 3 −𝑖 6 1×3
0 2 5 3×3 i 1 5 3×3 6 3×1
Explanation of Conjugate of a matrix
Complex Conjugate of a matrix : The conjugate of a complex number is
found by switching the sign of the imaginary part. The complex conjugate of any real number
is just a real number itself. The complex conjugate of imaginary number +i is −i.
0 3+𝑖 ∗0 3−𝑖
𝐴= 𝐴 =
−𝑖 1 2×2
𝑖 1 2×2
0 3+𝑖
Conjugate Transpose of a Matrix: 𝐴=
−𝑖 1 2×2
Step 1 : Take the transpose Step 2 : Take the conjugate
𝑇 0 −𝑖 𝑇 ∗ 0
† 𝑖
𝐴 = 𝐴 =𝑨 =
3+𝑖 1 2×2 3−𝑖 1 2×2
Unitary Matrix
Defn: A matrix is said to be Unitary, if and only if
Solution:
Yes:
Example 2) Show that matrix U is unitary.
22
Dirac Representation of Qubit
✓ Qubit: A bit of data is represented by a single atom that is in one of two
states denoted by |0> and |1>. A single bit of this form is known as a
qubit
✓ Dirac representation: Qubits commonly expressed in quantum mechanical states
with mathematical formulism given by Dirac or “bra–ket” notation
✓ State of a qubit is enclosed in right half of an angled bracket, called the “ket”. (i.e., |ψ⟩)
✓ A physical implementation of a qubit could use the two energy levels of an atom. An
excited state representing |1> and a ground state representing |0>.
Light pulse of
frequency for
Excited time interval t
State
State State
|0> |1>
Nucleu
Ground s
State
Electro
n
Matrix Representation of |0⟩ & |1⟩
✓ Superposition: A qubit, |ψ⟩, is a superposition of both |0⟩ &|1⟩ :
i.e., |ψ⟩ = α |0⟩ + β |1⟩ 1
|0⟩ =
0
1 0 0
✓ Matrix Represantation: |ψ⟩ = α +β |1⟩ =
0 1 1
Now,
1 0 1 1
𝐼 |0⟩ = × = = |0⟩ 𝐼 |0⟩ = |0⟩
0 1 0 0
Applying I to |1⟩ states to show there is no change:
Let the identity operator I operates on |1⟩ state qubit. 1 0 0
𝐼= |1⟩ =
0 1 1
Now,
1 0 0 0
𝐼 |1⟩ = × = = |1⟩ 𝐼 |1⟩ = |1⟩
0 1 1 1
Pouli’s Matrices and Its Operations on |0⟩ & |1⟩ states
Pauli matrices are 2 × 2 matrices, Which are very much useful in the study of quantum
computation and quantum information.
0
1 |1⟩ =
|0⟩ = 1
0
1 0 1 1 1 0 0 0
σ0 |0⟩ = × = = |0⟩ σ0 |1⟩ = 0 1 × 1 = 1 = |1⟩
0 1 0 0
Pouli matrix σ0 does not change the |0⟩ state Pouli matrix σ0 does not change the|1⟩ state.
Pouli’s Matrix σ1 (σx) Operating on |0⟩ & |1⟩ states
0
1 |1⟩ =
|0⟩ = 1
0
0 1 0 1
0 1 1 0 σx |1⟩ = × = = |0⟩
σx |0⟩ = × = = |1⟩ 1 0 1 0
1 0 0 1
Pouli matrix σx changes the |0⟩ state to |1⟩ state. Pouli matrix σx changes the|1⟩ state to |0⟩ state.
Pouli’s Matrix σ2 (σy) Operating on |0⟩ & |1⟩ states
0
1 |1⟩ =
|0⟩ = 1
0
0 −𝑖 0 1
σy |0⟩ = 0 −𝑖
×
1
=𝑖
0
= 𝑖|1⟩
σy |1⟩ = 𝑖 0
×
1
= −𝑖
0
= −𝑖|0⟩
𝑖 0 0 1
Pouli matrix σy changes the |0⟩ state to i times |1⟩ Pouli matrix σy changes the|1⟩ state to –i times |0⟩
Pouli’s Matrix σ3 (σz) Operating on |0⟩ & |1⟩ states
0
1 |1⟩ =
|0⟩ = 1
0
1 0 0 0
σz |1⟩ = × = = −|1⟩
1 0 1 1 0 −1 1 −1
σz |0⟩ = × = = |0⟩
0 −1 0 0
Pouli matrix σZ does not change the |0⟩ state. Pouli matrix σZ changes the|1⟩ state to – |1⟩
Inner product (Row and Column matrix )
✓ Dirac representation: Qubits commonly expressed in quantum mechanical states
with mathematical formulism given by Dirac or “bra–ket” notation (i.e., ۦψ|ψ⟩ )
✓ Right half of bracket, called the “ket” (i.e., |ψ⟩ -represented by Column Matrix
Left half of bracket, called the “bra” vector (i.e., ۦψ| -represented by Row Matrix
✓ For every “ket” vector there is a corresponding “bra” vector & vice versa
Examples: 1
|ψ⟩ =
𝑎11
𝑎21
𝑎31
.
. Examples: 2
𝑎𝑛1 𝑛×1
∗
ۦψ| = 𝑎11 ∗ ∗ ∗
𝑎12 𝑎13 … … … 𝑎1𝑛 1×𝑛
Inner product (Row and Column matrix )
For a given “ket” vector and “bra” vector, we can calculate an “inner product”
|ψ⟩ =
𝑎11
𝑎21 ∗
ۦψ| = 𝑎11 ∗
𝑎12 ∗
𝑎13 ∗
… … … 𝑎1𝑛 1×𝑛
𝑎31
.
.
𝑎𝑛1 𝑛×1 𝑎11
𝑎21
𝑎31
ۦψ| ψ⟩ = 𝑎11
∗ ∗
𝑎12 ∗
𝑎13 ∗
… … … 𝑎1𝑛 ∙ . = 𝒂∗𝟏𝟏 𝒂𝟏𝟏 + 𝒂𝟏𝟐
∗
𝒂𝟐𝟏 + ⋯ … … . . +𝒂∗𝒏𝟏 𝒂𝟏𝒏
.
𝑎𝑛1
3𝑖
Sol: |w⟩= → ۦw| = −3𝑖 3
3
1
∴ ۦw| v⟩ = −3𝑖 3 ∙ = −𝟑𝒊 ∙ 𝟏 + 𝟑 𝟏 + 𝟐𝒊 = 𝟑 + 𝟑𝒊
1 + 2𝑖
3𝑖
Next, ۦv|w ⟩ = 1 1 − 2𝑖 ∙ = 𝟏 ∙ 𝟑𝒊 + 𝟏 − 𝟐𝒊 𝟑 = 𝟑 − 𝟑𝒊
3
1 0
Sol: |0⟩ = → ۦ0| = 1 0 and |1⟩ = → ۦ1| = 0 1
0 1
ۦ0| 0⟩ = 1
1
∴ 0 ∙ = 𝟏 ∙ 𝟏 + (𝟎 ∙ 𝟎) =𝟏
0
0
Next, ۦ1|1 ⟩ = 0 1 ∙ = 𝟎∙𝟎 + 𝟏∙𝟏 =𝟏
1 Inner product of
0 computational basis elements:
Further, ۦ0| 1⟩ = 1 0 ∙ = 𝟏 ∙ 𝟎 + (𝟎 ∙ 𝟏) = 𝟎
1
1
ۦ1| 0⟩ = 0 1 ∙ = 𝟎 ∙ 𝟏 + (𝟏 ∙ 𝟎) = 𝟎
0 Kronecker delta
36
Inner product (in Computational Basis)
Examples: 3 Calculate the inner product for the given vectors
37
Probability, Quantum Superposition & Normalization rule
Quantum Superposition: Any quantum state/qubit, |ψ⟩, is a superposition (i.e., linear
combination) of both |0⟩ &|1⟩.
where α and β are amplitudes and
i.e., |ψ⟩ = α |0⟩ + β |1⟩
1 𝟎
|0⟩ = |1⟩ =
1 0 0 𝟏
∴ |ψ⟩= α +β
0 1
Probability and Normalization rule: If measurements are carried out with a qubit in
superposed state then the results will be probabilistic. The total probability of a qubit
must be 100%. i.e. |α|2 +|β|2 =1
38
Probability, Quantum Superposition & Normalization rule
39
Orthogonality & Orthonormality
Orthogonal: The two states |ψ⟩ and |φ⟩ are said to be orthogonal, if their inner product
is zero.
i.e. ۦψ|φ⟩ = 0
1 0
Example: Consider the inner product of |0⟩ and |1⟩. i.e., |0⟩ = and |1⟩ =
0 1
Orthonormality
Orthonormal: The two states |j⟩ and |k⟩ are said to be orthonormal, if and only if their
inner product; (Kronecker delta)
1 0
Example: The inner product of |0⟩ and |1⟩ i.e., |0⟩ = |1⟩ =
0 and 1
1 0
Sol: |0⟩ = ۦ0| = 1 0 and |1⟩ = ۦ1| = 0 1
0 → 1 →
Example 1. A Linear Operator ’𝑋’ operates such that 𝑋 |0⟩ = |1⟩ and 𝑋 |1⟩ = |0⟩. Find the matrix
representation of ’𝑋’. Model QP1-2023
Data:, 𝑋 |0⟩ = |1⟩ & 𝑋 |1⟩ = |0⟩ Next, 𝑋 |1⟩ = |0⟩
𝑥11 𝑥12 0 1
→ ∙ =
To find: 𝑥21 𝑥22 1 0
Solution: We have, & 𝑥11 ∙ 0 + 𝑥12 ∙ 1 1
→ =
Given, 𝑋 |0⟩ = |1⟩ 𝑥21 ∙ 0 + 𝑥22 ∙ 1 0
𝑥11 𝑥12 1 0 𝑥12 1
→ ∙ = → =
𝑥21 𝑥22 0 1 𝑥22 0
𝑥11 ∙ 1 + 𝑥12 ∙ 0 0 Equating Matrices on both side, we
→ = get,
𝑥21 ∙ 1 + 𝑥22 ∙ 0 1 𝒙𝟏𝟐 = 𝟏 & 𝒙𝟐𝟐 = 𝟎
𝑥11 0
→ = 𝑥11 𝑥12
𝑥21 1 0 1
∴ =
Equating Matrices on both side, we 𝒙𝟏𝟏 = 𝟎 & 𝒙𝟐𝟏 = 𝟏 𝑥21 𝑥22 1 0
Example 2.
∴
Example 3.
Example 4. Find the inner product of states |1⟩ 𝑎𝑛𝑑 |0⟩ and draw conclusions on the result.
1 0
Solution: The inner product of |0⟩ and |1⟩ i.e., |0⟩ = and |1⟩ =
0 1
1 0
|0⟩ = → ۦ0| = 1 0 and |1⟩ = → ۦ1| = 0 1
0 1
Then, ۦ0| 1⟩ = 1 0 ∙ 0 = 𝟏 ∙ 𝟎 + (𝟎 ∙ 𝟏) =𝟎
1
Orthogonal
ۦ1| 0⟩ = 0 1 ∙ 1 = 𝟎 ∙ 𝟏 + (𝟏 ∙ 𝟎) = 𝟎
0
Example 5.
Quantum Gates
Quantum Gates
49
Single Qubit Gates
1. Quantum NOT gate (X):
• In classical computer, the NOT gate takes one input and reverse its value. Ex: changes 0 to 1 or 1 to 0.
• Quantum NOT gate (X) is similar in that a qubit in a state |0⟩ changes to |1⟩ and vice versa. When the
qubit is in a superposition of all basis states, then the superposition also flips.
• Matrix Representation: • Quantum NOT gate (X) Circuit & Truth Table
50
Single Qubit Gates
2. Pauli X, Y & Z Gates:
51
Single Qubit Gates
2.2. Pauli Y gate:
• It is represented by the Pauli matrix σy (Y).
Pouli matrix σy maps the |0⟩ state to i |1⟩ Pouli matrix σy maps the|1⟩ state to –i |0⟩
• Matrix Representation: 0 −𝑖
Y= • Pauli Y gate Circuit & Truth Table
𝑖 0
52
Single Qubit Gates
2.3. Pauli Z gate:
• It is represented by the Pauli matrix σz (Z).
Pauli matrix Z output does not for input |0⟩ . Pouli matrix Z output changes – |1⟩ for input |1⟩
53
3. Hadamard Gate (H):
• Hadamard gate is very important in quantum computing. If the qubit states in a definite |0⟩ or |1⟩
state, the Hadamard gate puts each into a superposition of |0⟩ and |1⟩ states.
• Hadamard gate (H) satisfies the Unitary condition;
• Hadamard gate (H) Circuit & Truth Table
• Matrix Representation:
54
3. Phase Gates:
• Phase shift is actually map the qubit states |0⟩ → |0⟩ and |1⟩ →eiΦ |1⟩. The probability of measuring a
|0⟩ or |1⟩ unchanged after applying this gate, however it modifies the phase of the qubit state.
• Matrix Representation:
Phase
Gates
56
• Matrix Representation:
• T gate (T) Circuit & Truth Table
1. Controlled Gates:
Def: A Gate with operation of kind "If 'A' is True then do 'B‘ is called Controlled Gate.
✓ The ‘ |A⟩ ' Qubit is called Control qubit and ‘ |B⟩ ' is the Target qubit.
✓ The target qubit is altered if and only if the control qubit is |1⟩. The control qubit remains unaltered
during the transformations.
Controlle
d Gates
• It just swaps the state of the two qubits involved in the operation.
• The circuit is as follows
• Matrix Representation:
61
Toffoli Gate
• Toffoli gate, is also known as CCNOT gate (Controlled-Controlled-Not).
• It has 3 inputs, out of which two are Control qubits and one is Target qubit.
• The Target qubit flips only when both control qubits are |1⟩. The two Control qubits are not
altered during the operation.
• Toffoli gate Truth Table
• The circuit is
• Matrix Representation:
62
Example 1. Using matrix multiplication show that on applying Hadamard gate twice to a |0⟩
results in its original state.
⸫ HH |0⟩ = |0⟩
Thus applying two Hadamard gates result in the original state of |0⟩
64
Example 2. Using tw0 X gates in series show that two NOT gates in series are equivalent to a quantum
wire.
⸫ XX |0⟩ = |0⟩
†
Solution: To show that 𝐻 𝐻 = 𝐼
†
Hence, 𝐻 𝐻 = 𝐼
Solution: The Operation of the CNOT gate could be represented as |𝑥, 𝑦⟩ → |𝑥, 𝑥 ⊕ 𝑦⟩
67
Example 5. Show that S gate can be formed by connecting two T gates in series.
68
Fundamentals of matrix
Identity Matrix – This acts like “number one” for matrices, denoted as I. This matrix
must be a square matrix and have the number 1 in the main diagonal and 0’s everywhere else.
Transpose of a Matrix : Transpose of a matrix, switches rows with columns. i.e. The
first row turns into the first column, second row turns into the second column.
Unitary Matrix
Defn: A matrix is said to be Unitary, if and only if
Solution:
Yes:
Example 2) Show that matrix U is unitary.
71
Inner product (Row and Column matrix )
Examples: 1 Calculate the inner product for the given vectors.
Sol:
Sol: and
Inner product of
computational basis elements:
Kronecker delta
73
Inner product (in Computational Basis)
Examples: 3 Calculate the inner product for the given vectors
74
Example 4. A Linear Operator ’𝑋’ operates such that 𝑋 |0⟩ = |1⟩ and 𝑋 |1⟩ = |0⟩. Find the matrix
representation of ’𝑋’. Model QP1-2023
Data:, 𝑋 |0⟩ = |1⟩ & 𝑋 |1⟩ = |0⟩ Next, 𝑋 |1⟩ = |0⟩
To find:
and
and
Orthogonal
Model QP2-2023
Example 8.