Skip to content

Lesson 2: Linear Algebra I: Complex Vector Spaces and Dirac Notation

2.1 Learning Outcomes

By the end of this hour a student will be able to:

  1. State the axioms of a complex vector space and verify them for \(\mathbb{C}^n\).
  2. Read and write Dirac (bra–ket) notation fluently and convert between ket, column-vector and coefficient forms.
  3. Test a set of vectors for linear independence and identify a basis and the dimension of a space.
  4. Expand an arbitrary vector in a given basis.
  5. Recognise the computational basis \(\{|0\rangle,|1\rangle\}\) and the Hadamard basis \(\{|+\rangle,|-\rangle\}\) of \(\mathbb{C}^2\).

2.2 Why Linear Algebra?

Quantum mechanics is linear algebra over the complex numbers, with a physical interpretation attached. Every object in the theory is one of three things:

Physical object Mathematical object
State of a system Unit vector in a complex Hilbert space
Evolution (a gate) Unitary matrix
Measurement / observable Hermitian matrix and its eigen-decomposition

If the linear algebra is secure, the rest of the course is bookkeeping. This lesson and the next two build that foundation.

2.3 Complex Numbers — a One-Page Refresher

A complex number is \(z = a + ib\) with \(a,b \in \mathbb{R}\) and \(i^2 = -1\).

  • Complex conjugate: \(\bar z = z^* = a - ib\).
  • Modulus: \(|z| = \sqrt{z\bar z} = \sqrt{a^2+b^2}\), so \(|z|^2 = a^2+b^2\).
  • Polar form: \(z = re^{i\theta}\) where \(r = |z|\) and \(\theta = \arg z\).
  • Euler's formula: \(e^{i\theta} = \cos\theta + i\sin\theta\).
  • A phase factor is any \(e^{i\theta}\); note \(|e^{i\theta}| = 1\).

Frequently used values.

\[ e^{i\pi} = -1, \quad e^{i\pi/2} = i, \quad e^{i\pi/4} = \tfrac{1}{\sqrt2}(1+i), \quad e^{2\pi i}=1 .\]

Common error. \(|a+ib|^2 \ne (a+ib)^2\). Always use \(z\bar z\). For example \(|3+4i|^2 = 9+16 = 25\), whereas \((3+4i)^2 = -7+24i\).

2.4 Complex Vector Spaces

Definition (Complex vector space). A set \(V\) with an addition \(+ : V\times V \to V\) and a scalar multiplication \(\cdot : \mathbb{C}\times V \to V\) is a complex vector space if for all \(u,v,w \in V\) and \(a,b \in \mathbb{C}\):

Axiom Statement
A1 Closure under \(+\) \(u+v \in V\)
A2 Commutativity \(u+v = v+u\)
A3 Associativity \((u+v)+w = u+(v+w)\)
A4 Zero vector \(\exists\, 0 \in V\) with \(v + 0 = v\)
A5 Additive inverse \(\exists\, (-v)\) with \(v + (-v) = 0\)
M1 Closure under \(\cdot\) \(a v \in V\)
M2 Compatibility \(a(bv) = (ab)v\)
M3 Unit scalar \(1\cdot v = v\)
D1 Distributivity over vectors \(a(u+v) = au + av\)
D2 Distributivity over scalars \((a+b)v = av + bv\)

The space we use. \(\mathbb{C}^n\) = all \(n\)-tuples of complex numbers written as column vectors, with componentwise addition and scalar multiplication. Everything in this course lives in \(\mathbb{C}^{2^n}\) for some \(n\).

2.5 Dirac Notation

Paul Dirac introduced a notation that makes quantum linear algebra dramatically more readable.

Definition (Ket). A ket \(|\psi\rangle\) denotes a column vector in \(V\):

\[ |\psi\rangle = \begin{pmatrix} \psi_1 \\ \psi_2 \\ \vdots \\ \psi_n \end{pmatrix} \in \mathbb{C}^n .\]

Definition (Bra). A bra \(\langle\psi|\) is the conjugate transpose (Hermitian adjoint) of the corresponding ket — a row vector:

\[ \langle\psi| = |\psi\rangle^\dagger = \begin{pmatrix} \psi_1^* & \psi_2^* & \cdots & \psi_n^* \end{pmatrix}. \]

The symbol \(\dagger\) ("dagger") means transpose then conjugate every entry.

The label inside the ket is just a name. \(|\psi\rangle\), \(|0\rangle\), \(|{\uparrow}\rangle\), \(|\text{cat}\rangle\) are all legitimate; what matters is the vector they denote.

The computational basis

\[ |0\rangle = \begin{pmatrix} 1 \\ 0\end{pmatrix}, \qquad |1\rangle = \begin{pmatrix} 0 \\ 1\end{pmatrix}. \]

These are not the numbers 0 and 1; they are orthonormal basis vectors of \(\mathbb{C}^2\). A general qubit state is

\[ |\psi\rangle = \alpha|0\rangle + \beta|1\rangle = \alpha\begin{pmatrix}1\\0\end{pmatrix} + \beta\begin{pmatrix}0\\1\end{pmatrix} = \begin{pmatrix}\alpha\\ \beta\end{pmatrix}. \]

Arithmetic in Dirac notation

Linearity works exactly as expected:

\[ a|\psi\rangle + b|\phi\rangle \ \longleftrightarrow\ a\vec\psi + b\vec\phi, \]

and taking the dagger conjugates the scalars:

\[ \big(a|\psi\rangle + b|\phi\rangle\big)^\dagger = a^*\langle\psi| + b^*\langle\phi| .\]

This conjugation of scalars is the single most common source of sign/phase errors. When you move from ket to bra, every complex coefficient picks up a star.

2.6 Linear Combinations, Span, Independence, Basis

Definition (Linear combination). Given \(|v_1\rangle,\dots,|v_k\rangle \in V\) and scalars \(c_1,\dots,c_k \in \mathbb{C}\), the vector \(\sum_{j=1}^k c_j|v_j\rangle\) is a linear combination.

Definition (Span). \(\mathrm{span}\{|v_1\rangle,\dots,|v_k\rangle\}\) is the set of all linear combinations of those vectors. It is itself a vector space (a subspace of \(V\)).

Definition (Linear independence). The vectors \(|v_1\rangle,\dots,|v_k\rangle\) are linearly independent if

\[ \sum_{j=1}^{k} c_j |v_j\rangle = 0 \quad \Longrightarrow \quad c_1 = c_2 = \cdots = c_k = 0 .\]

Otherwise they are linearly dependent — at least one vector is redundant.

Definition (Basis and dimension). A basis of \(V\) is a linearly independent set that spans \(V\). Every basis of a given space has the same number of elements; that number is the dimension \(\dim V\).

Theorem (Unique expansion). If \(\{|v_1\rangle,\dots,|v_n\rangle\}\) is a basis of \(V\), then every \(|\psi\rangle \in V\) has a unique expression \(|\psi\rangle = \sum_j c_j|v_j\rangle\).

Proof. Existence follows from spanning. For uniqueness, suppose \(\sum_j c_j|v_j\rangle = \sum_j d_j |v_j\rangle\). Subtracting, \(\sum_j (c_j - d_j)|v_j\rangle = 0\). Independence forces \(c_j - d_j = 0\) for all \(j\), i.e. \(c_j = d_j\). \(\blacksquare\)

Practical test for independence

Place the \(k\) vectors as columns of a matrix \(M\) (size \(n\times k\)).

  • If \(k = n\): independent \(\iff \det M \ne 0\).
  • In general: independent \(\iff \mathrm{rank}(M) = k\) (row-reduce and count non-zero rows).
  • If \(k > n\) in an \(n\)-dimensional space, the set is automatically dependent.

Two important bases of C²

Basis Vectors Use
Computational (\(Z\)) \(\lvert 0\rangle,\ \lvert 1\rangle\) Default; what a measurement returns
Hadamard (\(X\)) \(\lvert +\rangle = \tfrac{1}{\sqrt2}(\lvert 0\rangle+\lvert 1\rangle)\), \(\lvert -\rangle = \tfrac{1}{\sqrt2}(\lvert 0\rangle-\lvert 1\rangle)\) Superposition, phase kick-back, interference
Circular (\(Y\)) \(\lvert {+}i\rangle = \tfrac{1}{\sqrt2}(\lvert 0\rangle+i\lvert 1\rangle)\), \(\lvert {-}i\rangle = \tfrac{1}{\sqrt2}(\lvert 0\rangle-i\lvert 1\rangle)\) \(Y\)-basis measurements

Note the reversible relations

\[ |0\rangle = \tfrac{1}{\sqrt2}\big(|+\rangle + |-\rangle\big), \qquad |1\rangle = \tfrac{1}{\sqrt2}\big(|+\rangle - |-\rangle\big). \]

2.7 Solved Problems

Problem 1 — Expressing a state as a column vector and its bra

Write \(|\psi\rangle = (2-i)|0\rangle + 3i|1\rangle\) as a column vector, give \(\langle\psi|\), and normalise the state.

Solution.

\[ |\psi\rangle = \begin{pmatrix} 2-i \\ 3i \end{pmatrix}, \qquad \langle\psi| = \begin{pmatrix} 2+i & -3i \end{pmatrix}. \]

(Each entry is conjugated: \(\overline{2-i} = 2+i\), \(\overline{3i} = -3i\).)

Norm squared:

\[ |2-i|^2 = 2^2 + (-1)^2 = 5, \qquad |3i|^2 = 3^2 = 9, \qquad \||\psi\rangle\|^2 = 5 + 9 = 14 .\]

Normalised state:

\[ |\tilde\psi\rangle = \frac{1}{\sqrt{14}}\begin{pmatrix} 2-i \\ 3i \end{pmatrix} = \frac{2-i}{\sqrt{14}}|0\rangle + \frac{3i}{\sqrt{14}}|1\rangle .\]

Check: \(\frac{5}{14} + \frac{9}{14} = 1\) ✓. Measurement probabilities are \(5/14 \approx 0.357\) and \(9/14 \approx 0.643\).

Problem 2 — Testing linear independence

Are the following vectors in \(\mathbb{C}^3\) linearly independent?

\[ |v_1\rangle = \begin{pmatrix}1\\0\\i\end{pmatrix},\quad |v_2\rangle = \begin{pmatrix}0\\1\\1\end{pmatrix},\quad |v_3\rangle = \begin{pmatrix}1\\1\\1+i\end{pmatrix}. \]

Solution. Three vectors in a 3-dimensional space, so compute the determinant of

\[ M = \begin{pmatrix} 1 & 0 & 1 \\ 0 & 1 & 1 \\ i & 1 & 1+i \end{pmatrix}. \]

Expand along the first row:

\[ \det M = 1\cdot\begin{vmatrix}1 & 1\\ 1 & 1+i\end{vmatrix} - 0\cdot\begin{vmatrix}0&1\\ i& 1+i\end{vmatrix} + 1\cdot\begin{vmatrix}0&1\\ i&1\end{vmatrix} \]
\[ = 1\big[(1)(1+i) - (1)(1)\big] + 1\big[(0)(1) - (1)(i)\big] = (1+i-1) + (-i) = i - i = 0 .\]

\(\det M = 0\), so the vectors are linearly dependent.

Find the relation: observe \(|v_1\rangle + |v_2\rangle = (1,1,1+i)^T = |v_3\rangle\). Hence

\[ |v_1\rangle + |v_2\rangle - |v_3\rangle = 0 . \]

Problem 3 — Change of basis

Express \(|\psi\rangle = \frac{3}{5}|0\rangle + \frac{4}{5}|1\rangle\) in the Hadamard basis \(\{|+\rangle, |-\rangle\}\), and give the probabilities of the two outcomes of an \(X\)-basis measurement.

Solution. Substitute \(|0\rangle = \frac{1}{\sqrt2}(|+\rangle + |-\rangle)\) and \(|1\rangle = \frac{1}{\sqrt2}(|+\rangle - |-\rangle)\):

\[ |\psi\rangle = \tfrac{3}{5}\cdot\tfrac{1}{\sqrt2}\big(|+\rangle + |-\rangle\big) + \tfrac{4}{5}\cdot\tfrac{1}{\sqrt2}\big(|+\rangle - |-\rangle\big) \]
\[ = \frac{1}{\sqrt2}\left(\tfrac{3}{5}+\tfrac{4}{5}\right)|+\rangle + \frac{1}{\sqrt2}\left(\tfrac{3}{5}-\tfrac{4}{5}\right)|-\rangle = \frac{7}{5\sqrt2}|+\rangle - \frac{1}{5\sqrt2}|-\rangle .\]

Check normalisation: \(\frac{49}{50} + \frac{1}{50} = 1\) ✓.

\[ \Pr[+] = \frac{49}{50} = 0.98, \qquad \Pr[-] = \frac{1}{50} = 0.02 .\]

Interpretation. In the \(Z\) basis the state is quite uncertain (0.36 / 0.64); in the \(X\) basis it is almost deterministic. The randomness of a measurement outcome depends on which basis you measure in, not on the state alone.

Problem 4 — Verifying a vector space axiom fails

Let \(S = \{(z_1,z_2) \in \mathbb{C}^2 : |z_1|^2 + |z_2|^2 = 1\}\) — the set of normalised qubit states. Is \(S\) a vector space?

Solution. Test closure under addition. Take \(|0\rangle = (1,0) \in S\) and \(|1\rangle = (0,1) \in S\). Then

\[ |0\rangle + |1\rangle = (1,1), \qquad |1|^2 + |1|^2 = 2 \ne 1 . \]

So \((1,1) \notin S\): closure fails, and \(S\) is not a vector space. Also \(0 = (0,0)\) has norm 0, so the zero vector is missing.

Why this matters. The set of physical states is the unit sphere inside \(\mathbb{C}^2\), not a subspace. We do linear algebra in the full space \(\mathbb{C}^2\) and re-normalise whenever we form a superposition. This is why every superposition you write carries a factor like \(1/\sqrt2\).

Problem 5 — Building a basis from a spanning set

Find a basis for \(\mathrm{span}\{|u_1\rangle,|u_2\rangle,|u_3\rangle\}\) where

\[ |u_1\rangle = \begin{pmatrix}1\\1\\0\end{pmatrix},\ |u_2\rangle = \begin{pmatrix}2\\2\\0\end{pmatrix},\ |u_3\rangle = \begin{pmatrix}0\\1\\i\end{pmatrix}. \]

Solution. Immediately \(|u_2\rangle = 2|u_1\rangle\), so \(|u_2\rangle\) is redundant.

Test whether \(\{|u_1\rangle,|u_3\rangle\}\) is independent. Suppose \(a|u_1\rangle + b|u_3\rangle = 0\). Componentwise:

  • Row 1: \(a = 0\)
  • Row 3: \(ib = 0 \Rightarrow b = 0\)

Both scalars vanish, so they are independent. Therefore

\[ \{|u_1\rangle, |u_3\rangle\} \text{ is a basis, and } \dim(\mathrm{span}) = 2 . \]

The span is a 2-dimensional plane through the origin in \(\mathbb{C}^3\).

2.8 Practice Problems

  1. Write \(|\phi\rangle = \frac{1}{\sqrt3}|0\rangle - \frac{i\sqrt2}{\sqrt3}|1\rangle\) as a column vector and give \(\langle\phi|\). Verify normalisation.
  2. Are \((1,i)^T\) and \((i,-1)^T\) linearly independent in \(\mathbb{C}^2\)? [Ans: no — the second is \(i\) times the first]
  3. Express \(|1\rangle\) in the \(\{|+i\rangle, |-i\rangle\}\) basis.
  4. Show that \(\{|+\rangle, |-\rangle\}\) is a basis of \(\mathbb{C}^2\) by computing a determinant.
  5. Prove that any 3 vectors in \(\mathbb{C}^2\) must be linearly dependent.
  6. If \(|\psi\rangle = a|0\rangle+b|1\rangle\) with \(a=\frac{1+i}{2}\), find \(b\) (real and positive) so that \(|\psi\rangle\) is normalised. [Ans: \(b = 1/\sqrt2\)]

2.9 Summary

  • Quantum states are vectors in a complex vector space; gates are matrices acting on them.
  • Ket \(|\psi\rangle\) = column vector; bra \(\langle\psi| = |\psi\rangle^\dagger\) = row vector with all entries conjugated.
  • Linear independence, span, basis and dimension carry over unchanged from real linear algebra; only the scalar field changes to \(\mathbb{C}\).
  • Expansion in a basis is unique; the computational basis \(\{|0\rangle,|1\rangle\}\) and Hadamard basis \(\{|+\rangle,|-\rangle\}\) are the two workhorses.
  • Physical states form the unit sphere, not a subspace — always re-normalise after superposing.

Next lesson: L03 — Inner products, Hilbert spaces and orthonormality.

Practise now: Interactive-Web-Platform/unit1-qubit-lab.html → State Explorer shows the column-vector, Dirac and basis-expansion forms of any state you build.