Lecture 011 - Linear Algebra of One Qubit

Linear Algebra of 1 Qubit

Ket Diagram

Ket Diagram

|+\rangle = \begin{bmatrix} +\sqrt{1/2}\\ +\sqrt{1/2}\\ \end{bmatrix}, -|+\rangle = \begin{bmatrix} -\sqrt{1/2}\\ -\sqrt{1/2}\\ \end{bmatrix}, |-\rangle = \begin{bmatrix} +\sqrt{1/2}\\ -\sqrt{1/2}\\ \end{bmatrix}, -|-\rangle = \begin{bmatrix} -\sqrt{1/2}\\ +\sqrt{1/2}\\ \end{bmatrix},

NOT: reflection accross \pi/4

HAD: reflection accross \pi/8

Since both instruction cancels out if they are applied sequentially, so we only need to consider two matrix act on one qubit.

def R(A):
R = \begin{bmatrix} \sqrt{1/2}, \sqrt{1/2}\\ -\sqrt{1/2}, \sqrt{1/2}\\ \end{bmatrix}

R: rotation by -\pi/4

def R-1(A):
R^\dagger = \begin{bmatrix} \sqrt{1/2}, -\sqrt{1/2}\\ \sqrt{1/2}, \sqrt{1/2}\\ \end{bmatrix}

R^\dagger: rotation by \pi/4

Note that the matrix R is not its self inverse/reverse. R is unitrary because the reverse is its inverse.

General Rotation

Any rotation by \theta is unitrary, and therefore allowed

R_{\theta}^{(x,y)} = \begin{bmatrix} x & -y\\ y & x\\ \end{bmatrix}, R_{-\theta}^{(x,y)} = \begin{bmatrix} x & y\\ -y & x\\ \end{bmatrix}

where (x, y) is the vector you end up after applying rotation to (0, 0).

Every unitary matrix is a rotation or reflection.

Two reflections generates a rotation for \geq 1 dimension reflecting point.

If higher dimension is allowed, reflection can be simulated by rotation.

If we first apply reflection against \alpha degree and then against \beta degree, the final rotation angle is 2(\beta - \alpha).

Note that reflection is not commutative.

Dirac Bra-Ket

Bra: \langle \cdot | column vector

Ket: |\cdot \rangle row vector

We also define:

|\cdot\rangle^\dagger = |\cdot\rangle^T = \langle\cdot |
\langle 0 | = \begin{bmatrix} 1 & 0\\ \end{bmatrix}, \langle 1 | = \begin{bmatrix} 0 & 1\\ \end{bmatrix}

You can use these vectors to get coordinates:

\langle 0 | \cdot | v \rangle = \langle 0 | v \rangle = \text{the } 0^\text{th} \text{ coordinate of } |v\rangle Notice when the matrix multiplication type-check, the notation forms a nice bracket.

For vectors, dot product is equivalent as matrix multiplication.

We also have the following property: for L, R matrix

(L \cdot R)^\dagger = R^\dagger \cdot L^\dagger


\langle f | v \rangle^\dagger = |v\rangle^\dagger \cdot \langle f|^\dagger = \langle v | f \rangle

Most importantly, dot product with complex number is not commutative, this is because the row vector of a complex vector doesn't look the same as the column vector of a complex vector. This is because we defined "transformation between row and column" as \dagger. But \dagger need swapping i with -i. Therefore, daggering a 1\times1 matrix isn't necessary the identity when you have complex numbers.

If M is a complex matrix, M^\dagger is formed by swaping rows and column (transpose) and then swapping i with -i ("complex conjugate") for each entry.

Printing (in standard basis |0\rangle, |1\rangle) qubit in state |v\rangle will output "0" with probability |\langle 0 | v \rangle |^2 and "1" with probability |\langle 1 | v \rangle |^2

If we only care about the probability of printing "0" after some transformation T, we can do the following:

  1. apply T^\dagger with |0\rangle: |t\rangle = T^\dagger|0\rangle
  2. apply T^\dagger|0\rangle to the state we care about: \langle t | v \rangle = |t\rangle^\dagger |v\rangle = (T^\dagger|0\rangle)^\dagger |v\rangle = \langle 0 | T |v \rangle

There are three interpolation to notation \langle f | v \rangle:


The pseudo code of measuring look like this:

def measure(A):
  if rand(A) == "0":
    A = |0>
  elif rand(A) == "1":
    A = |1>

We can also measure in different basis.

def measure(A, theta):
  rotate(A, -theta)
  measure(A) # interpret 0 as theta direction, and 1 as theta+\pi/2 direction
  rotate(A, theta) # mimic stay in deterministic with respect to measuring basis

The above function is: when \vec{i}, \vec{j} forms a orthornormal basis in \mathbb{R}^2

"deterministic" only make sense if you specify basis

If a state |v\rangle is \theta_i angle with respect to its basis |\vec{i}\rangle, then:

The cosine and sine comes from projection. Basically taking the \vec{i} component (for \cos) or taking the \vec{j} component (for \sin) of |v\rangle.

|f\rangle = (\cos \theta) |0\rangle + (\sin \theta) |1\rangle$$ $$|g\rangle = (-\sin \theta) |0\rangle + (\cos \theta) |0\rangle


We define the filter to have the following property:

\pi/4 radian filter has basis |+\rangle and -|-\rangle. Therefore the pass through (output +)'s probability is \cos ^2(45\degree) = (\sqrt{1/2})^2 = \frac{1}{2}

The probability of going through is |\langle \vec{\theta} | v \rangle|^2. When assume real:

Pr\{\text{going through}\} = |(\cos \theta)(\cos (\theta+\delta)) + (\sin \theta)(\sin (\theta + \delta))|^2

If you want turn the amplitude by \delta degree with n filters, the intensity of light getting through is:

\prod_{i=1}^{n}\left(\left(\cos\theta\right)\cos\left(\theta+\frac{\delta}{n}\right)+\left(\sin\theta\right)\sin\left(\theta+\frac{\delta}{n}\right)\right)^{2} = \left(\cos\frac{\delta}{n}\right)^{2n}

We choose to evenly distribute the angles because the function \cos and \sin is about linear near small angle. If the difference of angle is too big, the error will accumulate, meaning more intensity of light will be lost.

Table of Content