## Introduction

“Verbal descriptions often give the impression that we have understood something when we really haven’t.”

Key quantum mechanical ideas:

1. Superposition: a qubit can be both 0 and 1 at the same time.
2. Measurement: a qubit appears to be only 0 or 1 when measured.
3. Entanglement: qubits can be entangled, measurement of one affects the other.

## Chapter 1: Spin

A photon is an energy packet which has the following properties:

1. Charge $$= 0$$.
2. Spin $$= 1$$.
3. Rest mass $$= 0$$.
4. Speed $$c = 299,792,458 m/s$$.
5. $$E = pc$$ (energy being proportional to their momentum).
6. $$spacetime^2 = time^2 - space^2 = 0$$ (inability to experience spacetime).
 Protons Neutrons Electrons Charge Positive Neutral Negative Relative Mass Large Large Tiny Location Nucleus Nucleus “Orbit” the Nucleus

A qubit can be represented by the spin of an electron or the polarization of a photon.

In quantum physics, measurements are not negligible any more, so it is a fundamental part of the theory.

“There is no real randomness in classical physics, I use what is often called”sensitive dependence on initial conditions“.”

Photons are polarized in two perpendicular directions, both of which are perpendicular to the direction of travel of the photon.

In the three-spin (vertical, horizontal, vertical) measurement experiment, the result of the first measurement does not affect the result of the third measurement.

## Chapter 2: Linear Algebra

Qubits are represented by unit vectors.

Column vectors are called kets, row vectors are called bras.

Paul Dirac’s notation: a ket with name $$v$$ is denoted by $$\ket{v}$$; a bra with name $$w$$ is denoted by $$\bra{w}$$.

For example:

$\ket{v} = \begin{bmatrix} v_{1} \\ v_{2} \\ \vdots \\ v_{m} \end{bmatrix}, \\ \bra{w} = \begin{bmatrix} w_1, w_2, \dots, w_{n} \end{bmatrix}$

Vector operations denoted by the bracket notation:

$\bra{a+b} = \begin{bmatrix} a_1 + b_1, a_2 + b_2, \dots, a_n + b_n \end{bmatrix}$ $\braket{a|b} = \bra{a} \cdot \ket{b}$ Length of a ket is denoted by $${\lvert\ket{v}\rvert}^2$$.

### Three Sets of Orthonormal Basis

1. $\ket{\uparrow} = \begin{bmatrix} 1 \\ 0 \\ \end{bmatrix}, \ket{\uparrow} = \begin{bmatrix} 0 \\ 1 \\ \end{bmatrix}$
2. $\ket{\rightarrow} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{-1}{\sqrt{2}} \\ \end{bmatrix}, \ket{\leftarrow} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \\ \end{bmatrix}$
3. $\ket{\nearrow} = \begin{bmatrix} \frac{1}{2} \\ \frac{-\sqrt{3}}{2} \\ \end{bmatrix}, \ket{\swarrow} = \begin{bmatrix} \frac{\sqrt{3}}{2} \\ \frac{1}{2} \\ \end{bmatrix}$ Any vector in $${\rm I\!R}^2$$ is a linear combination of one of those three bases above:

$\begin{bmatrix} a \\ b \\ \end{bmatrix} = x_1 \ket{\rightarrow} + x_2 \ket{\leftarrow}$

To solve $$x_1$$ and $$x_2$$:

\begin{align} \bra{\rightarrow} \begin{bmatrix} a \\ b \\ \end{bmatrix} &= \bra{\rightarrow} (x_1 \ket{\rightarrow} + x_2 \ket{\leftarrow}) \\ &= x_1 \braket{\rightarrow|\rightarrow} + x_2 \braket{\rightarrow|\leftarrow} \\ &= x_1 \cdot 1 + x_2 \cdot 0 \\ &= x_1 \end{align}

For the same reason, $$\bra{\leftarrow} \\ \begin{bmatrix} a \\ b \\ \end{bmatrix} = x_2$$.

Hence any vector $$v$$ can be written as $$\ket{v} = \braket{b_1|v}\ket{b_1} + \braket{b_2|v}\ket{b_2} + \dots + \braket{b_n|v}\ket{b_n}$$, where $$b_1, \dots, b_n$$ are the bases of vector space. $$\braket{b_i|v}$$ are called probability amplitudes.

### Ordered Basis

$$\{b_1, \dots, b_n\}$$ denotes unordered basis, $$(b_1, \dots, b_n)$$ denotes ordered basis.

### Matrix

In matrix multiplication, we usually write the left matrix as bras and right matrix as kets.

$A = \begin{bmatrix} \bra{a_1} \\ \vdots \\ \bra{a_m} \\ \end{bmatrix} , B = \begin{bmatrix}\ket{b_1}, \dots, \ket{b_n}\end{bmatrix}$

For matrix $$A$$ of kets where the kets are orthonormal basis:

1. $$A^\intercal A = I$$ ($$A$$ is an orthogonal matrix).
2. To find out probability amplitudes of any ket $$\ket{v}$$, simply use $$A^\intercal\ket{v}$$:

$A^\intercal\ket{v} = \begin{bmatrix} \bra{b_1} \\ \vdots \\ \bra{b_m} \\ \end{bmatrix} \ket{v} = \begin{bmatrix} \braket{b_1|v} \\ \vdots \\ \braket{b_m|v} \\ \end{bmatrix}$

### Two Important Orthogonal Matrices in Quantum Physics

1. Corresponds to $$(\ket{\leftarrow}, \ket{\rightarrow})$$ and the Hadamard gate.

$\begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{2}} \end{bmatrix}$

1. Associated with the CNOT gate, it is the identity matrix in $${\rm I\!R}^4$$ with the last two kets swapped.

$\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{bmatrix}$

## Chapter 3: Spin and Qubits

Choosing a direction to measure spin corresponds to choosing an ordered, orthonormal basis $$(\ket{b_1}, \ket{b_2})$$. N is associated with the first basis and S is associated with the second.

Before we measure the spin, the particle will be in a spin gate given by a linear combination of the basis: $$c_1\ket{b_1} + c_2\ket{b_2}$$. This is called a state vector or simply state.

Measurements causes the state vector to change. The new state is one of the basis vectors associated with the measurement. The probability of it being $$\ket{b_1}$$ is $${c_1}^2$$. $$c_1$$ and $$c_2$$ are called probability amplitudes. Probability amplitudes can be either positive or negative.

If we choose to measure the spin of an electron in the vertical direction, before it is measured, we only know that its state is $$c_1\ket{\uparrow} + c_2\ket{\downarrow}$$ where $${c_1}^2 + {c_2}^2 = 1$$. After we measure it, it becomes either $$\ket{\uparrow}$$ or $$\ket{\downarrow}$$.

After measuring the electron for the first time, let’s say we know its state is $$\ket{\uparrow}$$. When we try to measure again on the horizontal axis, we need to transform the basis into $$(\ket{\rightarrow}, \ket{\leftarrow})$$:

$A = \begin{bmatrix}\ket{\rightarrow}\ket{\leftarrow}\end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{-1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \end{bmatrix}$

$A^\intercal\ket{\uparrow} = \begin{bmatrix} \bra{\rightarrow} \\ \bra{\leftarrow} \end{bmatrix}\ket{\uparrow} = \begin{bmatrix} \braket{\rightarrow|\uparrow} \\ \braket{\leftarrow|\uparrow} \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix}$

$\ket{\uparrow} = \frac{1}{\sqrt{2}}\ket{\rightarrow} + \frac{1}{\sqrt{2}}\ket{\leftarrow}$

Following the same logic, we get:

$\ket{\downarrow} = \frac{-1}{\sqrt{2}}\ket{\rightarrow} + \frac{1}{\sqrt{2}}\ket{\leftarrow}$

$\ket{\rightarrow} = \frac{1}{\sqrt{2}}\ket{\uparrow} - \frac{1}{\sqrt{2}}\ket{\downarrow}$

$\ket{\leftarrow} = \frac{1}{\sqrt{2}}\ket{\uparrow} + \frac{1}{\sqrt{2}}\ket{\downarrow}$

### Equivalent State Vectors

There is no measurement that can distinguish between a $$\ket{\uparrow}$$ state and $$-\ket{\uparrow}$$ state, because the measured probability are exactly the same, although their probability amplitudes are different.

Assume an electron’s spin state is $$\frac{1}{\sqrt{2}}\ket{\uparrow} + \frac{1}{\sqrt{2}}\ket{\downarrow}$$, if we measure it vertically, it is no different from $$\frac{1}{\sqrt{2}}\ket{\uparrow} - \frac{1}{\sqrt{2}}\ket{\downarrow}$$. However, if we choose to measure it horizontally, the former is $$\ket{\leftarrow}$$ and the later is $$\ket{\rightarrow}$$.

### The Basis Associated with a Given Spin Direction

Rotating $$(\ket{\uparrow}, \ket{\downarrow})$$ by $$\alpha$$ changes it to $$(\begin{bmatrix} \cos(\alpha) \\ -\sin(\alpha) \end{bmatrix}, \begin{bmatrix} \sin(\alpha) \\ \cos(\alpha) \end{bmatrix})$$.

If we rotate the apparatus by $$\theta$$, $$\alpha = \frac{\theta}{2}$$.

For example, rotating the apparatus by $$\pi$$ flips the north and south pole, that is equivalent of switching the order of the basis, $$(\ket{\uparrow}, \ket{\downarrow})$$ becomes

$(\begin{bmatrix} \cos(\frac{\pi}{2}) \\ -\sin(\frac{\pi}{2}) \end{bmatrix}, \begin{bmatrix} \sin(\frac{\pi}{2}) \\ \cos(\frac{\pi}{2}) \end{bmatrix}) = (\begin{bmatrix} 0 \\ -1 \end{bmatrix}, \begin{bmatrix} 1 \\ 0 \end{bmatrix}) = (\begin{bmatrix} 0 \\ 1 \end{bmatrix}, \begin{bmatrix} 1 \\ 0 \end{bmatrix})$

Notice that we are able to perform the last step because $$\begin{bmatrix} 0 \\ -1 \end{bmatrix}$$ and $$\begin{bmatrix} 0 \\ 1 \end{bmatrix}$$ are equivalent state vectors.

If the first measurement was made vertically, and the state of the electron afterward was $$\ket{\uparrow}$$, then the state of the next measurement rotated by $$\theta$$ (before the measurement happens) is

$\cos(\frac{\theta}{2})\ket{\uparrow} + \sin(\frac{\theta}{2})\ket{\downarrow}$

which means there is $$\cos^2(\frac{\theta}{2})$$ probability of finding the electron at the North rotated by $$\theta$$, $$\sin^2(\frac{\theta}{2})$$ probability of finding the electron at the South rotated by $$\theta$$. The total probability adds up to $$1$$ because $$\cos^2(x) + \sin^2(x) = 1$$.

### Photon Polarization (the Three-Filter Experiment)

For polarized filters, rotating the filter by $$\beta$$ is equivalent to rotating the basis by $$\beta$$ (no dividing by 2).

The bases for the three filters are:

1. $(\ket{\uparrow}, \ket{\downarrow}) = (\begin{bmatrix} 1 \\ 0 \end{bmatrix}, \begin{bmatrix} 0 \\ 1 \end{bmatrix})$
2. $(\ket{\rightarrow}, \ket{\leftarrow}) = (\begin{bmatrix} \cos(\frac{\pi}{4}) \\ -\sin(\frac{\pi}{4}) \end{bmatrix}, \begin{bmatrix} \sin(\frac{\pi}{4}) \\ \cos(\frac{\pi}{4}) \end{bmatrix})$
3. $(\ket{\downarrow}, \ket{\uparrow}) = (\begin{bmatrix} 0 \\ 1 \end{bmatrix}, \begin{bmatrix} 1 \\ 0 \end{bmatrix})$

After the first measurement, let’s assume the state is $$\ket{\uparrow}$$, then before the second measurement happens the state will be $$\cos(\frac{\pi}{4})\ket{\rightarrow} + \sin(\frac{\pi}{4})\ket{\leftarrow}$$. So half the photons will pass through with state $$\ket{\rightarrow}$$. Before the third measurement happens the state will be $$-\sin(\frac{\pi}{4})\ket{\downarrow} + \cos(\frac{\pi}{4})\ket{\uparrow}$$, so half of them will pass again. Overall, a quarter of photons that passed through the first filter will pass through the last.

Notice that after each measurement, we must pick a spin or rotation before carrying out the calculation for the next measurement. This is consistent with the fact measurements change the spin state of the electron. Attempting to calculate the final state after two measurements in one step does not work.

For example, let’s assume the first filter is rotated by $$0$$ and the second filter is rotated by $$\frac{\pi}{4}$$. The state before the first measurement happens is $$\frac{1}{\sqrt{2}}\ket{\uparrow} + \frac{1}{\sqrt{2}}\ket{\downarrow}$$. Attempting to calculate the final state in one step results in

$\frac{1}{\sqrt{2}}\ket{\uparrow} + \frac{1}{\sqrt{2}}\ket{\downarrow} = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 \\ 0 \end{bmatrix} + \frac{1}{\sqrt{2}}\begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix},$

${\begin{bmatrix} \ket{\rightarrow} \\ \ket{\leftarrow} \end{bmatrix}}^\intercal\begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} = \begin{bmatrix} \bra{\rightarrow} \\ \bra{\leftarrow} \end{bmatrix}\begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}$

The result above implies that the probability of the photon passing through the second filter is $$0$$, which is inconsistent with results from experiments. A simpler way to spot this inconsistency would be that if we simply change the equation $$\frac{1}{\sqrt{2}}\ket{\uparrow} + \frac{1}{\sqrt{2}}\ket{\downarrow}$$ to $$\frac{1}{\sqrt{2}}\ket{\uparrow} - \frac{1}{\sqrt{2}}\ket{\downarrow}$$, we would have gotten different results, but that should not happen since for kets in those orthonormal basis the sign does not matter.

### Qubits

Linear combination of basis vectors are also called linear superposition.

Probabilities cannot be negative, but kets in bases and probability amplitudes can.

If we measure a qubit with state $$\ket{\rightarrow}$$ or $$\ket{\leftarrow}$$ vertically, we get equal probability of it being $$\ket{\uparrow}$$ or $$\ket{\downarrow}$$. However, if we try to measure a qubit in superposition $$\ket{v} = \frac{1}{\sqrt{2}}\ket{\rightarrow} + \frac{1}{\sqrt{2}}\ket{\leftarrow}$$ vertically, we get

\begin{align} \ket{v} &= \frac{1}{\sqrt{2}}\ket{\rightarrow} + \frac{1}{\sqrt{2}}\ket{\leftarrow} \\ &= \frac{1}{\sqrt{2}}\begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{-1}{\sqrt{2}} \end{bmatrix} + \frac{1}{\sqrt{2}}\begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} \\ &= \begin{bmatrix} \frac{1}{2} \\ \frac{-1}{2} \end{bmatrix} + \begin{bmatrix} \frac{1}{2} \\ \frac{1}{2} \end{bmatrix} \\ &= \begin{bmatrix} 1 \\ 0 \end{bmatrix} \\ &= 1\begin{bmatrix} 1 \\ 0 \end{bmatrix} + 0\begin{bmatrix} 0 \\ 1 \end{bmatrix} \end{align}

We say that the terms in $$\ket{\rightarrow}$$ and $$\ket{\leftarrow}$$ that give $$0$$ have interfered constructively, and the terms that give $$1$$ have interfered destructively.

### BB84 Protocol

Invented by Charles Bennett and Gilles Brassard at 1984.

1. Two parties agree on a set of two ordered bases via an unencrypted lined. Let us assume they chose $$(\ket{\uparrow}, \ket{\downarrow})$$ and $$(\ket{\rightarrow}, \ket{\leftarrow})$$.
2. Party A has a string of classical bits, its length is $$4n$$, where $$n$$ is a very large number.
3. Party A sends party B one bit at a time, and each time A chooses one of the two bases randomly with equal chance, and record the basis chosen. Then A sends a qubit with a the ket based on the value of classical bit. For example, A chose $$(\ket{\uparrow}, \ket{\downarrow})$$ as the basis, and the value A desires to send is $$1$$. A would send a qubit with state $$\ket{\downarrow}$$. (Notice that at this time B does not know which basis was chosen by A yet.)
4. When B receives the qubit, B also randomly choose a basis, after making the measurement, B records the result of measurement along with the basis chosen.
5. After all qubits are transmitted, A and B both should have a list of classical bits and a list of bases with length $$4n$$.
6. A and B shares the list of bases they chose through an unencrypted line. Since both of them chose one of the bases randomly, about half the time they chose the same basis, which means they have about $$2n$$ qubits that were measured with the same basis. For qubits that were not measured with the same basis, about half of them should be correct, half of them should be incorrect, we can safely discard those bits and only focus on bits measured with the same basis.
7. Now we check if the message was intercepted. A and B choose $$n$$ bits out of the $$2n$$ bits, then compare them through an unencrypted line. Two things can happen:
1. If A and B agree on all $$n$$ bits, they can safely use the rest of $$n$$ bits as key.
2. If A and B don’t agree on all $$n$$ bits, that means someone has intercepted the message, they should not use these bits.

The logic is that when someone intercepts a qubit, she has to make a measurement based on a basis that is also randomly chosen, because she does not know which basis was chosen by A. Then the hacker has to make a “clone” of the qubit and send it to B. However, that is impossible since measuring a qubit changes its superposition. When all three parties agree on the same basis, the bit B gets would be the same as what A sent; when the hacker does not agree with A and B, half the time the recorded bits would be the same, the other half the time the recorded bits would be different. So even when A and B chose the same bases, about a quarter of those $$\approx 2n$$ bits would be different.

## Chapter 4: Entanglement

This is one of the shortest chapter in the book (13 pages) but also one of the most important one, many details and proofs in this note are not covered by the book.

When two qubits are entangled, measurement on one of the qubit affects the superposition of the other qubit.

Suppose we have two unentangled qubits in superposition $$\ket{v}$$ and $$\ket{w}$$:

$\ket{v} = c_0\ket{a_0} + c_1\ket{a_1}$

$\ket{w} = d_0\ket{b_0} + d_1\ket{b_1}$

The super position of these qubits are the tensor product of their superpositions:

\begin{align} \ket{v}\otimes\ket{w} &= (c_0\ket{a_0} + c_1\ket{a_1})\otimes(d_0\ket{b_0} + d_1\ket{b_1}) \\ &= c_0d_0\ket{a_0}\otimes\ket{b_0} + c_0d_1\ket{a_0}\otimes\ket{b_1} + c_1d_0\ket{a_1}\otimes\ket{b_0} + c_1d_1\ket{a_1}\otimes\ket{b_1} \end{align}

Notice that tensor product is not communicative, so $$\ket{v}\ket{w} \neq \ket{w}\ket{v}$$.

$\begin{bmatrix} x_0 \\ x_1 \end{bmatrix}\otimes\begin{bmatrix} y_0 \\ y_1 \end{bmatrix} = \begin{bmatrix} x_0y_0 \\ x_0y_1 \\ x_1y_0 \\ x_1y_1 \end{bmatrix}$

When two kets are written together, it denotes the tensor product, so the above equation can also be written as

$\ket{v}\ket{w} = c_0d_0\ket{a_0}\ket{b_0} + c_0d_1\ket{a_0}\ket{b_1} + c_1d_0\ket{a_1}\ket{b_0} + c_1d_1\ket{a_1}\ket{b_1}$

### Basis of Entangled State

Proof: $$(\ket{a_0}\ket{b_0}, \ket{a_0}\ket{b_1}, \ket{a_1}\ket{b_0}, \ket{a_1}\ket{b_1})$$ is the new orthonormal basis of the superposition.

Assume $$\{\ket{a_0}, \ket{a_1}\}$$ and $$\{\ket{b_0}, \ket{b_1}\}$$ are two orthonormal bases of $${\rm I\!R}^2$$, then the tensor product of any two pairs of vectors from each basis are also orthonormal, given they do not equal to each other.

Proof of normal:

Pick any vector $$\ket{a_0}$$ from the first basis and any vector $$\ket{b_0}$$ from the second basis,

$\ket{a_0}\ket{b_0} = \begin{bmatrix} a_{00} \\ a_{01} \end{bmatrix}\otimes\begin{bmatrix} b_{00} \\ b_{01} \end{bmatrix} = \begin{bmatrix} a_{00}b_{00} \\ a_{00}b_{01} \\ a_{01}b_{00} \\ a_{01}b_{01} \end{bmatrix}$

\begin{align} {\lvert\ket{a_0}\ket{b_0}\rvert}^2 &= a_{00}^2b_{00}^2 + a_{00}^2b_{01}^2 + a_{01}^2b_{00}^2 + a_{01}^2b_{01}^2 \\ &= a_{00}^2(b_{00}^2 + b_{01}^2) + a_{01}^2(b_{00}^2 + b_{01}^2) \\ &= (a_{00}^2 + a_{01}^2)(b_{00}^2 + b_{01}^2) \\ &= 1 \times 1 \\ &= 1 \end{align}

Proof of orthogonality:

Pick any vector $$\ket{a_0}$$ from the first basis, pick any two vectors $$\ket{b_0}$$ and $$\ket{b_1}$$ from the second basis, calculate their inner product

\begin{align} \langle\ket{a_0}\ket{b_0},\ket{a_0}\ket{b_1}\rangle &= \langle\begin{bmatrix} a_{00}b_{00} \\ a_{00}b_{01} \\ a_{01}b_{00} \\ a_{01}b_{01} \end{bmatrix}, \begin{bmatrix} a_{00}b_{10} \\ a_{00}b_{11} \\ a_{01}b_{10} \\ a_{01}b_{11} \end{bmatrix}\rangle \\ &= a_{00}b_{00}a_{00}b_{10} + a_{00}b_{01}a_{00}b_{11} + a_{01}b_{00}a_{01}b_{10} + a_{01}b_{01}a_{01}b_{11} \\ &= (a_{00}^2 + a_{01}^2)(b_{00}b_{01} + b_{01}b_{11}) \\ &= {\lvert\ket{a_0}\rvert}^2 \times \langle\ket{b_0}, \ket{b_1}\rangle \\ &= 1 \times 0 \\ &= 0 \end{align}

### Entanglement Superposition

The entanglement of two qubits can always be expressed as

$\ket{v}\ket{w} = c_0\ket{a_0}(d_0\ket{b_0} + d_1\ket{b_1}) + c_1\ket{a_1}(d_2\ket{b_0} + d_3\ket{b_1})$

or

$\ket{v}\ket{w} = (c_0\ket{a_0} + c_1\ket{a_1})d_0\ket{b_0} + (c_2\ket{a_0} + c_3\ket{a_1})d_1\ket{b_1}$

Constructing a valid entanglement state is easy in this form, as long as $$c_0^2 + c_1^2 = c_2^2 + c_3^2 = d_0^2 + d_1^2 = d_2^2 + d_3^2 = 1$$.

Which form is used depends on which qubit is measured first, if we express it in the first form, that means the first qubit is measured before the second one. If the measurement of the first qubit turns out to be $$\ket{a_0}$$, the second qubit’s super position will be $$d_0\ket{b_0} + d_1\ket{b_1}$$; if the measurement of the first qubit turns out to be $$\ket{a_q}$$, the second qubit’s super position will be $$d_2\ket{b_0} + d_3\ket{b_1}$$.

Now we can draw the conclusion that two qubits are unentangled if and only if $$d_0 = d_2$$ and $$d_1 = d_3$$; or $$c_0 = c_2$$ and $$c_1 = c_3$$ depending on which form you choose.

The universal form of expression for entanglement is

$\ket{v}\ket{w} = r\ket{a_0}\ket{b_0} + s\ket{a_0}\ket{b_1} + t\ket{a_1}\ket{b_0} + u\ket{a_1}\ket{b_1}$

where $$r^2 + s^2 + t^2 + u^2 = 1$$.

### Factorization

To keep things simple, from now on, if we want to factor the above equation we will assume we first measure the first qubit with state $$\ket{v}$$. All proofs following apply to both the first and second version of factored equation.

To factor the universal form, we need to pull $$\ket{a_0}$$ and $$\ket{a_1}$$ out first, then make all vectors inside the parenthesis unit vectors:

\begin{align} l_1 &= \sqrt{r^2 + s^2} \\ l_2 &= \sqrt{t^2 + u^2} \\ \end{align}

\begin{align} \ket{v}\ket{w} &= r\ket{a_0}\ket{b_0} + s\ket{a_0}\ket{b_1} + t\ket{a_1}\ket{b_0} + u\ket{a_1}\ket{b_1} \\ &= \ket{a_0}(r\ket{b_0} + s\ket{b_1}) + \ket{a_1}(t\ket{b_0} + u\ket{b_1}) \\ &= l_1\ket{a_0}(\frac{r}{l_1}\ket{b_0} + \frac{s}{l_1}\ket{b_1}) + l_2\ket{a_1}(\frac{t}{l_2}\ket{b_0} + \frac{u}{l_2}\ket{b_1}) \end{align}

Proof: the two qubits are unentangled if and only if $$ru=st$$.

From the last section we know that they are unentangled if and only if $$d_0 = d_2$$ and $$d_1 = d_3$$, which means

\begin{align} d_0 &= d_2 \\ \frac{r}{l_1} &= \frac{t}{l_2} \end{align}

and

\begin{align} d_1 &= d_3 \\ \frac{s}{l_1} &= \frac{u}{l_2} \end{align}

so

$\frac{l_1}{l_2} = \frac{r}{t} = \frac{s}{u}$

$ru = st$

Constructing entangled or unentangled qubits from factored expression is easy, because we have direct control over the probability amplitudes in every situation.

Constructing entangled qubits from the universal form is also easy, because we just need to find four numbers $$r$$, $$s$$, $$t$$ and $$u$$, and make sure that $$r^2 + s^2 + t^2 + u^2 = 1$$ and $$ru \neq st$$.

Next we will look at the mathematical restriction of constructing unentangled qubits from the universal form, which is not as obvious as the other constructions.

### Constructing Unentangled Qubits

Task: given value $$r$$, where $$0 \leqslant r \leqslant 1$$, how to correctly choose values for $$s$$, $$t$$ and $$u$$ to construct a valid unentangled qubits expression?

Since $$r$$ is a given valid constant, we need to find a reasonable value for $$u$$, so that $$s$$ and $$t$$ have solutions in the real number domain. We will denote squares with $$r' = r^2$$, $$s' = s^2$$, $$t' = t^2$$ and $$u' = u^2$$.

Solution: We know that

$r' + s' + t' + u' = 1$

and

\begin{align} ru &= st \\ r'u' &= s't' \\ s' &= \frac{r'u'}{t'} \end{align}

Then

\begin{aligned} r' + s' + t' + u' &= 1 \\ r' + \frac{r'u'}{t'} + t' + u' & = 1 \\ r't' + r'u' + {t'}^2 + u't' & = t' \\ {t'}^2 + (r' + u' - 1)t' + r'u' &= 0 \end{aligned}

$t' = \frac{1 - r' - u' \pm \sqrt{(1 - r' - u')^2 - 4r'u'}}{2}$

To make $$t'$$ has a real solution, we must satisfy

\begin{align} (1 - r' - u')^2 &\geqslant 4r'u' \\ {u'}^2 - 2(r' + 1)u' + (r' - 1)^2 &\geqslant 0 \end{align}

Find solution for $$u'$$:

\begin{align} u' &= \frac{2(r' + 1) \pm \sqrt{4(r' + 1)^2 - 4(r' - 1)^2}}{2} \\ &= \frac{2(r' + 1) \pm 2\sqrt{(r' + 1)^2 - (r' - 1)^2}}{2} \\ &= r' + 1 \pm \sqrt{(r' + 1)^2 - (r' - 1)^2} \\ &= r' + 1 \pm \sqrt{4r'} \\ &= r' \pm 2\sqrt{r'} + 1 \\ &= (1 + \sqrt{r'})^2, (1 - \sqrt{r'})^2 \end{align}

So $$u'$$ has to satisfy

$0 \leqslant u' \leqslant (1 - \sqrt{r'})^2$

or

$(1 + \sqrt{r'})^2 \leqslant u' \leqslant 1$

However, since we know $$0 \leqslant u' \leqslant 1$$ and $$(1 + \sqrt{r'})^2 \geqslant 1$$, we only need to satisfy the first condition, which already considers the situation where $$u' = 1$$.

\begin{align} u' &\leqslant (1 - \sqrt{r'})^2 \\ u &\leqslant 1 - \sqrt{r'} \\ u &\leqslant 1 - r \end{align}

Now we know for any given $$0 \leqslant r \leqslant 1$$, $$u$$ must satisfy $$0 \leqslant u \leqslant 1 - r$$ for $$s$$ and $$t$$ to have real solution. Next, let’s assume we have a valid value for $$u$$, we can use the following equation to get the value of both $$s$$ and $$t$$.

$t = \sqrt{\frac{1 - r^2 - u^2 \pm \sqrt{(1 - r^2 - u^2)^2 - 4r^2u^2}}{2}}$

We can also double check that these two solutions are consistent with $$ru=st$$ using equation $$(a + b)(a - b) = a^2 - b^2$$:

\begin{align} st &= \sqrt{\frac{1 - r^2 - u^2 + \sqrt{(1 - r^2 - u^2)^2 - 4r^2u^2}}{2}\cdot\frac{1 - r^2 - u^2 - \sqrt{(1 - r^2 - u^2)^2 - 4r^2u^2}}{2}} \\ &= \sqrt{\frac{(1 - r^2 - u^2)^2 - (1 - r^2 - u^2)^2 + 4r^2u^2}{4}} \\ &= \sqrt{\frac{4r^2u^2}{4}} \\ &= ru \end{align}