Narration / Transcript
Quantum Information Processing: Foundations - Part 1
This is what the narrator says, not what the page shows: equations are read as sentences, code blocks are described, and citations are spoken as citations.
- 0:00
Introduction
- 0:02
For decades, computation has mostly been carried out via machines that represent data in one of two states: 0 or 1. These machines, most probably including the one you are reading this with, are classified as classical computers. The rise in the study of quantum mechanics and information theory in the last decades of the twentieth century birthed a more powerful alternative, see Rieffel and Polak, 2014 termed Quantum Computing (QC), a term commonly attributed to Richard Feynman and the independent work of Yuri Manin, see Rieffel and Polak, 2014. QC extends classical computing's data representation to include "superposed" (linear combinations) states — which can be infinite, see Bernhardt, 2019. This idea of superposition is the cornerstone of this computing paradigm. And instead of classical computers' b i t, quantum computers' base unit is q u b i t — an abbreviation of quantum and bit, coined by Ben Schumacher in his 1995 "Quantum coding" paper, see Schumacher, 1995. In simple terms, QC fundamentally, using Mathematics and Physics, supercharges computing. As demonstrated by Deutsch-Jozsa, Simon, Grover, and Shor's algorithms (which will be discussed in this series), we can have speedups ranging from quadratic to exponential in computational algorithms. Certain encryption protocols have, as reported in October 2024, been broken by Chinese researchers using a quantum algorithm, see Swayne, 2024.
- 1:32
In this series, we'll be introduced to the theories of QC from notations, measurements, superposition, and entanglement to sophisticated algorithms such as Grover's and Shor's. We will use worked mathematical examples accompanied (mostly) by code verification (using Qiskit and/or Cirq). Most of the problems will be taken from, see Rieffel and Polak, 2014, and their mathematical solutions will be more thoroughly explained for clarity. This is to really understand the concepts. I suggest you check out, see Bernhardt, 2019 and Rieffel and Polak, 2014 for deeper or more theoretically approachable knowledge.
- 2:09
Prerequisite
- 2:11
Quantum computing relies on mathematical principles, but you can learn the essentials without being a math whiz. A working knowledge of high school math will equip you to understand the applications and fundamental ideas. Familiarity with the Python programming language will be helpful to understand qiskit and/or cirq code.
- 2:32
Dirac notation
- 2:34
In quantum mechanics/physics, Dirac notation, named after Paul Adrien Maurice Dirac, the English Mathematician and Theoretical Physicist who developed it in the 1930s, is used to depict quantum states alongside their transformations, see Rieffel and Polak, 2014. It is composed of two vectors: ket psi and bra psi. ket psi, termed k e t, represents the column vector of the quantum states whereas bra psi, regarded as b r a, is the row vector.
- 3:01
Important things to note here are:
- 3:04
psi raised to the dagger power is equivalent to the b r a, bra psi, and is obtained by taking the Hermitian (conjugate transpose) of psi. For example, if: Equation: psi equals the fraction with numerator 1 and denominator the square root of 2 times the 2 by 1 column matrix 1 i. Then its conjugate transpose (bra) is: Equation: psi to the power dagger equals bra psi equals 1 over the square root of 2 bmatrix 1 minus i.
- 3:32
This operation involves taking the transpose and then applying complex conjugation to each element, see Lopez and colleagues, 2025. It can then easily be inferred that: Equation: psi times psi raised to the dagger power equals open paren the fraction with numerator 1 and denominator the square root of 2 times the 2 by 1 column matrix 1 i close paren times open paren the fraction with numerator 1 and denominator the square root of 2 times the 1 by 2 row matrix 1 negative i close paren. Equation: equals one half times the 2 by 1 column matrix 1 i times the 1 by 2 row matrix 1 negative i equals one half times the 2 by 2 matrix Row 1: Column 1, 1 times 1 Column 2, 1 times negative i Row 2: Column 1, i times 1 Column 2, i times negative i equals one half times the 2 by 2 matrix Row 1: 1 negative i Row 2: i 1.
- 4:25
Note that psi times psi raised to the dagger power is not equal to I, but instead produces a projection matrix. If we instead compute: Equation: psi raised to the dagger power times psi equals open paren the fraction with numerator 1 and denominator the square root of 2 times the 1 by 2 row matrix 1 negative i close paren times open paren the fraction with numerator 1 and denominator the square root of 2 times the 2 by 1 column matrix 1 i close paren. Equation: equals one half times open paren 1 times 1 plus negative i times i close paren equals one half times open paren 1 plus 1 close paren equals 1.
- 5:05
So we conclude that the inner product (braket) is 1: Equation: the inner product of psi and psi equals 1.
- 5:12
However, if psi is u n i t a r y — a matrix whose inverse is equal to its conjugate transpose — then: Equation: psi raised to the dagger power times psi equals psi times psi raised to the dagger power equals I.
- 5:29
For example, consider the Hadamard gate H: Equation: H equals the fraction with numerator 1 and denominator the square root of 2 times the 2 by 2 matrix Row 1: 1 1 Row 2: 1 negative 1.
- 5:44
Its Hermitian conjugate is: Equation: the dagger power of H equals the T power of H equals the fraction with numerator 1 and denominator the square root of 2 times the 2 by 2 matrix Row 1: 1 1 Row 2: 1 negative 1.
- 6:01
Since all entries are real. Then: Equation: the dagger power of H of H equals one half times the 2 by 2 matrix Row 1: 1 1 Row 2: 1 negative 1 times the 2 by 2 matrix Row 1: 1 1 Row 2: 1 negative 1 equals one half times the 2 by 2 matrix Row 1: Column 1, 1 plus 1 Column 2, 1 minus 1 Row 2: Column 1, 1 minus 1 Column 2, 1 plus 1 equals the 2 by 2 matrix Row 1: 1 0 Row 2: 0 1 equals I.
- 6:28
Therefore, H is unitary. All quantum gates (to be discussed) are unitary.
- 6:34
While the inner product results in a number (scalar), the outer product, ket psi bra psi, produces a matrix: Equation: ket psi bra psi equals 1 over 2 bmatrix 1 i bmatrix 1 minus i equals 1 over 2 bmatrix 1 minus i i 1.
- 6:52
This outer product is a nifty tool for converting matrices to Dirac notation.
- 6:58
In a Hilbert space (quantum vector space), states like ket 0 and ket 1 are:
- 7:03
Orthogonal: the inner product of 0 and 1 equals 0
- 7:08
Normalized: the inner product of 0 and 0 equals 1
- 7:13
Superposition Principle and Measurements
- 7:16
In quantum mechanics, as in general physics, a system remains in an indeterminate state until it is measured. Quantum states are typically represented in superpositions, following the superposition principle, which states, see Shor, 2022:
- 7:32
Let ket a and ket b be two quantum states that are perfectly distinguishable — that is, orthogonal. If alpha and beta are complex numbers such that the sum of their squared magnitudes is 1, then the linear combination (superposition): Equation: alpha ket a plus beta ket b.
- 7:51
is a valid quantum state.
- 7:53
An important takeaway here is the condition that "the sum of their squared magnitudes is 1". This is the simplified consequence of the Born rule, formulated by the German-British physicist Max Born in his 1926 paper, see Born, 1926.
- 8:11
In QC, measurements are more nuanced, as there are multiple possible measurement bases. The most commonly used is the computational basis, consisting of the states ket 0 and ket 1. Let's go through examples (Exercise 2.6 in, see Rieffel and Polak, 2014) of how to measure in QC.
- 8:32
Question 1:
- 8:34
Describe the possible measurement outcomes and give the probability for each outcome for this pair consisting of a state and a measurement basis: Equation: ket psi equals the square root of 3 over 2 ket 0 plus 1 over 2 ket 1, ket 0, ket 1.
- 8:51
Solution:
- 8:53
When a quantum state is subjected to a measurement in a specific basis, the possible results of that measurement directly correspond to the states that constitute the measurement basis. In this case, since the measurement basis is ket 0, ket 1, the possible outcomes of measuring the state ket psi are obtaining the state ket 0 or obtaining the state ket 1.
- 9:16
Now, let's proceed to estimate its probabilities: Equation: P sub ket 0 equals | the square root of 3 over 2 | squared equals 3 over 4. Equation: P sub ket 1 equals | 1 over 2 | squared equals 1 over 4.
- 9:32
Check:
- 9:34
Recall that from the Born rule, see Born, 1926, a state: Equation: ket psi equals alpha ket 0 plus beta ket 1.
- 9:44
must have its probabilities (squares of the amplitudes) equal to 1: Equation: the absolute value of alpha squared plus the absolute value of beta squared equals 1. Equation: P sub ket 0 plus P sub ket 1 equals 3 over 4 plus 1 over 4 equals 1 plus 3 over 4 equals 1.
- 10:05
Code implementation using Google cirq
- 10:08
To begin, we need to define a q u b i t in Cirq. This can be done using cirq dot Named Qubit or cirq dot Line Qubit. For this example, we will use cirq dot Named Qubit. Next, we create a quantum circuit using cirq dot Circuit. To prepare the desired quantum state ket psi equals the square root of 3 over 2 ket 0 plus 1 over 2 ket 1, we will define the target state vector with numpy dot array and pass its result in cirq dot State Preparation Channel.
- 10:34
There is another, more mathematical and accurate way to do this, using rotation, but since we haven't introduced the concept yet, we will go with this.
- 10:44
Then, to verify the probabilities, we need to add a measurement operation to the circuit in the computational basis. Cirq provides the cirq dot measure function or the cirq dot Measurement Gate for this purpose. To retrieve the results, we need to simulate the quantum circuit. cirq dot Simulator shines here. The complete code is now: The Python code below is 39 lines, from check dot py.
- 11:08
Question 2:
- 11:10
Describe the possible measurement outcome and give the probability for the outcome for this pair consisting of a state and a measurement basis: Equation: ket psi equals ket minus i, ket 0, ket 1.
- 11:24
Solution
- 11:26
The measurement basis for this is exactly equal to the previous one. It's only the state that differs. So the possible outcomes still hold.
- 11:35
Let's zoom in on the state: Equation: ket psi equals ket minus i.
- 11:41
We'll introduce the concept of the Bloch Sphere here.
- 11:44
The Bloch Sphere is a geometric representation of a qubit's state space, which helps visualize superposition.
- 11:52
Here's an illustration:
- 11:54
According to the Bloch Sphere (will be discussed more later) above, the given state: Equation: ket minus i equals 1 over the square root of 2 (ket 0 minus i ket 1) equals 1 over the square root of 2 ket 0 minus 1 over the square root of 2i ket 1.
- 12:13
From this, their probabilities are calculated as follows: Equation: P sub ket 0 equals | 1 over the square root of 2 | squared equals 1 over 2. Equation: P sub ket 1 equals | minus 1 over the square root of 2i | squared equals | minus i | squared times | 1 over the square root of 2 | squared equals minus times minus 1 times 1 over 2 equals 1 over 2.
- 12:37
Since i squared equals open paren the square root of negative 1 close paren squared equals negative 1.
- 12:45
Check:
- 12:46
P sub ket 0 plus P sub ket 1 equals 1 over 2 plus 1 over 2 equals 1.
- 12:53
Simulating the circuit with Qiskit or Cirq is left as an exercise to the reader.
- 12:59
Question 3:
- 13:01
Describe the possible measurement outcome and give the probability for the outcome for this pair consisting of a state and a measurement basis: Equation: ket psi equals ket 0, ket plus, ket minus.
- 13:15
Solution
- 13:17
As mentioned earlier, when a quantum system is measured with respect to a particular basis, the possible outcomes of that measurement are the basis states themselves. In this scenario, the measurement is performed in the Hadamard basis, which is comprised of the states ket plus and ket minus. Consequently, the only possible outcomes of measuring a qubit in the ket plus, ket minus basis are the qubit collapsing into either the ket plus state or the ket minus state.
- 13:45
To find the probabilities of these outcomes, we need to know that: Equation: ket plus is equivalent to ket 0 plus ket 1 over the square root of 2. Equation: ket minus is equivalent to ket 0 minus ket 1 over the square root of 2.
- 14:02
and that the given state, ket 0, is: Equation: ket 0 equals 1 over the square root of 2 (ket plus plus ket minus).
- 14:11
From here, we can simply estimate the probabilities of each of the outcomes: Equation: P sub ket plus equals | 1 over the square root of 2 | squared equals 1 over 2. Equation: P sub ket minus equals | 1 over the square root of 2 | squared equals 1 over 2.
- 14:29
Another approach (which works for even the preceding and succeeding exercises since it's fundamental) is to use the idea of inner product. Since the measurement basis is ket plus, ket minus and the given state is ket 0, the probability of each measurement outcome is the square of the inner product of the state with the measurement outcome. In other words: Equation: P sub ket plus equals | the inner product of plus and 0 | squared. Equation: P sub ket minus equals | the inner product of minus and 0 | squared. therefore Equation: P sub ket plus equals | the inner product of 1 over the square root of 2(ket 0 plus ket 1) and 0 | squared equals 1 over 2 | (bra 0 plus bra 1) ket 0 | squared.
- 15:15
The b r a simply transforms ket 0 and ket 1 to row vectors: bra 0 and bra 1. Multiplying out: Equation: P sub ket plus equals 1 over 2 | the inner product of 0 and 0 plus the inner product of 1 and 0 | squared equals 1 over 2|1 plus 0| squared equals 1 over 2.
- 15:36
Similarly, Equation: P sub ket minus equals | the inner product of 1 over the square root of 2(ket 0 minus ket 1) and 0 | squared equals 1 over 2 | (bra 0 minus bra 1) ket 0 | squared. Equation: equals 1 over 2 | the inner product of 0 and 0 minus the inner product of 1 and 0 | squared equals 1 over 2|1 minus 0| squared equals 1 over 2.
- 16:02
Check
- 16:03
This is another cirq code for this: The Python code below is 42 lines, from check dot py.
- 16:10
Question 4:
- 16:12
Describe the possible measurement outcome and give the probability for the outcome for this pair consisting of a state and a measurement basis: Equation: ket psi equals 1 over the square root of 2 (ket 0 minus ket 1), ket i, ket minus i.
- 16:29
Solution
- 16:31
Again, since the state is measured in ket i, ket minus i, the possible measurement outcomes are obtaining the system in the state ket i or in the state ket minus i.
- 16:42
Now, there are two approaches to finding the probabilities of these outcomes. We will explore the fundamental (inner product) approach first.
- 16:51
Recall that:
- 16:53
Given a state ket psi, the probability of each of the measurement outcomes in the given basis is the square of the inner product of the state with each of the measurement outcomes.
- 17:04
and (from the Bloch Sphere): Equation: gather ket i equals 1 over the square root of 2(ket 0 plus i ket 1) bra i equals 1 over the square root of 2(bra 0 minus i bra 1). Equation: gather ket minus i equals 1 over the square root of 2(ket 0 minus i ket 1) bra minus i equals 1 over the square root of 2(bra 0 plus i bra 1).
- 17:29
Therefore, Equation: P sub ket i equals | the inner product of i and psi| squared. Equation: P sub ket minus i equals | the inner product of minus i and psi| squared.
- 17:42
Let's expand P sub ket i out first: Equation: align notag P sub ket i equals | the inner product of i and psi| squared notag equals | the inner product of 1 over the square root of 2(ket 0 plus i ket 1) and 1 over the square root of 2 (ket 0 minus ket 1) | squared notag equals 1 over 4 | (bra 0 minus i bra 1)(ket 0 minus ket 1) | squared notag equals 1 over 4|(the inner product of 0 and 0 minus the inner product of 0 and 1 minus i the inner product of 1 and 0 plus i the inner product of 1 and 1)| squared notag equals 1 over 4|1 plus i| squared.
- 18:08
Given a complex number z equals a plus b i, its magnitude the absolute value of z equals the square root of a squared plus b squared. So, the absolute value of 1 plus i equals the square root of 1 squared plus 1 squared equals the square root of 2. therefore Equation: P sub ket i equals 1 over 4(the square root of 2) squared equals 1 over 4 times2 equals 1 over 2.
- 18:35
In the same vein, P sub ket minus i is estimated as follows: Equation: align notag P sub ket minus i equals | the inner product of minus i and psi| squared notag equals | the inner product of 1 over the square root of 2(ket 0 minus i ket 1) and 1 over the square root of 2 (ket 0 minus ket 1) | squared notag equals 1 over 4 | (bra 0 plus i bra 1)(ket 0 minus ket 1) | squared notag equals 1 over 4|(the inner product of 0 and 0 minus the inner product of 0 and 1 plus i the inner product of 1 and 0 minus i the inner product of 1 and 1)| squared notag equals 1 over 4|1 minus i| squared notag equals 1 over 4 times (the square root of 1 squared plus (minus 1) squared) squared equals 1 over 4 times2 notag equals 1 over 2..
- 19:02
Of course, they obey the Born rule.
- 19:05
A second approach is to flex some mathematical muscle and some intuition derived from the fact that the given state can be expressed in terms of the measurement basis.
- 19:16
Imagine alpha and beta coefficients such that: Equation: equation tag 3i ket psi equals a ket i plus b ket minus i.
- 19:26
Substituting 1 and 3 into 3 i: Equation: align notag 1 over the square root of 2 (ket 0 minus ket 1) equals alpha times 1 over the square root of 2 (ket 0 plus i ket 1) plus beta times 1 over the square root of 2 (ket 0 minus i ket 1) 1 over the square root of 2 ket 0 plus minus 1 over the square root of 2 ket 1 equals alpha plus beta over the square root of 2 ket 0 plus alpha i minus beta i over the square root of 2 ket 1.
- 19:52
Comparing both sides of 5 with the respective values of ket 0 and ket 1: Equation: align notag 1 over the square root of 2 ket 0 equals alpha plus beta over the square root of 2 ket 0 tag 3ii alpha plus beta equals 1.
- 20:11
and Equation: align notag minus 1 over the square root of 2 ket 1 equals alpha i minus beta i over the square root of 2 ket 1 notag alpha i minus beta i equals minus 1 notag i (alpha minus beta) equals minus 1 notag alpha minus beta equals minus 1 over i equals minus 1 over i times i over i equals minus i over i squared equals minus i over minus 1 tag 3iii alpha minus beta equals i.
- 20:40
Solve 3 i i and open paren 3 i i i close paren simultaneously by adding them together (substitution method), Equation: 1 lines Line 1: blank 2 lines Line 1: alpha plus beta equals 1 Line 2: alpha minus beta equals i blank blank. Equation: 2 lines Line 1: 2 alpha equals 1 plus i Line 2: blank alpha equals the fraction with numerator 1 plus i and denominator 2 blank blank.
- 21:07
Let's substitute alpha in 3 i i: Equation: 3 lines Line 1: the fraction with numerator 1 plus i and denominator 2 plus beta equals 1 Line 2: beta equals 1 minus the fraction with numerator 1 plus i and denominator 2 Line 3: blank beta equals the fraction with numerator 2 minus open paren 1 plus i close paren and denominator 2 equals the fraction with numerator 1 minus i and denominator 2 blank blank.
- 21:34
With these, our imagined expression becomes: Equation: ket psi equals 1 plus i over 2 ket i plus 1 minus i over 2 ket minus i.
- 21:45
So, Equation: P sub ket i equals | 1 over 2 (1 plus i) | squared equals | 1 over 2 | squared times |(1 plus i)| squared equals 1 over 4 times (the square root of 1 squared plus (1) squared) squared equals 1 over 4 times 2 equals 1 over 2. Equation: P sub ket minus i equals | 1 over 2 (1 minus i) | squared equals | 1 over 2 | squared times |(1 minus i)| squared equals 1 over 4 times (the square root of 1 squared plus (minus 1) squared) squared equals 1 over 4 times 2 equals 1 over 2.
- 22:11
Arriving at the same answers with the first approach, though longer.
- 22:15
Any of these approaches can be used to tackle problems of this nature. The first approach is quite a generalist!
- 22:23
Before closing up here, let's write a cirq simulation for this: The Python code below is 27 lines, from check dot py.
- 22:31
Outro
- 22:33
Enjoyed this article? I'm a Software Engineer and Technical Writer actively seeking new opportunities to impact and learn, particularly in areas related to web security, finance, healthcare, and education. If you think my expertise aligns with your team's needs, let's chat! You can find me on LinkedIn and X. I am also an email away.