0% found this document useful (0 votes)
45 views33 pages

Intro To Quantum AI

1) In a quantum computer, a qubit can exist in a superposition of both 0 and 1 states simultaneously, unlike a classical bit which can only be in one state. 2) The state of a qubit can be represented by a state vector, with the probability of being in the 0 or 1 state given by the amplitude of each state. 3) Measuring a qubit causes it to collapse from its superposition state into either the 0 or 1 state, losing its quantum properties.

Uploaded by

Harsha Bomanna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views33 pages

Intro To Quantum AI

1) In a quantum computer, a qubit can exist in a superposition of both 0 and 1 states simultaneously, unlike a classical bit which can only be in one state. 2) The state of a qubit can be represented by a state vector, with the probability of being in the 0 or 1 state given by the amplitude of each state. 3) Measuring a qubit causes it to collapse from its superposition state into either the 0 or 1 state, losing its quantum properties.

Uploaded by

Harsha Bomanna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

Introduction to Quantum

Computing and ML
A ground up explanation

Harsha.B 24/08/21
Classical Computing
Basic De initions

In a classical computer, at the


most fundamental level,
everything is represented as
bits:

1 0

Each bit in a classical


computer can have either a
value of 1 or 0
f
Classical Computing
Basic De initions
1 Bit

State Vector
A state vector is a vector which
Total 2 Possibilities (0, 1) 1 0 contains all the possible states a
system can be in, and aims to points
0 1 us towards which state the system
(0) (1) currently is in
2 Bits

Total 4 Possibilities (00, 01, 10, 11)

1 0 0 0

0 1 0 0 Length of state vector


N Bits
=
0 0 1 0 Total number of possibilities

0 0 0 1

(0,0) (0,1) (1,0) (1,1)


Total 2n Possibilities
f
Classical Computing
Basic De initions

Each logic gate in classical computing can


have di erent number of inputs and outputs
ff
f
Quantum Computers
From Bits to Qubits

In a quantum computer, a
single qubit is said to be in a
superposition of 0 and 1

This essentially means the


value of the qubit is
sometimes 0 and sometimes 1

1 0

0 1
Qubit
0〉 1〉
{

While a classical bit can be only in one of these states,


a qubit can be either of these states at a particular
instance
Source: https://www.wired.co.uk/article/quantum-computing-explained
Quantum Superposition
State vectors give probabilities

1 0 0 0

1 0 0 1 0 0

0 1 0 0 1 0

(0) (1) 0 0 0 1

We know that a classical bit can (0,0) (0,1) (1,0) (1,1)


be only in one of these states

Similarly for a 2 bit system

If we consider the following bit,


and it’s state vector

0 0% probability of being in this state (0,0)

1 100% probability of being in this state (0) 0 0% probability of being in this state (0,1)
(0) 0 0% probability of being in this state (1) (1,0) 1 100% probability of being in this state (1,0)

0 0% probability of being in this state (1,1)


Quantum Superposition
State vectors of qubits

1 0

0 1
Qubit
0〉 1〉

A single qubit is said to be in a superposition of the 0 〉and 1 〉states

We can denote this mathematically as follows:

Q = ɑ 0 〉+ β 1 〉
Quantum Superposition
What does it mean?

ɑ and β are complex numbers

1 0 Probability of Q being in state 0 〉= ɑ2


ɑ 0 + β 1
Qubit Probability of Q being in state 1 〉= β2
0〉 1〉

State Vector Probability of States


Q = ɑ 0 〉+ β 1 〉
ɑ |ɑ2| 0〉
This coe icient is This coe icient is
Qubit
β |β2| 1〉
called the called the
“Amplitude” of “Amplitude” of
state 0 〉 state 1 〉
ff
ff
Quantum Superposition
What does it really mean?
0

0
1 0 State Vector Probability of States
1

0
ɑ |ɑ2| 00 〉
(1,0) β |β2| 01 〉
A classical 2 bit system in (1,0) state γ |γ2| 10 〉

δ |δ2| 11 〉
ɑ

γ
The sum of all these
This 2 Qubit system can be values must be equal to 1
δ represented in this manner

A 2 qubit system in state:


Ψ 〉= ɑ 00 〉+ β 01 〉+ γ 10 〉+ δ 11 〉
ɑ 00 〉+ β 01 〉+ γ 10 〉+ δ 11 〉
Quantum Superposition
Let’s visualise this

The Qubit system has the highest


chance of being in this state, but can
be in other states also

A classical system of bits can only A quantum system of bits has a


represent any discrete state present probability distribution of possible
in the state vector state values
Quantum Superposition
Some simple examples

Q = 1/√2 0 〉+ 1/√2 1〉

This means Q has a (1/√2)2 chance of being in 0 〉and a (1/√2)2 chance of being in 1〉

50% 50%

Essentially, this qubit has an equal


chance to exist in both states. It’s
similar to a random coin toss
Bloch Sphere Representation
Qubits are actually in 3D!

A classical bit can only


exist at either of these 2
Ψ 〉 = ɑ 0 〉+ β 1 〉 points

Since |ɑ2| + |β2| = 1, we can rewrite the equation as follows:

Ψ 〉 = cos(θ/2) 0 〉+ eiɸsin(θ/2) 1〉

Here:

θ is the angle between the qubit vector and the Z-axis


ɸ is the angle between the qubit vector and the X-axis

A quantum bit can exist


anywhere on the surface
of this 3D sphere!
50 qubits worth of information
takes 32x10 bytes to represent
15
The power of Bloch Sphere representation
Quantum Measurement

After measurement, the


qubit can only be in one
M of these two states

Regardless of how complex a qubit’s state vector is, after Eg: If we measure the following qubit 1000 times:
measurement, it will always collapse to one discrete state
Q = 1/√2 0 〉+ 1/√2 1〉

We might get 0 〉as the measured state around 500


But, the probability of the state it collapses to follows the
probability distribution of the qubit system. times and 1 〉as the measured state the other 500 times
approximately
How to represent multiple Qubits
The tensor product

β δ
Qubit A Qubit B

A〉 B〉

Suppose we have two individual qubits having their own quantum states.
Now if we are to consider both of these qubits to be in the same system,
we will have to consider more overall possibilities of the system because
now there are 2 qubits existing simultaneously instead of single qubits.

ɑ
A
ɑδ
AB 〉= A 〉Ⓧ B 〉=
β
B
βδ
Tensor
Product
𝛄
𝛄
𝛄
We’ve looked at how Qubits are represented
Now let’s look at how they are manipulated
Quantum Gates and Circuits
How we harness the power of qubits
Quantum Circuits vs Classic Circuits
Unlike classical logic gates, quantum
logic gates will always have equal
Junctions like these are not possible in Quantum Circuits
number of inputs and outputs

In classical circuits, we can branch


In quantum circuits, the number of multiple wires inwards together or
input qubits is always the same as the outwards to multiple wires, this means
number of output qubits the number of outputs need not be the
same as the number of inputs
Quantum Gates
The basic blocks of computation with Qubits

ɑ
U
β
Q
This is how we can represent a quantum gate in a circuit

We can apply a gate on a qubit simply by


multiplying it’s corresponding matrix with
the quantum state (Q’ = UQ)
Mathematically, every gate can be
represented as a linear operator on the
quantum state (Matrix multiplication)
a b
=
ɑ’ ɑ

a b β’ c d β
U=
c d
The size of the matrix depends U
on the number of qubits we are
operating on, since here it’s one Q Q’
qubit, it’s a 2x2 matrix
Quantum Gates
The basic gates

0 1 ɑ β
Pauli-X X Action: Rotates 180o around X axis
1 0 β ɑ

Pauli-Y
0 -i ɑ
Y
-iβ
Action: Rotates 180o around Y axis
i 0 β iɑ

1 0 ɑ ɑ
Pauli-Z Z Action: Rotates 180o around Z axis
0 -1 β -β

Action: Rotate 90o around Y


Hadamard
1 1 ɑ
H 1/√2
ɑ+β
axis followed by 180o around
1/√2
1 -1 β ɑ-β X axis
Quantum Rotation Gates
A convenient set of gates for decomposition

cos(θ/2) -isin(θ/2)

Rx(θ) e-iθX/2 Each of these gates can be used to


rotate a qubit about their respective
-isin(θ/2) cos(θ/2)
axis by an angle θ/2

cos(θ/2) -sin(θ/2)

Ry(θ) e-iθY/2
sin(θ/2) cos(θ/2)
Here is where a concept called “Gate
Exponentiation” is applied. These
three gates are considered to be
exponents of the Pauli matrices
e-iθ/2 0

Rz(θ) e-iθZ/2
0 eiθ/2
What are quantum operations doing?

Every Quantum operation is


transforming a qubit’s state into
another state

ɑ ɑ’
U
β β’

a b
c d
Multiple qubit gates
When we have multiple qubits, the
required matrix to perform an
operation on this quantum state
will be bigger (In this case 4x4)

A U0
ɑ ɑ
A

U
ɑδ ɑδ
β β B U1
B
βδ βδ

4X4 Matrix If there are two separate gates acting on each qubit,
we can represent these two gates as 1 whole gate by
applying a tensor product between the two gates

U
A
U = U0 Ⓧ U1
B
𝛄
𝛄
𝛄
𝛄
Controlled Gates

A
This means that U1 is applied on
qubit B only if qubit A is set to 1

B U1
Unitary Matrices

U†U = I
This is the only constraint for a
matrix to be considered a valid
U
quantum gate!

Intuitively, we can understand that we need unitary


matrices because the quantum state represents a
If a matrix satis ies the unitary probability distribution if we square the amplitudes, and
property, then we can represent it in the sum of this probability distribution always needs to
be equal to 1.
the form of quantum gates
This means the vectors need to have a unit norm, and
unitary matrices ensure transformations on a unit norm
vector will result in another unit norm vector.

f
Unitary Matrices

Let's assume Ψ0 〉, Ψ1 〉, Ψ2 〉and


Ψ3 〉are four intermediate quantum states of
this system during the execution of this circuit.

We can always say that between any two


quantum states, we can represent that entire
operation as a single unitary matrix

Ψ0 〉 Ψ1 〉 Ψ2 〉 Ψ3 〉

Each of these arbitrary transformations can be


individually represented as a Unitary matrix
Quantum ML

archy13/Shutterstock
Overview of the QML process
Parameterized Quantum
Gates

In order for us to start training ML


models in qubits, we need to encode
our classical data (which is in bits) in
the form of qubits

Image Credits: Maria Schuld


Quantum Data Encoding

Basis Encoding: Amplitude Encoding:


Here we simply represent the classical data we want to
Here we take each data point’s value and we encode it into
encode in binary format in all the qubits. (Each qubit is
the amplitude for a particular qubit
expected to store either a 0 or a 1)

Classical Encoded
data Bits

1 -> 001 Each of these qubit has an


amplitude value which is
5 -> 101 an encoded form of the
original data value

6-> 110
Parameterized quantum circuits

This is the overall circuit

We can break down the circuit into


many “layers”, each containing
several ixed and parameterised
gates

Each individual circuit has


Within each layer we have many
parameterised gates and few ixed
individual circuits, each
gates
parameterised with some external
parameter
Image Credits: Tensor low Quantum
f
f
f
Measurement of Circuit

In order to get the inal output from the


Quantum circuit, we need to measure the
circuit to get the inal output discrete value

This formula gives the expectation value from the


output of the Quantum Circuit. This allows us to
mathematically formulate the output in terms of our
parameters inside the circuit

Image Credits: Tensor low Quantum


f
f
f
Quantum Gradients

Parameter Shift Gradients


Since parameterised quantum gates are sinusoidal
in nature, we can exploit their periodic property to
ind gradients
f
References
1. http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf
2. https://www.tensor low.org/quantum/concepts
3. https://quantumai.google/cirq/
4. https://qiskit.org/learn/
5. https://www.ibm.com/quantum-computing/what-is-quantum-computing/
6. https://pennylane.ai/qml/
7. https://www.youtube.com/c/XanaduAI
8. https://www.youtube.com/user/Owen%20Lockwood
f

You might also like