Workshop 07 - Introduction to Quantum Computing← Home → |
||||||
|
|
||||||
IntroductionAn harmonic oscillator is described by: F = ky, y = A sin(ωt)It is convenient to describe the oscillation using complex numbers: Ψ(t) = Aeiωt (phasor) Where: eix = cos x + i sin x (Euler's formula) => contains information on both OX & OY projections
A wave (propagation of a perturbation) is described by the corresponding wave function: Ψ(x,t) = A sin[2π(x/λ - t/T)] or: Ψ(x,t) = A ei2π(x/λ - t/T)
Particles (e.g. electrons) have a wave-like behavior (de Broglie) λ = h / p, E = h ν, h = 6.626 x 10-34 m2Kg/s => Planck's Constant Ψ(x,t) = A ei2π(x/λ - t/T) = A ei2π(p x - E t)/h The Davisson-Germer experiment shows Electron's diffraction:
p(x,t) = Ψ(x,t) Ψ*(x,t) = |Ψ(x,t)|2 -> density of probability to find the particle in a given state For example, an electron that could have both +1/2 and -1/2 spin states with probabilities |α|2, respectively |β|2, will be described by: |Ψ> = α|+> + β|->, with α, β complex numbers, and |α|2 + |β|2 = 1 While the wave function contains the information on both states, during measurement a single value will be find in agreement with the corresponding probabilities. QubitAs opposed to classical bit, one qubit has both 0 and 1 values at the same time, which is quite counter intuitive (e.g. a sphere spinning in both directions at the same time).A qubit could be represented as a unit vector in C2 (the set of complex numbers): Ψ = α|0> + β|1>, |α|2 + |β|2 = 1 "Semaphores Analogy" (proposed by the author) Qubit => semaphore which randomly switches from red to green and back with probabilities: r (red), and g (green) => r + g = 1 Supposing the semaphore switches fast enough from one color to another, the eye will perceive the average. Thus, one will perceive it is both red and green at the same time, but with different intensities
Together with the electron's spin, another example of a physical qubit implementation is the Josephson Junction, which is a macroscopic system with quantum behavior (superconductivity, Cooper electron pairs, Bose-Einstein condensate). Quantum RegisterIn the frame of the same "Semaphores Analogy", one could consider two independent semaphores, randomly switching, enough fast, from red to green and back, with the corresponding probabilities:(r1, g1), and (r2, g2) Thus, the probabilities of compound states could be obtained by multiplication of individual probabilities: r1 * r2, r1 * g2, g1 * r2, g1 * g2 This could be written using the matrix Kronecker product:
r1 * r2 + r1 * g2 + g1 * r2 + g1 * g2 = (r1 + g1) * (r2 + g2) = 1
Folding a piece of paper 50 times you'll almost get the distance to the Sun. Imagine the number of states of an 100 qubits register. Quantum EntanglementConsider a quantum register in which (0,0) and (1,1) states have the same probabilities:
Which is the state of each qubit in this case?
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.
Unitary OperatorsUnitary Operator: in "semaphores analogy", is a "device" capable of changing the "red/green" probabilities of one quantum register:
Each unitary operator is associated to a matrix. The action on a vector state could be obtained by matrix multiplication. It is important to mention unitary operators are preserving the norm.
Quantum logic gate: a unitary operator, acting on a small number of qubits. Unlike many classical logic gates, quantum gates are reversible. Quantum algorithm: a prescription of a sequence of unitary operators applied to an initial state:
MeasurementMeasurement: in "semaphores analogy", is a "switch" used for stopping some or all semaphores from oscillating. The semaphores will "freeze" in a single state.Thus, considering the case of a single qubit, one will find either red (with probability r) or green (with probability g).
Given the statistical nature of measurement, quantum algorithms are usually run multiple times. The Bloch CircleConsidering one qubit:Ψ=α|0> + β|1>, |α|2+|β|2=1 Without limiting generality, one could write:
Why θ/2 ? R: It is more convenient from a graphical point of view Why using the OZ axis? R: As we'll see later, the qubit could be represented, in fact, on a sphere with polar coordinates.
Examples of single qubit GatesReset: |0> not a gate but an irreversible operation.Hadamard:
IBM Quantum Platform
NOT:
Rx, Ry, Rz Rotations around the 3 axes.
Observation! One could obtain any probability for |0>, respectively |1> by employing the Ry gate. For example: Ry(π/6) => θ/2 = π/12 => 0.965 |0> + 0.258 |1> => p(0) = 0.9652 = 93.3%, p(1) = 0.2582 = 6.7% Superposition or Statistical Mix?Given the statistical nature of measurement, could one be sure the qubit is simultaneously 0 and 1? It could be simply a series of 0 and 1 values, chained with the corresponding probabilities.Let's take, for example: |+> = H |0> => |0> -> 50%; |1> -> 50% One could further apply the Ry(π/2) gate.
Theory:
Test run on a real quantum computer:
The deviation from expected result cannot be related to statistical fluctuations, as the probability of the |0> state should be either 0 or 50%! The presence of |0> is caused by Quantum Errors, e.g. qubits are very sensitive to the environment => Decoherence (loss of information from a system into the environment). The Bloch SphereOne qubit is described by its corresponding wave function:Ψ = α|0> + β|1>, |α|2 + |β|2 = 1 α and β could be also separated by a phase difference:
Thus:
The Bloch Sphere:
Z basis measurement => measurement of the projection on the Z axis The Ramsey test. Use various values for the φ parameter => sinusoidal oscillations. This test excludes the possibility of a "statistical mix", in which case the 0 and 1 probabilities would be constant (50%).
Two-qubits ExamplesKronecker product testQubit 1: Pi/3 => cos(Pi/6)|0> + sin(Pi/6)|1> = 0.86|0> + 0.5|1> => p(0) = 0.862 = 0.75, p(1) = 0.52 = 0.25 Qubit 2: Pi/4 => cos(Pi/8)|0> + sin(Pi/8)|1> = 0.92|0> + 0.38|1> => p(0) = 0.922 = 0.85, p(1) = 0.382 = 0.14
Quantum Entanglement "Synchronized semaphores":
1: Hadamard on first qubit => 2-0.5|0> + 2-0.5|1> (Diagonal State) 2: Apply the 2-bits Conditional Not (CNOT) gate => 2-0.5|0,0> + 2-0.5|1,1> (Bell State)
Exercises- Initialize the first qubit to the |+> state (50% |0>, 50% |1>).Answer: Use either Ry(π/2) or the Hadamard gate: h q[0]; - Use the Ry gate to initialize the first qubit to the (75% |0>, 25% |1>) state. Answer: cos2(θ/2) = 0.75 => cos(θ/2) = SQRT(0.75) = 0.866 => θ/2 = acos(0.866) = 0.5236 rad => θ = 1.047 rad ry(1.047) q[0]; - Initialize the first qubit to (75% |0>, 25% |1>) and check the effect of applying the Not gate. Answer: x q[0]; => (0.25, 0.75) probabilities inversion - Initialize the first qubit to (75% |0>, 25% |1>) and apply various Rz rotations with φ between 0 and π. Answer: rz(1.2) q[0]; => one can notice the 0 and 1 probabilities are not affected by the phase φ. - Initialize the first qubit to (75% |0>, 25% |1>). Initialize the second qubit to (60% |0>, 40% |1>). Verify the Kronecker matrix multiplication. Answer: θ2 = acos(SQRT(0.6)) = 0.684 rad => θ = 1.369 rad => ry(1.369) q[1]; (0.6, 0.4) X (0.75, 0.25) => 0.6 X 0.75 = 0.45, 0.6 X 0.25 = 0.15, 0.4 X 0.75 = 0.3, 0.4 X 0.25 = 0.1 - For the previous 2-qubits circuit, apply the Swap gate and check the Kronecker multiplication. Answer: swap q[0], q[1]; (0.75, 0.25) X (0.6, 0.4) => 0.75 X 0.6 = 0.45, 0.75 X 0.4 = 0.3, 0.25 X 0.6 = 0.15, 0.25 X 0.4 = 0.1 - Try obtaining the 2-qubits (40% |00>, 20% |01>, 35% |10>, 5% |11>) state using the Ry gate. Answer: (r1,g1) X (r0,g0) = (r1 r0, r1 g0, g1 r0, g1 g0) => try solving the system of equations => (r1 r0) / (r1 g0) = r0 / g0 = 0.4 / 0.2 = 2; r0 + g0 = 1 => g0 = 1/3 => r0 = 2/3; r1 = 0.6; g2 = 0.4 (0.6, 0.4) X (2/3, 1/3) = (0.4, 0.2, 0.26, 0.13) != (0.4, 0,2, 0.35, 0.05) Not possible - Initialize a 2-qubits register to each of the following states : 100% |00>; 100% |01>; 100% |10>; 100% |11>. In each case, check the action of the Conditional Not gate. Answer: cx q[0], q[1]; => Not is applied on q[1] only when q[0] = 1. - Create a circuit for obtaining the 50% |01>, 50% |10> entangled state. Answer: - Create a 4-quibits (0 to 15) random number generator. Answer: bring the 4-qubit register into the diagonal state (equal probabilities) by applying Hadamard on each qubit. Thus, the output of each measurement will be a random number between 0 and 2n-1. References:IBM - Learn quantum computingIBM Quantum Platform Single qubit neural quantum circuit for solving Exclusive-OR Introduction to Quantum Computing |
||||||
|
← Home → |