Every later lecture is this maths in disguise. A qubit is a vector with two complex entries. A gate is a matrix. A measurement probability is the squared size of a complex number. If you are solid here, the rest of the module is mostly bookkeeping.
Vectors
A scalar is just a number. A vector has size and direction. In 3D you can write it as amounts along three unit directions ex,ey,ez:
v=vxex+vyey+vzez=vxvyvz.
Dot product. Multiply matching entries and add them. It measures how much two vectors point the same way:
a⋅b=axbx+ayby+azbz.
Norm (length). ∥v∥=v⋅v=vx2+vy2+vz2. Dividing by it gives a unit vector (length 1) in the same direction: v^=v/∥v∥.
Kets and bras: the quantum notation
A bra times a ket is a row times a column, which gives one number: the inner product.
⟨a∣b⟩=(aˉ1aˉ2)(b1b2)=aˉ1b1+aˉ2b2.
A ket times a bra is a column times a row, which gives a matrix:
∣a⟩⟨b∣=(a1bˉ1a2bˉ1a1bˉ2a2bˉ2).
Matrices
A matrix is a grid of numbers. Aij is the entry in row i, column j. An m×n matrix has m rows and n columns; a vector is an n×1 matrix.
Adding: only same-size matrices, entry by entry.
Scalar times matrix: multiply every entry.
Trace of a square matrix: add the diagonal. Tr(1324)=1+4=5.
Multiplying: AB is allowed only if (columns of A) = (rows of B). Entry (i,j) is “row i of A dotted with column j of B”:
(AB)ij=k∑AikBkj.
An m×n times an n×p gives an m×p.
Order matters
Addition commutes (A+B=B+A), multiplication usually does not. With the matrices you will meet again in Lecture 4:
XZ=(0110)(100−1)=(01−10),ZX=(0−110).
So XZ=−ZX. In quantum mechanics this non-commuting is physics: it is the uncertainty principle from Lecture 1.
Eigenvectors and eigenvalues
If a matrix only stretches a vector (no change of direction), that vector is an eigenvector and the stretch factor is its eigenvalue:
A∣v⟩=a∣v⟩.
Lock it in · answer in your head, then reveal
What is a ket? What is a bra?
A ket ∣ψ⟩ is a column vector. A bra ⟨ψ∣ is its conjugate transpose: a row vector with every entry complex-conjugated.
What do you get from bra × ket, and from ket × bra?
⟨a∣b⟩ is a single number. ∣a⟩⟨b∣ is a square matrix.
When can you multiply an m×n matrix by an m′×n′ one?
Only if n=m′ (columns of the first = rows of the second). The result is m×n′.
Is matrix multiplication commutative?
Not in general: usually AB=BA. Addition is commutative.
What is an eigenvector of A?
A vector whose direction A does not change: A∣v⟩=a∣v⟩. The number a is the eigenvalue.
Complex numbers
Number systems grew to solve equations: x+5=2 needs negatives; 3x=2 needs fractions; x2=2 needs irrationals like 2. And x2=−1 needs something new: the imaginary uniti, defined by
i2=−1.
A complex number is z=a+bi with a,b real. The fundamental theorem of algebra says every degree-n polynomial has exactly n complex roots (counted with multiplicity), so complex numbers are “enough” for all of algebra.
Multiplying: expand like brackets and use i2=−1:
(a+bi)(c+di)=ac+adi+bci+bdi2=(ac−bd)+(ad+bc)i.
A number times its conjugate is always real and equals the size squared:
zzˉ=(a+bi)(a−bi)=a2+b2=∣z∣2.
Dividing: multiply top and bottom by the conjugate of the bottom, which makes the bottom real:
zw=zzˉwzˉ=∣z∣2wzˉ.
Polar form, Euler’s formula and phase
Plot z=a+bi as the point (a,b): real part across, imaginary part up. Then z is an arrow with lengthr=∣z∣ and angleθ from the positive real axis (the argument or phase). Trigonometry gives a=rcosθ, b=rsinθ.
Euler’s formula packs this together:
eiθ=cosθ+isinθ⟹z=reiθ.
Explore · the complex plane
Drag the purple dot (or focus it and use the arrow keys). Notice: the conjugate is always the mirror image in the real axis, and |z| is just the length of the arrow.
z
Re z, Im z
Conjugate z̄
|z| = √(a² + b²)
arg z (phase θ)
Polar form
z · z̄ = |z|²
Scale: the dashed circle has radius 1. Multiplying by eiθ only rotates; it never changes the length, which is why a phase never changes a probability.
Polar form makes multiplication easy: lengths multiply, angles add:
r1eiθ1⋅r2eiθ2=r1r2ei(θ1+θ2),zn=rneinθ.
So multiplying by eiθ (length 1) just rotates an arrow. Keep this picture: in Lecture 3 a phase factor eiθ will rotate an amplitude without changing any probability.
eiθ=cosθ+isinθ, so any z=reiθ with r=∣z∣ and θ the argument (phase).
Worked exercises
2.1 · Bra-ket with complex entries
Lecture 2 style
Let ∣a⟩=(1i) and ∣b⟩=(23i). Find ⟨a∣b⟩, ⟨b∣a⟩ and ∥∣b⟩∥.
Worked solution
Make the bra by transposing and conjugating: ⟨a∣=(1,−i).
⟨a∣b⟩=1⋅2+(−i)(3i)=2−3i2=2+3=5.
⟨b∣=(2,−3i), so ⟨b∣a⟩=2⋅1+(−3i)(i)=2+3=5. (In general ⟨b∣a⟩=⟨a∣b⟩; here the result happens to be real.)
⟨b∣b⟩=2⋅2+(−3i)(3i)=4+9=13, so ∥∣b⟩∥=13.
Answer:⟨a∣b⟩=⟨b∣a⟩=5, ∥∣b⟩∥=13≈3.61.
2.2 · Ket times bra
Lecture 2 slide: bras and kets
Compute ∣0⟩⟨1∣ and ∣1⟩⟨1∣, where ∣0⟩=(10), ∣1⟩=(01).
Worked solution
Column times row gives a 2×2 matrix whose entry (i,j) is (entry i of the ket) × (entry j of the bra).
∣0⟩⟨1∣=(10)(01)=(0010).
∣1⟩⟨1∣=(01)(01)=(0001).
Answer:∣0⟩⟨1∣=(0010) and ∣1⟩⟨1∣=(0001). You can build any 2×2 matrix from four such pieces, e.g. X=∣0⟩⟨1∣+∣1⟩⟨0∣.
2.3 · Matrix product, both orders
Lecture 2: commutativity
With A=(1021) and B=(0110), compute AB and BA.
Worked solution
(AB)11= row 1 of A · column 1 of B=1⋅0+2⋅1=2; (AB)12=1⋅1+2⋅0=1.
(AB)21=0⋅0+1⋅1=1; (AB)22=0⋅1+1⋅0=0. So AB=(2110).
(BA): row 1 of B is (0,1), giving (0⋅1+1⋅0,0⋅2+1⋅1)=(0,1); row 2 is (1,0), giving (1,2).
So BA=(0112)=AB.
Answer:AB=(2110), BA=(0112): different, so they do not commute.
2.4 · Complex arithmetic
Lecture 2: complex definitions
For w=3+4i and z=1−2i find wz, wˉ, ∣w∣ and w/z.
Worked solution
wz=(3+4i)(1−2i)=3−6i+4i−8i2=3−2i+8=11−2i.
wˉ=3−4i and ∣w∣=32+42=25=5.
For w/z, multiply top and bottom by zˉ=1+2i. Bottom: zzˉ=12+22=5.
Top: (3+4i)(1+2i)=3+6i+4i+8i2=−5+10i.
So w/z=(−5+10i)/5=−1+2i. Check: (−1+2i)(1−2i)=−1+2i+2i−4i2=3+4i ✓.
Answer:wz=11−2i, wˉ=3−4i, ∣w∣=5, w/z=−1+2i.
2.5 · Polar form and powers
Lecture 2: polar coordinates
Write z=1+i in polar form and use it to find z8.
Worked solution
r=∣z∣=12+12=2.
The point (1,1) is in the first quadrant, so θ=tan−1(1/1)=π/4 (45°).
So z=2eiπ/4.
z8=(2)8ei⋅8π/4=16e2πi.
e2πi=cos2π+isin2π=1, so z8=16.
Answer:z=2eiπ/4 and z8=16. Expanding (1+i)8 by hand would take far longer.
2.6 · Eigenvectors of Z
Lecture 2: eigenvalues
Show that ∣0⟩ and ∣1⟩ are eigenvectors of Z=(100−1) and find the eigenvalues. Is 21(11) an eigenvector?
Worked solution
Z∣0⟩=(100−1)(10)=(10)=(+1)∣0⟩: eigenvalue +1.
Z∣1⟩=(0−1)=(−1)∣1⟩: eigenvalue −1.
Z21(11)=21(1−1), which is not a multiple of (11).
Answer: Eigenvalues +1 (for ∣0⟩) and −1 (for ∣1⟩). The vector (1,1)/2 is not an eigenvector, so in the language above it has no definite “Z value”.
Check yourself
What is ∣2−i∣?
∣a+bi∣=a2+b2=4+1=5. The sign of b does not matter because it is squared, and 5 would be ∣z∣2.
↧ Go deeper: Hilbert spaces, adjoints and spectral theorem MSc
The space of qubit states is C2 with the inner product ⟨a∣b⟩: a (finite-dimensional) Hilbert space. The adjoint A† is defined by ⟨a∣Ab⟩=⟨A†ab⟩ for all vectors, which for matrices is the conjugate transpose. The spectral theorem says every normal matrix (AA†=A†A), including every Hermitian and every unitary matrix, can be written A=∑kλk∣k⟩⟨k∣ with orthonormal eigenvectors ∣k⟩. That one fact underlies measurement (Lecture 3) and gates (Lecture 4). Read: Nielsen & Chuang §2.1; Axler, Linear Algebra Done Right, ch. 6–7.
↧ Go deeper: Why complex numbers, not just real? PhD
Could quantum theory work with real amplitudes only? For single systems you can always fake it with more dimensions, but in 2021 Renou et al. (Nature 600, 625) showed that real-number quantum theory makes different predictions in a network Bell-type experiment, and experiments since agree with the complex version. Complex numbers are not just a convenience.