A Gentle Introduction to Quantum Computing in Physics

In this post, I’ll explain the background idea of quantum computing as an aside topic in order for establishing your intuitive understanding.

As you know, quantum computing uses “Qubits”, instead of “Bits” used in current popular computing by Neumann architecture. The behavior of this “Qubits” is not easy to understand for humans, then it will prevent us to understand quantum computing.

It’s sure that the quantum behaviors will not be intuitively understood by the humans, but the purpose of this post is to make you understand the “idea” of this mechanics with comprehensive physical examples.
In order to build your intuition for regular IT engineers, we refer real physical cases (never use metaphor) as possible and I’ll describe using entry level of physics and mathematics without complicated formula or proofs. (I will explain more advanced topics as a note, if needed.)

“The Feynman Lectures on Physics – Volume III (Quantum Mechanics)” is a good reading for your entry of quantum mechanics (it’s a little bit old and not focusing on quantum computing though), then this post would also refer to several examples and descriptions in this reading.
(I’m also not an expert for quantum physics and referred this book a lot in my learning.)

Curious Behaviors in Particles (Quantum)

Suppose that we have an electron’s gun. With this device, a lot of electrons will be randomly fired by applying some voltage. (Let’s imagine some kind of oven.)

Now we put a wall in front of this gun with 2 holes as below and each triggered electrons will go to this wall. Then only electrons passing through these 2 holes will eventually reach to the 2nd destination wall.

Figure 1 : Experiment by electron’s gun and wall with 2 holes

(From “The Feynman Lectures on Physics – Volume III” Chapter 1)

Now we set the detector at destination wall and we plot the total count (electron’s arrival) in each position on x-axis.
Our concern is how this plotting curve is going to be ?

First, the detector at destination wall definitely records each clicks along with the electron’s arrival. This means that each electron discretely arrives at destination wall. (i.e, Unlike the wave, you can “count” each electrons.)

In order to predict this experiment’s result, now we suppose that you fire a bunch of bullets with your toy gun. (See below.)
As you can easily imagine : If hole2 is covered, the total count of bullet’s arrivals will be the following curve P1. If hole1 is covered, the total count will be P2.

Figure 2 : Result with real materials (1)

Eventually the expected result (total count) on the destination wall will become P1 + P2 as follows.
When you do this experiment with your toy gun, you will definitely be able to get this exact result.

Figure 3 : Result with real materials (2)

However, in the small scaled quantum world, the result is different from things of our experience ! When we count all electron’s arrivals on the destination wall, the result becomes as follows.
Apparently, this is not our expecting result.

Figure 4 : Result with particles (atoms)

Suppose we do the same experiment with water wave. (See below.)
In this case, each wave through hole1 and hole2 will interfere with each other, then wave’s intensity at destination will become as following picture.
As you can see, it’s very similar with the result of our previous electron’s experiment.

Figure 5 : Simple experiment by water

As I mentioned above, each electrons can be detected as each different particles, but it also seems to have some sort of wave‘s characteristics (wave-particle duality).
In the things on a very small scale, we can see such an experience that we never had in our real life.

This kind of phenomenon is also observed in quantum’s spin. Now let’s see another experiment.
Let’s say, we consider the following device, called Stern-Gerlach device. We assume that some particle’s beam (e.g, beam of Ag) is inserted into this device.

Figure 6 : Stern-Gerlach device

In this situation, by ununiformed magnetic fields, the current loop in the atom will be pulled into upward or downward, corresponding to anti-clockwise spin or clockwise spin. (See Figure 7 below.)
Eventually, each atom will be divided by upward or downward in the screen (destination) as Figure 6 above.

Figure 7 : Relation by electron’s spin (current loop) and force in Maxwell’s picture

Note : This picture (above example by a single electron’s motion) simplifies the behavior of electrons. (It’s known that each electron doesn’t exist in a certain position and it spreads into any space with some uncertainty.)
In the real particles, this kind of system is caused by various aspects in particles, such as, combination of multiple elements, symmetricity in a molecule, and so on. Depending on the choice of atoms or molecules, the particles might be divided into 3 states – such as, positive (+), zero (0), and negative (-) – in Stern-Gerlach device.

Now we consider the following experiment with the apparatus by combination of 2 Stern-Gerlach devices.
In the first (left) one, we block the downward beam and only pass the upward beam. In the next (right) device, we observe how the beam is divided by upward or downward.

Figure 8 : Experiment with simple combination of Stern-Gerlach’s devices

With this experiment, we get the result that all beam becomes upward. (No downward beam is observed.)
I think that this would be the same as your expecting result.

However, let’s see the following apparatus by 3 devices.
In this experiment, we combine 3 devices such as : In the first one, we block downward beam. (Only upward beam reaches to the next device.) For the next device, we rotate this device around y-axis and block only downward (i.e, crooked direction) beam. With the final device, we observe both upward and downward in the regular direction.

Figure 9 : Experiment with rotated Stern-Gerlach’s filter

With this experiment, we get the result of both upward and downward ! (i.e, The downward beam can also be appeared again.)
That’s so strange, because we have filtered into only upward beam in the first device.

Probability Amplitude

As you saw in our first example of electron’s gun, these curious results are because of wave-like behaviors.

Note : It’s known that all matter exhibits wave-like behavior and has wavelength \lambda = \frac{h}{mv} (where m is mass, v is velocity, and h is Planck constant). We can comparatively ignore this behavior in almost case with a large material, however, we cannot ignore this behavior in quantum-scaled particles.
See Wikipedia “Matter wave (de Broglie wave)” for details.

With a lot of works in physics, this phenomenon is formulated by introducing the idea of probability amplitude, which idea is based on wave’s motion.
The probability amplitude is a complex number which describes some behavior in quantum physics.
For now, please think it as an analogy of the following wave’s amplitude \phi .

Figure 10 : probability amplitude by simple Euler’s formula

The probability amplitude is not visible and recognizable for humans. As I explain in this section, we can only recognize it as real “probability” | \phi |^2 . Figuratively speaking, the probability amplitude is some value in unrecognizable world with “complex number” and we can recognize it as “real number”.

Now let’s remind the previous example of electron’s gun again. (See Figure 1.)
In this example, we can set the probability amplitude as :

  • \phi : probability amplitude for passing through hole1 and reaching to some position (x) in destination wall
  • \chi : probability amplitude for passing through hole2 and reaching to some position (x) in destination wall

The probability of both paths through hole1 and hole2 is not the sum of probability \left| \phi \right|^2 + \left| \chi \right|^2 , but it’s the probability of “the sum of probability amplitude”, i.e, \left| \phi + \chi \right|^2 .
As you saw in Figure 5, each \phi and \chi will interfer like the ordinary wave and the result will become such like Figure 4.

Let’s remind the example of quantum spin again. (See Figure 6.)
In this example, we denote the state of particles which has passed through upward as m+ . We also denote the state of particles with downward as m- .
Same like that, we denote the state of particles which has passed through the rotated device (2nd device in Figure 9) as n+ . And we also denote the state of opposite side as n- .
Here we can set the probability amplitude as follows. (Please take care of the order !) :

  • \left< n+ \middle| m+ \right> : the probability amplitude of particles passing through n+ after passing through m+ . (the probability amplitude of n+ with initial state m+ )
  • \left< n- \middle| m+ \right> : the probability amplitude of particles passing through n- after passing through m+ . (the probability amplitude of n- with initial state m+ )

Note : In the previous example (an example with electron’s gun), you can also denote using bra-ket notation (\left< \ \cdot \ \middle| \ \cdot \ \right> ).

With this notation, we can describe the probability amplitude in Figure 8 (experiment with simple 2 Stern-Gerlach devices) as follows.

  • \left< m+ \middle| m+ \right> : the probability amplitude of finding upward particles in Figure 8
  • \left< m- \middle| m+ \right> : the probability amplitude of finding downward particles in Figure 8

In quantum mechanics, there is a basic principle, such as : \left< a \middle| a \right> = 1 . For this reason, you can find :

\left| \left< m+ \middle| m+ \right> \right|^2 = 1

\left| \left< m- \middle| m+ \right> \right|^2 = 0

This means that the real possibility of finding upward particles in Figure 8 is 1, and the real possibility of finding downward particles in Figure 8 is 0.

Next we consider the mixed device of Figure 9 (experiment of 3 Stern-Gerlach devices with rotated one).
First, we can write probability amplitude of particles passing m+ on 1st device and n+ on 2nd device as \left< n+ \middle| m+ \right> . Then probability amplitude of particles passing n+ on 2nd device and m+ on 3rd device is \left< m+ \middle| n+ \right> . How can we write the possibility amplitude of “passing m+ on 1st device, n+ on 2nd device, and m+ on 3rd device” ?
In quantum mechanics, this kind of composite possibility amplitude by \chi after \phi is given by the product \chi \cdot \phi . (Please take care for the difference from your familiar “conditional probability”.)
For this principle, each possibility amplitudes for upward and downward in Figure 9 will be :

  • \left< m+ \middle| n+ \right> \left< n+ \middle| m+ \right> : the probability amplitude of finding upward particles in Figure 9
  • \left< m- \middle| n+ \right> \left< n+ \middle| m+ \right> : the probability amplitude of finding downward particles in Figure 9

Then the real possibility values of these are :

  • \left| \left< m+ \middle| n+ \right> \right|^2 \left| \left< n+ \middle| m+ \right> \right|^2 : the probability of finding upward particles in Figure 9
  • \left| \left< m- \middle| n+ \right> \right|^2 \left| \left< n+ \middle| m+ \right> \right|^2 : the probability of finding downward particles in Figure 9

Then the ratio of these values is not depending on which one (m+ or m- ) is selected in the 1st device. (See the following equation.)
For this reason, the result in Figure 9 includes the downward particles, even when you have filtered into the upward particles in the first (left) device.

\displaystyle \frac{\left| \left< m+ \middle| n+ \right> \right|^2 \left| \left< n+ \middle| m+ \right> \right|^2}{\left| \left< m- \middle| n+ \right> \right|^2 \left| \left< n+ \middle| m+ \right> \right|^2} = \frac{\left| \left< m+ \middle| n+ \right> \right|^2}{\left| \left< m- \middle| n+ \right> \right|^2}

By the way, when a particle has passed through the 2nd device in Figure 9, the state is neither of m+ and m- . (This state is so-called an intermediate state against m+ and m- .) Against these intermediate states, each m+ and m- are called base state. As I show you later, intermediate states are all described using the combination of base state.

There exist a lot of set (a lot of pairs, if 2-state system) of base state.
For instance, the pair of n+ and n- is also one of base state’s set. The choice of base state is something like a choice of base coordinates in a vector space.

It’s known that there exist the following principles for quantum base state, when \{ i \} \ (i=0,1, ...) is a set of base state. (See chapter 5-5 in “The Feynman Lectures on Physics – Volume III”.) :

  • \left< j \middle| i \right> = \delta_{ij}
    i.e, \left< j \middle| i \right> = 1 when i = j , and \left< j \middle| i \right> = 0 (orthogonal) when i \neq j
  • \left< \chi \middle| \phi \right> = \sum_{i} \left< \chi \middle| i \right> \left< i \middle| \phi \right> for any state \phi and \chi

With these principles, when all particles with both n+ and n- is passed on the 2nd device in Figure 9, you will find that all observable state in the 3rd device will be m+ as follows.
This is the same as our experiment’s result in the previous section.

\displaystyle \left< m+ \middle| n+ \right> \left< n+ \middle| m+ \right> + \left< m+ \middle| n- \right> \left< n- \middle| m+ \right> = \left< m+ \middle| m+ \right> = 1

Suppose we have a particle with initial state \phi and this particle goes through some apparatus A (e.g, an apparatus applying some magnetic fields, the combination of multiple Stern-Gerlach devices, and so on). Then the final probability amplitude for \chi is often denoted as \left< \chi \middle| A \middle| \phi \right> using operator A.
For instance, the 2nd rotated device in Fugure 9 is also one of these operator A, then we can also denote this operation as \left< m+ \middle| A \middle| m+ \right> .
In generic gate-model quantum computing, the logic is built by the combination of operators and an operator is sometimes called a gate (circuit).

In this post, we discuss the quantum computing using an analogy of this quantum spin.

Note : There exist several quantum numbers corresponding to position, momentum, spin, or polarization. Unfortunately there’s no single convenient (complete) formula describing all these aspects.

Mathematical Representation

For now, we have considered a complex number value \left< \ \cdot \ \middle| \ \cdot \ \right> and haven’t divided into bra (\left< \ \cdot \ \right| ) and ket (\left| \ \cdot \ \right> ).
However, with the idea of mathimatical vector analysis, this quantum mechanics is abstracted as Hilbert space using vectors and matrices – i.e, each bra / ket as a vector and an operator as a matrix. (See chapter 8 in “The Feynman Lectures on Physics – Volume III”.)

From now on, we define these symbols using vectors and matrices as follows. :

\displaystyle \left| \phi \right> = \begin{pmatrix} \phi_0 \\ \phi_1 \\ \vdots \\ \phi_{n-1} \end{pmatrix}

\displaystyle \left< \phi \right| = \left| \phi \right>^{\dagger} = \begin{pmatrix} \phi_0^{*} & \phi_1^{*} & \cdots & \phi_{n-1}^{*} \end{pmatrix}

\displaystyle A = \begin{pmatrix} A_{00} & A_{01} & \cdots & A_{0 \ n-1} \\ A_{10} & A_{11} & \cdots & A_{1 \ n-1} \\ \vdots & & \ddots & \vdots \\ A_{n-1 \ 0} & A_{n-1 \ 1} & \cdots & A_{n-1 \ n-1} \end{pmatrix}

For 2-state system, it can be written as :

\displaystyle \left| \phi \right> = \begin{pmatrix} \phi_0 \\ \phi_1 \end{pmatrix}

\displaystyle \left< \phi \right| = \left| \phi \right>^{\dagger} = \begin{pmatrix} \phi_0^{*} & \phi_1^{*} \end{pmatrix}

\displaystyle A = \begin{pmatrix} A_{00} & A_{01} \\ A_{10} & A_{11} \end{pmatrix}

For instance, if \left| \phi \right> = \begin{pmatrix} a+bi \\ c+di \end{pmatrix} is given, \left< \phi \right| is equal to :

\displaystyle \left< \phi \right| = \begin{pmatrix} a+bi \\ c+di \end{pmatrix}^{\dagger} = \begin{pmatrix} (a+bi)^{*} & (c+di)^{*} \end{pmatrix} = \begin{pmatrix} a-bi & c-di \end{pmatrix}

In this algebra, operator A converts some state \left| \phi \right> into A \left| \phi \right> .

Note (Time-Evolution) : When we correctly discuss the actual behavior of particles (which will depend on both time and positions), we’ll dive into complicated details. In this note, we briefly see the behavior of time-evolution.
Suppose we have a particle at rest and it has a definite energy E_0 . In this situation, it’s known that this particle has the probability amplitude a e^{-i (\frac{E_0}{\hbar}) \tau} depending on time \tau (where a is a position-dependent constant with \left| a \right| \leq 1 ). This means that the probability amplitude differs on time \tau .
For instance, when a particle sits in a uniform magnetic field B and it has the same direction (moment) of spin for time \tau , the probability amplitude is changed by a e^{-(\frac{i}{\hbar} (-\mu B) \tau} (the actual state is multiplied with this value), where \mu is magnetic moment and B is magnetic field.
Furthermore, when we decompose the state \left| \phi(\tau) \right> = \sum_{i} \left| i \right> C_i(\tau) where C_i(\tau) = \left< i \middle| \phi(\tau) \right> , it’s known that this system can be written as the following differential equation with some constant H_{ij} \in \mathbb{C} .
\displaystyle i \hbar \frac{d C_i(\tau)}{d\tau} = \sum_{j} H_{ij} C_j(\tau)
This is also denoted with the following vector differential equation. This equation is called time-dependent Schrodinger equation.
\displaystyle i \hbar \frac{d \left| \phi(\tau) \right>}{d\tau} = H \left| \phi(\tau) \right>
We can get the time-dependent state (probability amplitude) by solving this Schrodinger equation.
(See “The Feynman Lectures on Physics – Volume III”.)

Suppose the state \phi and \chi are given. As I mentioned in the previous section, we can decompose a probability amplitude using base state as follows :

\displaystyle \left< \chi \middle| \phi \right>

\displaystyle = \sum_{i} \left< \chi \middle| i \right> C_i

where C_i = \left< i \middle| \phi \right>

Hence any \left| \phi \right> can be decomposed using base state as follows. This superposed state (i.e, a liner combination of base state) \displaystyle \left| \phi \right> is called a Qubit state. :

\displaystyle \left| \phi \right> = \sum_{i} \left| i \right> C_i

where C_i \in \mathbb{C} and \sum_{i} \left| C_i \right|^2 = 1

Note : As I mentioned above : When it’s a stationary state in some energy E_0 (such like, in a uniform magnetic field B), C_i will change depending on time \tau , i.e, C_i = C_i(\tau) = e^{-i (\frac{E_0}{\hbar}) \tau} C_i(\tau_0) where C_i(\tau_0) \in \mathbb{C} is time-independent with some fixed time \tau_0 .
Hence, in Qubit’s representation, a state is written by using C_i = C_i(\tau_0) \in \mathbb{C} (time-independent). In Qubit’s representation, \left| \phi \right> is equivalent to e^{-i \rho} \left| \phi \right> for any real number \rho .

Especially in the 2-state system, any qubit states (superpositions) will be written as follows. :

\displaystyle \alpha \left| 0 \right> + \beta \left| 1 \right>

where \alpha, \beta \in \mathbb{C} and \left| \alpha \right|^2 + \left| \beta \right|^2 = 1

In the quantum computation, the following pair of base state is conventionally used in 2-state system :

\displaystyle \left| 0 \right> = \begin{pmatrix} 1 \\ 0 \end{pmatrix}

\displaystyle \left| 1 \right> = \begin{pmatrix} 0 \\ 1 \end{pmatrix}

Using this base state, the previous state is written as follows :

\displaystyle \alpha \left| 0 \right> + \beta \left| 1 \right> = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}

where \alpha, \beta \in \mathbb{C} and \left| \alpha \right|^2 + \left| \beta \right|^2 = 1

Same as above, we can also decompose the formula for any state \phi , \chi , and apparatus (operator) A as follows :

\displaystyle \left< \chi \middle| A \middle| \phi \right>

\displaystyle = \sum_{i,j} \left< \chi \middle| j \right> \left< j \middle| A \middle| i \right> \left< i \middle| \phi \right>

Each \left< \chi \middle| j \right> and \left< i \middle| \phi \right> is the projection for base state (\left| j \right> and \left< i \right| ), and each \left< j \middle| A \middle| i \right> is not depending on \phi and \chi . Hence this equation means that \left< \chi \middle| A \middle| \phi \right> is a linear combination of these projections.
In 2-state’s quantum computation, this A will be the following 2 x 2 matrix :

\displaystyle A = \begin{pmatrix} \left< 0 \middle| A \middle| 0 \right> & \left< 0 \middle| A \middle| 1 \right> \\ \left< 1 \middle| A \middle| 0 \right> & \left< 1 \middle| A \middle| 1 \right> \end{pmatrix}

Now we try the simple calculation by quantum states and operations.

Let’s say, now we suppose all particles have the following spin direction and we assume that this state is denoted by \left| 0 \right> . (These particles go into upward (+z-direction) by previous Stern-Gerlach device.)

Figure 11 : a particle of \left| 0 \right>

When we change the state by the following operation called Hadamard (H) gate (which is also physically implemented as some kind of devices or circuits), the converted state is written as follows.
Now we denote this converted state as \left| + \right> .

\displaystyle H \left| 0 \right> = \begin{pmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{pmatrix}

When we observe this particle with Stern-Gerlach device of the same direction (+z-direction), we can find that the half of particles go to upward, since \left| \frac{1}{\sqrt{2}} \right|^2 = \frac{1}{2} .

\displaystyle \left< 0 \middle| + \right> = \begin{pmatrix} 1 & 0 \end{pmatrix} \begin{pmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{pmatrix} = \frac{1}{\sqrt{2}}

Note : In this experiment, you might think that the half of these particles go into some state and the other half go into another state. But, this is not describing these particles’ behavior correctly.
You should think that all particles go into some same “uncertain state” and we can observe it as real possibilities.
Later (in “Measurement” section) we’ll go into more details.

When you combine 2 apparatus – the particles pass through A and then pass through B -, the corresponding operator C (of this combined apparatus) will be : C = B \cdot A (where B \cdot A is the product of each matrix A and B.)
With this manner, you can combine a variety of apparatus.

For instance, when you apply Hadamard (H) gate twice, all state goes back to the original state. (Please calculate using matrix.)

Note : Any operators should preserve the state’s norm. Then any operators converting some state to another state should be written as unitary matrix (i.e, a matrix U such as U U^{\dagger} = I ).
See Wikipedia “Quantum logic gate” for other famous unitary operators.

Note : With quantum mechanics, we can explain a variety of physical phenomenon which is never described by classical mechanics, such like half-life of a radioactive element, barrier penetration (the particle transmission into the second piece of material – i.e, not all particles are reflected by the material), so on and so forth.
This post is only focusing on computing, but please read chapter 7-3 in “Feynman Lecture on Physics Volume III”, if you’re interested in these descriptions of physics.

Bloch Sphere

Next we consider the geometric representation of qubits.

Now let’s remind Stern-Gerlach apparatus in Figure 9 again. (See below.)
When we denote the states in 1st and 3rd device as \left| m\pm \right> and the rotated states (states in 2nd device) as \left| n\pm \right> , the probabilities (not probability amplitudes) P\pm of \left| m+ \right> direction for initial states \left| n\pm \right> are experimentally known to be :

\displaystyle P+ = \frac{1}{2} (1 + \overline{m} \cdot \overline{n})

\displaystyle P- = \frac{1}{2} (1 - \overline{m} \cdot \overline{n})

where \overline{m} \cdot \overline{n} is inner product, i.e, \overline{m} \cdot \overline{n} = cos \theta

Figure 9 (Again)

Now we set \left| 0 \right> on z-axis, and we set each x and y axis for orthogonal axis (with anti-clockwise order) as follows.
First we assume that we represent the state \left| \phi \right> = \left| n+ \right> in the following sphere, where \theta is the angle between \overline{0} and \overline{\phi} in Stern-Gerlach devices.

Figure 12 : Base sphere

Our concern in this section is how the following \alpha and \beta is represented geometrically ?

\displaystyle \left| \phi \right> = \alpha \left| 0 \right> + \beta \left| 1 \right>

When it’s given the initial state \left| 0 \right> , then the probability (not probability amplitude) of this state \left| \phi \right> is \left| \alpha \right|^2 . As I mentioned above, this is equal to either P+ or P- .
Here we assume that this is equal to P+ , then :

\displaystyle \left| \alpha \right|^2

\displaystyle = \frac{1}{2} (1 + \overline{0} \cdot \overline{\phi})

\displaystyle = \frac{1}{2} (1 + cos \theta)

\displaystyle = cos(\frac{\theta}{2})^2

Then we get \left| \alpha \right| = cos(\frac{\theta}{2}) .
Using the same calculation, we also get \left| \beta \right| = sin(\frac{\theta}{2})
(Same like this, if we have chosen P- , then we will get \left| \alpha \right| = sin(\frac{\theta}{2}) and \left| \beta \right| = cos(\frac{\theta}{2}) .)
Hence, we can write \left| \phi \right> as follows. (See the following note.) :

\displaystyle \left| \phi \right>

\displaystyle = cos(\frac{\theta}{2}) e^{i\mu}\left| 0 \right> + sin(\frac{\theta}{2}) e^{i\nu} \left| 1 \right>

\displaystyle = cos(\frac{\theta}{2}) \left| 0 \right> + sin(\frac{\theta}{2}) e^{i\kappa} \left| 1 \right>

where 0 \leq \theta \leq \pi, 0 \leq \kappa < 2\pi

Note : Here we used the qubit’s property, such as : \left| \phi \right> and e^{-i\mu} \left| \phi \right> is equivalent for any real number \mu . (See above note.)

Next we consider the following 2 states, \left| \zeta \right> and \left| \eta \right> , on x-y plane.

Figure 13 : 2 states on x-y plane (1)

On this plain (x-y plain), \theta = \frac{\pi}{2} , then we can write \left| \zeta \right> and \left| \eta \right> as follows.

\displaystyle \left| \zeta \right> = \frac{1}{\sqrt{2}} \left| 0 \right> + \frac{1}{\sqrt{2}} e^{i\kappa_1} \left| 1 \right>

\displaystyle \left| \eta \right> = \frac{1}{\sqrt{2}} \left| 0 \right> + \frac{1}{\sqrt{2}} e^{i\kappa_2} \left| 1 \right>

When it’s given the initial state \left| \zeta \right> , then the probability (not probability amplitude) of the state \left| \eta \right> is :

\displaystyle \left| \left< \eta \middle| \zeta \right> \right|^2

\displaystyle = \left| (\frac{1}{\sqrt{2}} \left< 0 \right| + \frac{1}{\sqrt{2}} e^{-i\kappa_2} \left< 1 \right|) (\frac{1}{\sqrt{2}} \left| 0 \right> + \frac{1}{\sqrt{2}} e^{i\kappa_1} \left| 1 \right>) \right|^2

\displaystyle = \left| \frac{1}{2} + \frac{1}{2} e^{i(\kappa_1 - \kappa_2)} \right|^2

\displaystyle = \frac{1}{2} + \frac{1}{2} cos(\kappa_1 - \kappa_2)

This should be equal to P+ = \frac{1}{2} (1 + \overline{\zeta} \cdot \overline{\eta}) = \frac{1}{2} (1 + cos\psi) or P- = \frac{1}{2} (1 - \overline{\zeta} \cdot \overline{\eta}) = \frac{1}{2} (1 - cos\psi) .
When we assume it’s equal to P+ , then cos(\kappa_1 - \kappa_2) = cos\psi and we get \kappa_1 - \kappa_2 = \pm{\psi} .
This implies that the relation of \kappa_1 and \kappa_2 is like the following picture.

Figure 14 : 2 states on x-y plane (2)

Here I don’t go so far, but this holds even when it’s not on x-y plane.

As a result (summary), any state \left| \phi \right> is uniquely written as

\displaystyle cos(\frac{\theta}{2}) \left| 0 \right> + sin(\frac{\theta}{2}) e^{i\kappa} \left| 1 \right>

using the following \theta and \kappa (where 0 \leq \theta \leq \pi, 0 \leq \kappa < 2\pi ).

Figure 15 : Bloch Sphere representation

Note : Strictly speaking, the dipole \left| 0 \right> and \left| 1 \right> can be written using arbitrary \kappa (not “uniquely written”).

This geometric sphere (which describes the qubit’s state) is called Bloch Sphere and it’s useful to consider things, such as the relation of each states, the transformation and combination of quantum logic gates (operations), so on and so forth.

For instance, when you set \left| \phi \right> = cos(\frac{\theta}{2}) \left| 0 \right> + sin(\frac{\theta}{2}) e^{i\kappa} \left| 1 \right> as one side of a base state’s pair, you can soon get another side of a pair as :

\displaystyle cos(\frac{\pi - \theta}{2}) \left| 0 \right> + sin(\frac{\pi - \theta}{2}) e^{i(\pi + \kappa)} \left| 1 \right>

\displaystyle = sin(\frac{\theta}{2}) \left| 0 \right> - cos(\frac{\theta}{2}) e^{i\kappa} \left| 1 \right>

The following well-known Pauli-X (\sigma_x ), Pauli-Y (\sigma_y ), and Pauli-Z (\sigma_z ) gates are operations to rotate \pi radians around corresponding x, y, and z axis. (See Wikipedia “Quantum logic gate” for more other logic gates.)
Any single-qubit operation can be written by a linear combination of these gates, since any 2 x 2 matrix can be represented by a linear combination of these matrix.

\displaystyle \sigma_x = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}

\displaystyle \sigma_y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}

\displaystyle \sigma_z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}

You will easily be able to find the following equation.

\displaystyle \sigma_x \sigma_y = i \sigma_z

\displaystyle \sigma_y \sigma_z = i \sigma_x

\displaystyle \sigma_z \sigma_x = i \sigma_y

In general, it’s known that the rotation of \theta radians around each axis is written as follows.
You notice that it’s equivalent to the previous \sigma_x , \sigma_y and \sigma_z , if \theta = \pi .

\displaystyle R_x(\theta) = \begin{pmatrix} cos\frac{\theta}{2} & -i sin\frac{\theta}{2} \\ -i sin\frac{\theta}{2} & cos\frac{\theta}{2} \end{pmatrix}

\displaystyle R_y(\theta) = \begin{pmatrix} cos\frac{\theta}{2} & -sin\frac{\theta}{2} \\ sin\frac{\theta}{2} & cos\frac{\theta}{2} \end{pmatrix}

\displaystyle R_z(\theta) = \begin{pmatrix} e^{\frac{-i\theta}{2}} & 0 \\ 0 & e^{\frac{i\theta}{2}} \end{pmatrix}

Note : Here we still used the qubit’s property, such as : \left| \phi \right> and e^{-i\mu} \left| \phi \right> is equivalent for any real number \mu . (See above note.)

For instance, previous Hadamard (H) gate is written as the combination of \pi radians rotation around z-axis followed by \frac{\pi}{2} radians rotation around y-axis :

\displaystyle R_y(\frac{\pi}{2}) \cdot R_z(\pi)

\displaystyle = \begin{pmatrix} cos\frac{\pi}{4} & -sin\frac{\pi}{4} \\ sin\frac{\pi}{4} & cos\frac{\pi}{4} \end{pmatrix} \begin{pmatrix} e^{\frac{-i\pi}{2}} & 0 \\ 0 & e^{\frac{i\pi}{2}} \end{pmatrix}

\displaystyle = e^{i\frac{\pi}{2}} \cdot H

As you can find, the rotation of \left| 0 \right> around z-axis is always \left| 0 \right> itself for any \theta radians.

R_z(\theta) \left| 0 \right>

\displaystyle =\begin{pmatrix} e^{\frac{-i\theta}{2}} & 0 \\ 0 & e^{\frac{i\theta}{2}} \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix}

\displaystyle = e^{\frac{-i\theta}{2}} \left| 0 \right>

See chapter 10-7 and chapter 11 in “The Feynman Lectures on Physics – Volume III” for details.

Entangled State

Next, suppose there exist 2 species of particles, in which both are also in 2-state system.
In this situation, there exist 4 states by the combination (up-up, up-down, down-up, and down-down) as a set of base state.
First, this will be equivalent to the following tensor product of each states, and it’s denoted by \left< \phi \chi \right| (where each \phi and \chi are in the 2-state system).

\displaystyle \left| \phi \chi \right>

\displaystyle = \left| \phi \right> \left| \chi \right>

\displaystyle = \left| \phi \right> \otimes \left| \chi \right>

\displaystyle = \begin{pmatrix} \phi_0 \\ \phi_1 \end{pmatrix} \otimes \begin{pmatrix} \chi_0 \\ \chi_1 \end{pmatrix}

\displaystyle = \begin{pmatrix} \phi_0 \chi_0 \\ \phi_0 \chi_1 \\ \phi_1 \chi_0 \\ \phi_1 \chi_1 \end{pmatrix}

For instance, when we consider 3 respective different states \left| \phi \chi \psi \right> of particles in 2-state system, we should consider the superposition of 2 x 2 x 2 = 8 state system as follows.

\displaystyle \left| \phi \chi \psi \right>

\displaystyle = \left| \phi \right> \otimes \left| \chi \right> \otimes \left| \psi \right>

\displaystyle = \begin{pmatrix} \phi_0 \chi_0 \psi_0 \\ \phi_0 \chi_0 \psi_1 \\ \phi_0 \chi_1 \psi_0 \\ \phi_0 \chi_1 \psi_1 \\ \phi_1 \chi_0 \psi_0 \\ \phi_1 \chi_0 \psi_1 \\ \phi_1 \chi_1 \psi_0 \\ \phi_1 \chi_1 \psi_1 \end{pmatrix}

When you apply some operator (gate) A and B to respectively \left| \phi \right> and \left| \chi \right> , it’s equivalent to applying A \otimes B to \left| \phi \chi \right> . (See below.)
It’s a beauty of mathematics.

(A \otimes B) \left| \phi \chi \right> = (A\left| \phi \right>) \otimes (B\left| \chi \right>)

These states are often called separable.
For instance, the following \left| \phi \right> is also a pair of separable states.

\displaystyle \left| \phi \right> = \frac{1}{\sqrt{2}} \left| 00 \right> + \frac{1}{\sqrt{2}} \left| 01 \right> = \left| 0 \right> \otimes (\frac{1}{\sqrt{2}} \left| 0 \right> + \frac{1}{\sqrt{2}} \left| 1 \right>)

On the other hand, let’s consider the following famous state, called Bell State. This state is not separated by tensor product.

\left| \chi \right> = \frac{1}{\sqrt{2}} \left| 00 \right> + \frac{1}{\sqrt{2}} \left| 11 \right>

This is very strange state, because :
Suppose Alice measures the first qubit and Bob measures the second qubit. When Alice measures the first qubit, she will have a 50% chance of measuring \left| 0 \right> and a 50% chance of measuring \left| 1 \right> . On Bob’s side, he will also have a 50% chance of \left| 0 \right> and a 50% chance of \left| 1 \right> . Whereas, if Alice measures the first qubit and get \left| 0 \right> , Bob should measure the second qubit as \left| 0 \right> with a 100% chance (since \left| 01 \right|^2 = 0 ), even when the particles are separated by a large distance and they don’t know each other.

Note : Please refer well-known EPR paradox.

These states can never be separated by tensor product and these are called entangled state.

Here I don’t go so far for physical description about entanglement, but this strange state actually happens in real particles.
For instance, suppose a pair of electrons are generated together. Then one will have clockwise spin and the other will have anti-clockwise. Even when these are separated by a large distance, this pair will continue to maintain zero total spin.

Figure 16 : Entangled State

Entanglement is a very important aspect for quantum computation.

For instance, if you apply some operation to the first qubit in Bell state, the second qubit is also converted into the same state. (Please calculate using vectors and matrices.)
If there’s n qubits, there exist 2^n base state and these are simultaneously converted by entangled state.

Let’s look at another practical example.
Suppose some 3-bits parity p = 5 = 101 (2) is given, then we have corresponding 3 qubits as follows. :

\left| x_i \right> = \begin{pmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{pmatrix} \ \ (i = 0, 1, 2)

Next we prepare the following ancilla qubit \left| x_3 \right> .

\left| x_3 \right> = \begin{pmatrix} \frac{1}{\sqrt{2}} \\ -\frac{1}{\sqrt{2}} \end{pmatrix}

Now we get the following state. (We denote this state as \left| \phi \right> .) :

\displaystyle \left| x_0 x_1 x_2 x_3 \right>

\displaystyle  = \frac{1}{4} \left| 0000 \right> - \frac{1}{4} \left| 0001 \right> + \frac{1}{4} \left| 0010 \right> - \frac{1}{4} \left| 0011 \right> + \frac{1}{4} \left| 0100 \right> - \frac{1}{4} \left| 0101 \right> + \frac{1}{4} \left| 0110 \right> - \frac{1}{4} \left| 0111 \right> + \frac{1}{4} \left| 1000 \right> - \frac{1}{4} \left| 1001 \right> + \frac{1}{4} \left| 1010 \right> - \frac{1}{4} \left| 1011 \right> + \frac{1}{4} \left| 1100 \right> - \frac{1}{4} \left| 1101 \right> + \frac{1}{4} \left| 1110 \right> - \frac{1}{4} \left| 1111 \right>

\displaystyle = \left| \phi \right>

In quantum computing, we can entangle or disentangle 2 states with the following Controlled-NOT operation (CNOT). (It’s written as a non-separable 2-qubit operation.)

\displaystyle CNOT = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}

This CNOT replaces the second qubit, only when the first qubit is \left| 1 \right> . (If the first qubit is \left| 0 \right> , we do nothing for the second qubit.)
Then CNOT converts base state as follows. (Please remind that any states can be written by a linear combination of these base state.)

\displaystyle CNOT \left| 00 \right> = \left| 00 \right>

\displaystyle CNOT \left| 01 \right> = \left| 01 \right>

\displaystyle CNOT \left| 10 \right> = \left| 11 \right>

\displaystyle CNOT \left| 11 \right> = \left| 10 \right>

Now we check each i-th bit (i=0,1,2) in parity p, then we apply CNOT for a pair of \left| x_i \right> \ (i=0,1,2) and \left| x_3 \right> , only when i-th bit is 1. (When i-th bit is 0, we do nothing.) We denote this CNOT operation using suffix, as CNOT_{i3} .

In our case, we apply CNOT_{03} and CNOT_{23} , because our parity p = 101 (2).
First, we apply CNOT_{03} . As I mentioned above, this operator replaces the 4th qubit, only when the 1st qubit is \left| 1 \right> .

\displaystyle CNOT_{03} \left| \phi \right>

\displaystyle = \frac{1}{4} \left| 0000 \right> - \frac{1}{4} \left| 0001 \right> + \frac{1}{4} \left| 0010 \right> - \frac{1}{4} \left| 0011 \right> + \frac{1}{4} \left| 0100 \right> - \frac{1}{4} \left| 0101 \right> + \frac{1}{4} \left| 0110 \right> - \frac{1}{4} \left| 0111 \right> + \frac{1}{4} \left| 1001 \right> - \frac{1}{4} \left| 1000 \right> + \frac{1}{4} \left| 1011 \right> - \frac{1}{4} \left| 1010 \right> + \frac{1}{4} \left| 1101 \right> - \frac{1}{4} \left| 1100 \right> + \frac{1}{4} \left| 1111 \right> - \frac{1}{4} \left| 1110 \right>

= \left| \chi \right> \displaystyle

Same like this, we next apply CNOT_{23} , then we get :

CNOT_{23} \left| \chi \right> \displaystyle

\displaystyle = \frac{1}{4} \left| 0000 \right> - \frac{1}{4} \left| 0001 \right> + \frac{1}{4} \left| 0011 \right> - \frac{1}{4} \left| 0010 \right> + \frac{1}{4} \left| 0100 \right> - \frac{1}{4} \left| 0101 \right> + \frac{1}{4} \left| 0111 \right> - \frac{1}{4} \left| 0110 \right> + \frac{1}{4} \left| 1001 \right> - \frac{1}{4} \left| 1000 \right> + \frac{1}{4} \left| 1010 \right> - \frac{1}{4} \left| 1011 \right> + \frac{1}{4} \left| 1101 \right> - \frac{1}{4} \left| 1100 \right> + \frac{1}{4} \left| 1110 \right> - \frac{1}{4} \left| 1111 \right>

\displaystyle = \frac{1}{4} \left| 0000 \right> - \frac{1}{4} \left| 0001 \right> - \frac{1}{4} \left| 0010 \right> + \frac{1}{4} \left| 0011 \right> + \frac{1}{4} \left| 0100 \right> - \frac{1}{4} \left| 0101 \right> - \frac{1}{4} \left| 0110 \right> + \frac{1}{4} \left| 0111 \right> - \frac{1}{4} \left| 1000 \right> + \frac{1}{4} \left| 1001 \right> + \frac{1}{4} \left| 1010 \right> - \frac{1}{4} \left| 1011 \right> - \frac{1}{4} \left| 1100 \right> + \frac{1}{4} \left| 1101 \right> + \frac{1}{4} \left| 1110 \right> - \frac{1}{4} \left| 1111 \right>

= \left| \psi \right>

Finally, we apply the previous Hadamard operator \begin{pmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{pmatrix} for only first 3 qubits (\left| x_i \right> for i=0,1,2).

\displaystyle (H \otimes H \otimes H \otimes I) \left| \psi \right>

\displaystyle = \frac{1}{\sqrt{2}} \left| 1010 \right> - \frac{1}{\sqrt{2}} \left| 1011 \right>

Now you got 1010 (x_0=1,x_1=0,x_2=1,x_3=0 ) with a 50% chance and 1011 (x_0=1,x_1=0,x_2=1,x_3=1) with a 50% chance. As you can find, the first 3 qubits (x_0,x_1,x_2 ) is always 101 and it’s the same value as our parity p = 101 (2).

Here I don’t go so far, but it’s known that this algorithm holds for any n (> 0) qubits and any parity p. (It’s known as Bernstein-Vazirani algorithm. See my early post for details.)

As you saw in this example, each qubits are converted maintaining each relations and goes into some totally uniformed state with entanglement effects. As a result, we can observe the consistent results.
The entanglement is used in almost all algorithms and this is essential for quantum computation.


As I mentioned above, the only way to identity the state for humans is to observe and check the probabilities by experiments. This is called measurement.

However, there also exists some tricks for measurement. Here I describe these tricks.

Now let’s remind our first example of electron’s gun again.
Any particles should pass through either hole1 or hole2 in our realistic sense (not both !). Then you might think : if you monitor which hole the each particle passes with some detectors (or, you cover either of holes) and track each path of a particle, you could reach to the contradiction of the universe ! (Each particles should be eventually distributed !)

But unfortunately, you cannot track the path of a particle in the result of Figure 4.

First, if you observe which hole a particle passes (see the following picture), you could surely get the result for which hole the each particle passes. i.e, The measurement will succeed.

Figure 17 : Measure (=determine) whether hole1 (or hole2) is passed

However, with this experiments, you no longer see the previous result of Figure 4, and you’ll see the result of Figure 3 instead. (See below.) In short, the original state is changed.
In quantum behavior, when you’ve measured the state of particles (in this case, determining either “hole1” or “hole2”), the uncertain state is no longer maintained. It becomes into another state with non-probabilistic.

Figure 3 (Again)

Also, in quantum computation, once the real probability are found by measurement, these states are no longer used for experiments.
The measurement is an irreversible operation.

Note : We can consider the measurement as an operator (not unitary, but Hermitian operation) of a projection onto \left| 0 \right> and \left| 1 \right> . As I mentioned above, there exist other pairs of base state, then we can also consider a projection onto another base state. This operator will be described as \left| i \right> \left< i \right| and \left| j \right> \left< j \right| , when \left| i \right> and \left| j \right> is a pair of base state.
In Heisenberg picture, any observable (i.e, measurement) is represented by Hermitian, which might not be constant and evolve in time t. In this picture, the eigenvalue of this Hermitian are the observable physical values and the eigenvectors are the states after corresponding measurement. In mathematical properties, the eigenvalues of Hermitian matrix are all real numbers and the set of eigenvectors is complete system (i.e, eigenvectors are orthogonal each other and arbitrary vector in the space is written with these eigenvectors).

Even when there exist entangled multiple qubits, you can measure a part (subset) of these qubits and continue to experiment other part of qubits.
For instance, suppose it’s given the following entangled state. :

\displaystyle \frac{1}{\sqrt{2^3}} \left| 00 \right> + \frac{\sqrt{3}}{\sqrt{2^3}} \left| 01 \right> + \frac{\sqrt{3}}{\sqrt{2^3}} \left| 10 \right> + \frac{1}{\sqrt{2^3}} \left| 11 \right>

Now we measure the first qubit, then we will have possibly the following 2 cases for the second qubit. :

\displaystyle \frac{1}{2} \left| 0 \right> + \frac{\sqrt{3}}{2} \left| 1 \right> when the first qubit is \left| 0 \right>

\displaystyle \frac{\sqrt{3}}{2} \left| 0 \right> + \frac{1}{2} \left| 1 \right> when the first qubit is \left| 1 \right>

This technique is also used in famous Shor’s algorithm.


As I showed you in my early posts (see below), now you can easily try gate-model quantum computing experience on your local machine with quantum simulator, such as Quantum Development Kit (Q#) or Cirq (both are open-source).
Please enjoy programming for the future of computing !


Reference : The Feynman Lectures on Physics – Volume III (Quantum Mechanics)

Categories: Uncategorized

Tagged as:

1 reply »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s