Quantum Computing CS
Quantum Computing CS
QUANTUM
COMPUTING
CONTENT:
❖Quantum Gates
➢ Single Qubit Gates
➢ Multiple Qubit Gates
2
3
What is Quantum Computing?
• Quantum computing is the computer
technology based on the principles of
quantum theory, which explains the nature
and behaviour of energy and matter on the
quantum (atomic and subatomic) level.
• Quantum computing is essentially harnessing
and exploiting the amazing laws of quantum
mechanics to process information.
4
History of Quantum Computing
▪ “I think I can safely say that nobody understands
quantum mechanics” - Feynman
▪ 1982 - Feynman proposed the idea of creating machines
based on the laws of quantum mechanics instead of the
laws of classical physics.
5
History of Quantum Computing
• In 1994, Peter Shor devised an algorithm that could use
only 6 qubits to perform some basic factorizations ...
more cubits the more complex the numbers requiring
factorization became, of course.
• The first, a 2-qubit quantum computer in 1998, could
perform trivial calculations before losing decoherence
after a few nanoseconds.
• In 2000, teams successfully built both a 4-qubit and a
7-qubit quantum computer.
• Research on the subject is still very active, although
some physicists and engineers express concerns over
the difficulties involved in upscaling these experiments
to full-scale computing systems. 6
7
8
9
10
11
12
13
▪ Moore’ law slowing down
in 2020 it is flattened
out.
▪ Transistor cannot be
made smaller due to the
laws of Quantum
mechanics starts to take
over
• Cryptography
• Artificial intelligence
• Teleportation
• Quantum
communication
19
Advantages
Faster computations:-
These type of computers can perform computation at a much
faster rate than normal computers. Quantum computers have
computation power higher than supercomputers also. They can
process data at 1000 times faster than normal computers and
supercomputers. Some calculations if performed by a normal
computer can take 1000 years is done by quantum computers in a
few seconds.
Best for simulation:-
Quantum computers are best for doing data simulation
computing. There are many algorithms created that can simulate
various things like weather forecasting, chemical simulation etc.
20
Advantages Cont.
Medicine creation:-
These type of computers can work better in the medical field. They
can detect diseases and can create a formula for medicines.
Different type of diseases can be diagnosed and tested in scientific
laboratories using these computers.
Google search:-
Quantum computers are used by Google to refine searches. Now
every search on Google can speed up by using these computers. Most
relevant results can be populated using quantum computing.
High privacy:-
These computers can make high encryption and is good at
cryptography. It is impossible to break the security of quantum
computers. Recently China has launched a satellite that uses
quantum computing and china claimed that this satellite cannot be
hacked. 21
Disadvantages
Algorithm creation:-
For every type of computation, it needs to write a new algorithm.
Quantum computers cannot work as classical computers, they
need special algorithms to perform tasks in their environment.
The low temperature needed:-
As the processing in these computers is done very deeply so it
needs a temperature of negative 460 degrees F. This is the lowest
temperature of the universe and it is very difficult to maintain
that temperature.
Not open for public:-
Due to the high range price they are not available for public use.
Also, the errors in these type of computers are high because they
are still in the development phase. Quantum computers work fine
in 10 qubits but after increasing qubits like 70 qubits, the
accuracy is not right. 22
• Decoherence
• Error correction
• Output observance
• Cost
23
What Is “Qubit”?
24
Qubit………………………..
25
26
27
Implementations of a “Qubit”
• Spin orientation of an electron
Most quantum particles behave like little magnets. We call this
property spin. The spin orientation is always pointing either
fully up or fully down but never in between. Using the spin
states of up and down, we can build a spin qubit.
= pointing up, = pointing down
28
Energy level of an atom
We can use the energy levels of electrons in neutral atoms
or ions as qubits. In their natural state, these electrons
occupy the lowest possible energy levels. Using lasers, we
can “excite” them to a higher energy level. We can assign
the qubit values based on their energy state.
= low energy state, = high energy state
29
PATH QUBIT:
The path a photon takes is another way to define a qubit. We
can actually put a photon in a superposition of being “here”
and “there”, by using beam-splitters.
30
Polarization of a photon.
Each photon carries an electromagnetic field
with a specific direction, known as its
polarization. The two states used to define
qubits are horizontal polarization and vertical
polarization.
= horizontal, = vertical
31
32
Wave Function Ψ(x, t)
• Gives all the information about the
particle
• Ψ 2
gives you the probability
33
Qubits
Two dimensional quantum systems are called qubits
Examples:
Valid qubit wave functions:
ȁΨۧ Ψ
ȁΨۧ Ψ
0 or 1
ȁΨۧ
then the probability that we observe is
probability
ȁΨۧ
new wave function
1 ȁΨۧ
ȁΨۧ Ψ
38
What Is “Quantum”?
39
Superposition gives quantum computers superior
computing power
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
43
Matrices
Rectangular array of numbers
– Dimension
– Rows × columns
1 2 3
4 5 6 2×3
45
Square matrix – A matrix, where the number of rows
and columns are equal
2 3 𝑖
A= 6 3 1
0 2 5 3×3
3
A = −𝑖
6 3×1
46
Row matrix – A matrix with one row and any number
of columns
𝐴 = −1 𝑜 𝑖 1×3
47
Matrix Operations
• Matrix addition and subtraction
– Both matrices must have same order
– Add or subtract corresponding elements
– COMMUTATIVE
3 1 0 −1 3 0
0 2 + −2 −3 = −2 −1
−4 −1 −4 −5 −8 −6
48
Matrix Operations
• Scalar multiplication
– Multiply a matrix with a
number
– Distribute
1 2 3 3 6 9
𝐴= 3 =
0 −1 −2 0 −3 −6
49
• Matrix multiplication
𝑚×𝒏 ∙ 𝒏×𝑝
Order of product m × p
Order is important
0
2 −1 7
• −2
0 6 −3 2×3
3 3 ×1
=
2 ∙ 0 + −1 −2 + 7 ∙ 3
0 ∙ 0 + 6 ∙ −2 + −3 ∙ 3 2×1
23
= 2×1
−21 51
Multiplication of a Column by a Row
A= 4 5 8 B= 2
1×3
6
Now, lets multiply A x B.
9 3×1
1x3 = 3x1
2 3 𝑖 2 6 0
𝐴= 6 3 1 𝐴𝑇 = 3 3 2
0 2 5 3×3 i 1 5 3×3
3
𝐴 = −𝑖 𝐴𝑇 = 3 −𝑖 6 1×3
6 3×1
53
Identity Matrix – This acts like the number one for matrices,
denoted with a capital I. This matrix must be a square matrix
and have the number one 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
𝐴𝐼 = 𝐴 54
Complex Conjugate of a matrix : A
matrix with conjugate of the matrix
elements
0 3+𝑖
𝐴=
−𝑖 1 2×2
∗ 0 3−𝑖
𝐴 =
𝑖 1 2×2
55
Conjugate Transpose of a Matrix
0 3+𝑖
𝐴=
−𝑖 1 2×2
Step 1 : Take the
transpose
𝑇0 −𝑖
𝐴 =
3+𝑖 1 2×2
Step 2 : Take the
conjugate
𝑇 ∗ † 0 𝑖
𝐴 =𝐴 =
3−𝑖 1
56 2×2
Unitary Matrices
A matrix is unitary if
N x N identity
matrix
57
Unitary Example
Conjugate:
Conjugate
transpose:
Unitary?
58
Yes:
Vectors, Complex numbers and Matrices
“ket” is the th component of the vector
“column vector”
Example:
3 dimensional complex vectors
59
Computational Basis
Some special vectors:
Example:
2 dimensional complex vectors (also known as: a qubit!)
60
Computational Basis
Vectors can be “expanded” in the computational basis:
Example:
61
Bras and Kets
For every “ket,” there is a corresponding “bra” & vice versa
Examples:
62
Antiket Math
Multiplied by complex number
Example:
Addition
Example:
63
Computational Bras vector
Computational Basis, but now for bras:
Example:
64
The Inner Product
Given a “bra” and a “ket” we can calculate an “inner product”
67
Kronecker delta
The Inner Product in Comp. Basis
68
Norm of a Vector
Norm of a vector:
∗
Equivalent to Ψ = ΨΨ 2
Example:
69
Probability Always 1
The wave function of a N dimensional quantum system
is given by an N dimensional complex vector with norm equal
to one.
Example:
a valid wave function for a 3 dimensional quantum system
70
Orthogonality
Two vector x and y are orthogonal if they are perpendicular
to each other i.e. their dot product is 0.
71
Orthogonal states
Two states are said to be orthogonal if their inner
product is zero
𝑢𝑣 =0
OrthoNormal states
74
Quantum NOT gate
75
76
Pauli-X or Quantum NOT gate
The Pauli-X gate is the quantum analog to the classical NOT gate, i.e. it
transforms a single qubit in state |0> to state |1> and vice versa. Its
symbol is usually a ‘X’ inside a square or a cross inside a circle:
78
Pauli-Z
The Pauli-Z quantum gate takes one qubit and rotates it around
the z-axis of the Bloch Sphere by π radians. Its symbol inside a
quantum
circuit diagram is usually ‘Z’.
Matrix representation of the Pauli-Z quantum gate
79
80
81
Hadamard
Quantum computing is all about making use of superposition . In order to create a
superposition, you can use the Hadamard gate which takes a single qubit and
transforms it into a perfectly balanced superposition of the |0> and |1> states
Quantum circuit diagram of the Hadamard gate
H=
85
86
87
88
89
90
Multiple Qubit Gates
91
Controlled Not
By the term ‘controlled’ we imply that the respective operation is only performed
in case another qubit is in the |1> state. This other qubit is called the control
qubit. In case of the Controlled Not (or CNOT) operation, we only switch the state
of the qubit if the control qubit is |1>
92
Control Qubit
Target Qubit
93
Quantum Gates - Controlled NOT
▪A gate which operates on two qubits is called a
Controlled-NOT (CN) Gate. If the bit on the control
line is 1, invert the bit on the target line.
Input Output
A B A’ B’
A - Target A’
0 0 0 0
B- B’ 0 1 1 1
Control
1 0 1 0
1 1 0 1
94
Note: The CN gate has a similar behavior to the XOR gate with some
extra information to make it reversible.
95
96
Controlled Z gate
97
Toffoli (CNOT) Gate
101