Dr. I.V. Grossu: Linear Algebra Basics
Dr. I.V. Grossu: Linear Algebra Basics
Dr. I.V. Grossu: Linear Algebra Basics
Third Edition
Quantum Algorithm Example (Grover)
Dr. I.V. Grossu
Linear Algebra Basics
Abstract
Complex Numbers Quantum Entanglement
In this work I tried to create an intuitive introduction to the fascinating domain of
Matrices Partial Measurement
Quantum Computing. Following this purpose, the first two chapters are conceived as
Vector Spaces an overview of the minimum Mathematics and Physics necessary notions, while the Measurement in Computational Basis
third chapter is dedicated to the main Quantum Computing concepts: Qubit,
Quantum Register, Quantum Algorithm, Measurement, and Partial Measurement. Quantum Algorithm
Quantum entanglement is also discussed together with an intuitive analogy, and a
Quantum Mechanics Basics concrete implementation on IBM Q Experience. In this context, I considered also a
Register
de Broglie Wavelength possible compromise between Bohr’s and Einstein’s interpretations. The fourth Qubit
chapter is discussing Grover's algorithm in contrast with classical sequential search.
Wave Function Concept Quantum Computing Basics
Bohr Atomic Model
Electron Spin Electron Spin
Bohr Atomic Model
z = (x, y); x, y in R
z1 + z2 = (x1, y1) + (x2, y2) = (x1 + x2, y1 + y2)
z1* z2 = (x1x2 – y1y2, x1y2 + x2y1)
C – the set of complex numbers
Euler’s Formula
- transpose-conjugate matrix:
Matrices
Kronecker Product
Vectors in Physics
Quantities with both magnitude and direction (x, y, z)
v1 . v2 = 0 => v1 perpendicular on v2
Example: The work of a force
Vector product:
In 3D:
|v| = Sqrt(x2 + y2 + z2) => Pythagoras
N-Dimensions generalization:
Linear Algebra
Vector Spaces
A Vector Space V over a field of complex numbers C is a non-empty set of elements on which two
operations (functions) are defined (a generalization of Vectors):
Addition
associative
commutative
neutral element: 0 vector
for each v in V exists -1 v => the inverse element
Addition
associative
commutative
neutral element: 0 vector
for each v in V exists -1 v => the inverse element
Linear Algebra
Hilbert Spaces
A Vector Space with an: Inner Product (.,.) : V X V -> C
• •
; bracket
Pythagoras
Vector Spaces in Cn
Cn Physics
•
Orthonormal Basis:
|i>
• Harmonic oscillator:
F = k y, y = A sin(ωt)
Ae i ωt phasor (write more compact expressions)
E = 0.5 k A2 ~ A2
ν = 1/T; c = λ/T = ν; ω = /T = ν
Euler’s Formula
Waves
Huygens Principle
In 1678 Huygens proposed a model where each point on a wave front may be
regarded as a source of waves expanding from that point.
de Broglie Wavelength
-> normalization
Bohr Atomic Model
•• Hydrogen
spectra is discrete
• Bohr atomic model: only the states corresponding to stationary waves
are allowed => angular momentum quantification
https://www.facebook.com/hossamibrahemm/posts/2021133031242089
Electron Spin
• Not only the angular momentum is quantified, but also its
projection in a magnetic (Zeeman Effect) or electric field
(Stark Effect)
• The elecron has an intrinsic magnetic momentum [3]
(intuitively related to an intrinsic angular momentum, spin),
with only 2 possible projections.
• An isolated electron is a superposition of both states (no
classical equivalent). Quantification of electron spin projections
Quantum Computing Basics
QUBIT - Analogy
•REFERENCES
FOR THIS CHAPTER [1,4-8]
• Consider a semaphore which randomly switches from red to green and back in
such a way that the probabilities of finding it (e.g. by taking a picture) in one
specific color are: r (for red), and g (for green). Obviously:
r+g=1
• Supposing the semaphore switches enough fast from one color to another, one
could approximate it is both red and green in the same time (e.g. the eye will
perceive both lights are on, but with different intensities) .
• Another example: at each moment of time, tossing an unusual, unfair coin (with
unequal probabilities associated to its sides).
QUBIT
•
• State-Space Postulate: An isolated physical system has an associated Hilbert space, called the state space. The state of the
system is fully described by a unit vector, called the state vector in that Hilbert space.
• QUBIT: A unit vector in C2 (e.g. electron’s spin)
• Canonical base in C2:
ORTHONORMAL BASIS
• Any two-level quantum-mechanical system (e.g. Josephson Junction) could be used as a qubit. Three-level => qutrit.
• Intuitive image: superposition of “opposite movements”, without classical equivalent.
• The supperposition applies to one single particle, not to a statistic set.
• The superposition applies only to isolated systems.
• The postulate does not give details on how to construct the corresponding Hilbert space.
• By measuring the qubit we’ll find a single value with the corresponding probabilities: |α|2, |β|2 (see next chapters).
QUBIT
•• It is important to notice that ψ is a wave function.
• Thus, α and β could be separated also by a phase difference
• A qubit is described not only by a combination of 0 and 1, but also by a
phase factor
• Another way of writing ψ for a qubit (taking into account the phase factor):
• A quantum logic gate (or simply quantum gate) is a basic quantum circuit operating on a
small number of qubits.
• Unlike many classical logic gates, quantum logic gates are reversible (unitary operators).
• In ”semaphores analogy”, an unitary operator is a device capable of changing the red/green
probability distribution.
Pauli Matrices:
Unitary Operator Examples
•
• Pλ takes into account the fact that the same eigenvalue λ could correspond to many eigenvectors.
• The measurement process is irreversible.
• The possible results of measurement of the observable O are the eigenvalues λ.
• The probability of obtaining the result λ is:
Example 2:
Measuring one qubit is instantaneously (?) affecting the other qubit too.
Application
A simple random number generator implemented on IBM Q Experience: https://quantum-computing.ibm.com/
Quantum Entanglement
2-qubit register => C4
Consider the following unit vector:
(Kronecker product)
The quantum state of the composite system as a whole, but we cannot attribute the state of the parts.
A single qubit can be in a superposed state, but it cannot be entangled, as its state is not composed of subsystems.
Quantum Entanglement - Analogy
• In semaphores analogy, one could consider two synchronized semaphores with: r1 = g1 = 0.5, and r2 =
g2 = 0.5
• As the two semaphores are not independent, it is not possible any more to obtain the compound
states probabilities by multiplying individual probabilities (Kronecker product).
• Another example: at each moment of time, tossing two tied coins.
• As result of existing bindings, stopping one semaphore results in “freezing” the other one in the same
light. What looks quite strange in quantum mechanics is that this should happen instantaneously, as if
the measurement effect is “propagating” with an infinity velocity. This was one of the famous Bohr-
Einstein debate subjects. I would suggest also that Bohr’s interpretation might be applicable with a
space/time limitation (compromise between the two points of view). Thus, after an enough long time,
the system might equally probable “fall” (the “constraint thread” breaks) into only one of its
compound states (either both semaphores red, or both green).
Quantum Entanglement – IBM Q Experience
Implementation on IBM Q Experience: https://quantum-computing.ibm.com/
1. Hadamard: applied on first qubit: q[0] =>
2. Conditional not: applied on qubits q[0], q[1] (change the second qubit only when the first one is 1) => Bell state
3. Partial measurement: the results are stored in the classical register c[0], c[1]
4. The deviation from the expected result could be considered a quantum computer precision test
5. Similarly, one can consider
Quantum Algorithm Example
Quantum Algorithm Example
•
REFERENCES FOR THIS CHAPTER [1,5,6]
Search algorithm :
for x = 0 to N-1
if f(x) = 1 then
print x
stop
end if
end for
Quantum Algorithm Example
•
Grover’s algorithm [1,5-6] :
|i>,
• Measure the register in computational basis. The result is x0, with probability
Quantum Algorithm Example
• points for understanding Grover’s algorithm:
ey
• One solution for overcoming the probabilistic nature of quantum computing could be to check the result validity (if this does not involve
significant costs). For instance, it is easy to check a value is satisfying a polynomial equation.
• Another solution is to run the program multiple times and apply statistics.
• For a concrete implementation on IBM’s 5-qubit computer [7,8], consult reference [5]
• Rf is, in fact:
• The action of RD to an arbitrary state results in flipping the amplitude of each state about the mean amplitude
• Rf => the amplitude of |x0> becomes below <a>, while all other states above <a>.
• RD => the amplitude of |x0> becomes above the mean, while all other states below
• Applying U repeatedly will increase the amplitude of |x0>
Quantum Algorithm Example
// C# .Net Simulation
public static void Test()
{
var register = Grover(3, 5);
}