QuantumCore

Lesson 2 · 50 min · introductory

Complex Vector Spaces $\mathbb{C}^n$

Loading progress…

The axioms of a complex vector space, proved component-wise for Cn\mathbb{C}^n; linear independence, span, bases and dimension; uniqueness of coordinates; change of basis; and the ∣±⟩\lvert\pm\rangle basis that every qubit lesson relies on.

Prerequisites: Complex Numbers & Euler's Formula

Objectives and key results
  • Verify the eight vector-space axioms for Cn\mathbb{C}^n component by component.

  • Decide whether a list of vectors in Cn\mathbb{C}^n is linearly independent, and explain why the answer can differ over R\mathbb{R} and over C\mathbb{C}.

  • Compute the coordinates of a vector in a given basis, using the change-of-basis matrix [v]B=P−1[v]E[v]_{\mathcal B}=P^{-1}[v]_{\mathcal E}.

  • State and use the dimension of Cn\mathbb{C}^n (namely nn, and 2n2^n for an nn-qubit register).

definition · Linear independence
∑i=1kci bi=0 ⇒ c1=⋯=ck=0\sum_{i=1}^{k}c_i\,b_i=0\ \Rightarrow\ c_1=\cdots=c_k=0
theorem · Uniqueness of coordinates
v=∑icibi=∑idibi ⇒ ci=di  ∀iv=\sum_i c_i b_i=\sum_i d_i b_i\ \Rightarrow\ c_i=d_i\ \ \forall i
formula · Change of basis
[v]E=P [v]B,[v]B=P−1[v]E[v]_{\mathcal E}=P\,[v]_{\mathcal B},\qquad [v]_{\mathcal B}=P^{-1}[v]_{\mathcal E}
identity · The Hadamard basis
∣±⟩=12(∣0⟩±∣1⟩),det⁡12(111−1)=−1\lvert\pm\rangle=\tfrac{1}{\sqrt2}\bigl(\lvert0\rangle\pm\lvert1\rangle\bigr),\qquad \det\tfrac{1}{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}=-1

The axioms of a complex vector space#

A quantum state is a vector, and a quantum gate is a linear map on vectors. Before we can talk about either we need the precise notion of a vector space over C\mathbb{C}: a set in which we can add elements and multiply them by complex scalars, subject to rules that make these operations behave like the arrows of elementary geometry. The superposition principle of quantum mechanics, which says that if ∣ψ⟩\lvert\psi\rangle and ∣ϕ⟩\lvert\phi\rangle are possible states then so is (after normalisation) α∣ψ⟩+β∣ϕ⟩\alpha\lvert\psi\rangle+\beta\lvert\phi\rangle, is literally the statement that states live in a vector space.

The prototype, and the only example we need for finite quantum systems, is Cn\mathbb{C}^n: the set of columns v=(v1,…,vn)Tv=(v_1,\dots,v_n)^T with complex entries, added and scaled entry by entry,

u+v=(u1+v1⋮un+vn),c v=(c v1⋮c vn).u+v=\begin{pmatrix}u_1+v_1\\\vdots\\u_n+v_n\end{pmatrix},\qquad c\,v=\begin{pmatrix}c\,v_1\\\vdots\\c\,v_n\end{pmatrix}.

A single qubit lives in C2\mathbb{C}^2 and a register of nn qubits in C2n\mathbb{C}^{2^n}.

Definition

Vector space over the complex numbers

A complex vector space is a set VV with an addition V×V→VV\times V\to V and a scalar multiplication C×V→V\mathbb{C}\times V\to V such that for all u,v,w∈Vu,v,w\in V and a,b∈Ca,b\in\mathbb{C}:

  1. (commutativity) u+v=v+uu+v=v+u;
  2. (associativity of addition) (u+v)+w=u+(v+w)(u+v)+w=u+(v+w);
  3. (zero vector) there is 0∈V0\in V with v+0=vv+0=v;
  4. (additive inverse) for each vv there is −v-v with v+(−v)=0v+(-v)=0;
  5. (multiplicative identity) 1 v=v1\,v=v;
  6. (compatibility) a(bv)=(ab)va(bv)=(ab)v;
  7. (distributivity over vector addition) a(u+v)=au+ava(u+v)=au+av;
  8. (distributivity over scalar addition) (a+b)v=av+bv(a+b)v=av+bv.
Theorem

Cn\mathbb{C}^n is a complex vector space

With component-wise addition and scalar multiplication, Cn\mathbb{C}^n satisfies all eight axioms, with zero vector 0=(0,…,0)T0=(0,\dots,0)^T and inverse −v=(−v1,…,−vn)T-v=(-v_1,\dots,-v_n)^T.

Proof (8 steps)
  1. Step 1:
    (u+v)i=ui+vi=vi+ui=(v+u)i(u+v)_i=u_i+v_i=v_i+u_i=(v+u)_i
    Axiom 1: addition in C\mathbb{C} is commutative; this holds in every component ii, and vectors with equal components are equal.
  2. Step 2:
    ((u+v)+w)i=(ui+vi)+wi=ui+(vi+wi)=(u+(v+w))i((u+v)+w)_i=(u_i+v_i)+w_i=u_i+(v_i+w_i)=(u+(v+w))_i
    Axiom 2: addition in C\mathbb{C} is associative.
  3. Step 3:
    (v+0)i=vi+0=vi(v+0)_i=v_i+0=v_i
    Axiom 3: 00 is the additive identity of C\mathbb{C}, so the all-zeros column is the zero vector.
  4. Step 4:
    (v+(−v))i=vi+(−vi)=0(v+(-v))_i=v_i+(-v_i)=0
    Axiom 4: every complex number has an additive inverse.
  5. Step 5:
    (1 v)i=1⋅vi=vi(1\,v)_i=1\cdot v_i=v_i
    Axiom 5: 11 is the multiplicative identity of C\mathbb{C}.
  6. Step 6:
    (a(bv))i=a(bvi)=(ab)vi=((ab)v)i(a(bv))_i=a(bv_i)=(ab)v_i=((ab)v)_i
    Axiom 6: multiplication in C\mathbb{C} is associative.
  7. Step 7:
    (a(u+v))i=a(ui+vi)=aui+avi=(au+av)i(a(u+v))_i=a(u_i+v_i)=au_i+av_i=(au+av)_i
    Axiom 7: multiplication distributes over addition in C\mathbb{C}.
  8. Step 8:
    ((a+b)v)i=(a+b)vi=avi+bvi=(av+bv)i((a+b)v)_i=(a+b)v_i=av_i+bv_i=(av+bv)_i
    Axiom 8: the same distributive law with the roles of scalar and component exchanged.

∎

Linear independence, span and bases#

Definition

Linear combination and span

A linear combination of b1,…,bk∈Vb_1,\dots,b_k\in V is a vector c1b1+⋯+ckbkc_1b_1+\cdots+c_kb_k with complex coefficients cic_i. The span span⁡{b1,…,bk}\operatorname{span}\{b_1,\dots,b_k\} is the set of all such combinations. It is itself a vector space (a subspace of VV), because sums and scalar multiples of linear combinations are again linear combinations.

Definition

Linear independence, basis, dimension

The list b1,…,bkb_1,\dots,b_k is linearly independent if the only combination giving the zero vector is the trivial one: ∑icibi=0\sum_ic_ib_i=0 forces c1=⋯=ck=0c_1=\cdots=c_k=0. Otherwise it is linearly dependent, and then one of the vectors is a combination of the others. A basis of VV is a linearly independent list that spans VV. All bases of VV have the same length, called the dimension dim⁡V\dim V. The standard (computational) basis of Cn\mathbb{C}^n is e1=(1,0,…,0)T,…,en=(0,…,0,1)Te_1=(1,0,\dots,0)^T,\dots,e_n=(0,\dots,0,1)^T, so dim⁡Cn=n\dim\mathbb{C}^n=n; for qubits the standard basis vectors are written ∣0⟩,∣1⟩\lvert0\rangle,\lvert1\rangle (and ∣00⟩,∣01⟩,∣10⟩,∣11⟩\lvert00\rangle,\lvert01\rangle,\lvert10\rangle,\lvert11\rangle for two qubits).

Worked example 1 (dependent over C\mathbb{C}). Take b1=(1,i)Tb_1=(1,i)^T and b2=(i,−1)Tb_2=(i,-1)^T in C2\mathbb{C}^2. Multiply b1b_1 by the scalar ii:

i b1=(i⋅1i⋅i)=(i−1)=b2.i\,b_1=\begin{pmatrix}i\cdot1\\ i\cdot i\end{pmatrix}=\begin{pmatrix}i\\-1\end{pmatrix}=b_2 .

Hence i b1−b2=0i\,b_1-b_2=0 is a non-trivial vanishing combination (coefficients ii and −1-1), and the list is dependent. Viewed as real vectors in R4\mathbb{R}^4, namely (1,0,0,1)(1,0,0,1) and (0,1,−1,0)(0,1,-1,0) (real and imaginary parts interleaved), the same two vectors are independent over R\mathbb{R}, because no real multiple of one equals the other. Which scalars are allowed matters.

Worked example 2 (independent in C3\mathbb{C}^3). For b1=(1,0,i)Tb_1=(1,0,i)^T, b2=(0,1,1)Tb_2=(0,1,1)^T, b3=(1,1,0)Tb_3=(1,1,0)^T, place the vectors as columns of a matrix and compute its determinant by expansion along the first row:

det⁡(101011i10)=1 (1⋅0−1⋅1)−0 (0⋅0−1⋅i)+1 (0⋅1−1⋅i)=−1−i≠0.\det\begin{pmatrix}1&0&1\\0&1&1\\i&1&0\end{pmatrix}=1\,(1\cdot0-1\cdot1)-0\,(0\cdot0-1\cdot i)+1\,(0\cdot1-1\cdot i)=-1-i\ne0 .

A square matrix has nonzero determinant exactly when its columns are linearly independent, so b1,b2,b3b_1,b_2,b_3 is a basis of C3\mathbb{C}^3.

Theorem

Coordinates in a basis are unique

If b1,…,bnb_1,\dots,b_n is a basis of VV, every v∈Vv\in V can be written as v=∑i=1ncibiv=\sum_{i=1}^nc_ib_i for exactly one list of scalars (c1,…,cn)(c_1,\dots,c_n), called the coordinates [v]B[v]_{\mathcal B} of vv in the basis B\mathcal B.

Proof (5 steps)
  1. Step 1:
    v∈span⁡{b1,…,bn} ⇒ v=∑i=1ncibiv\in\operatorname{span}\{b_1,\dots,b_n\}\ \Rightarrow\ v=\sum_{i=1}^{n}c_ib_i
    Existence: a basis spans VV.
  2. Step 2:
    ∑i=1ncibi=v=∑i=1ndibi\sum_{i=1}^{n}c_ib_i=v=\sum_{i=1}^{n}d_ib_i
    Uniqueness: suppose there are two coordinate lists (ci)(c_i) and (di)(d_i).
  3. Step 3:
    ∑i=1ncibi−∑i=1ndibi=0\sum_{i=1}^{n}c_ib_i-\sum_{i=1}^{n}d_ib_i=0
    Subtract vv from both sides (additive inverse axiom).
  4. Step 4:
    ∑i=1n(ci−di) bi=0\sum_{i=1}^{n}(c_i-d_i)\,b_i=0
    Combine term by term with the distributive axiom 8 and commutativity/associativity of addition.
  5. Step 5:
    ci−di=0∀i ⇒ ci=dic_i-d_i=0\quad\forall i\ \Rightarrow\ c_i=d_i
    The bib_i are linearly independent, so every coefficient of a vanishing combination is zero.

∎

Change of basis#

A vector is a geometric object; its coordinates depend on the basis we use to describe it. Quantum computing constantly switches bases: a measurement "in the XX basis" is a measurement in the basis {∣+⟩,∣−⟩}\{\lvert+\rangle,\lvert-\rangle\}, and the Hadamard gate is precisely the matrix that converts coordinates between the computational and the ±\pm basis. The next derivation gives the general recipe.

Derivation

The change-of-basis matrix PP

  1. Step 1:
    P=( [b1]E ∣ [b2]E ∣ ⋯ ∣ [bn]E )P=\bigl(\,[b_1]_{\mathcal E}\ \big\vert\ [b_2]_{\mathcal E}\ \big\vert\ \cdots\ \big\vert\ [b_n]_{\mathcal E}\,\bigr)
    Define PP as the n×nn\times n matrix whose jj-th column is the new basis vector bjb_j written in the standard basis E\mathcal E.
  2. Step 2:
    v=∑j=1ncj bj,[v]B=(c1,…,cn)Tv=\sum_{j=1}^{n}c_j\,b_j,\qquad [v]_{\mathcal B}=(c_1,\dots,c_n)^T
    Expand vv in the new basis (unique by the previous theorem).
  3. Step 3:
    [v]E=∑j=1ncj [bj]E[v]_{\mathcal E}=\sum_{j=1}^{n}c_j\,[b_j]_{\mathcal E}
    Taking standard coordinates is linear: coordinates of a sum are sums of coordinates.
  4. Step 4:
    ([v]E)i=∑j=1nPij cj=(P [v]B)i\bigl([v]_{\mathcal E}\bigr)_i=\sum_{j=1}^{n}P_{ij}\,c_j=\bigl(P\,[v]_{\mathcal B}\bigr)_i
    Entry ii of [bj]E[b_j]_{\mathcal E} is PijP_{ij}; a sum of columns weighted by cjc_j is the matrix-vector product.
  5. Step 5:
    det⁡P≠0 ⇒ P−1 exists\det P\ne0\ \Rightarrow\ P^{-1}\text{ exists}
    The columns of PP form a basis, hence are independent, so PP is invertible.
  6. Step 6:
    [v]B=P−1[v]E[v]_{\mathcal B}=P^{-1}[v]_{\mathcal E}
    Multiply [v]E=P[v]B[v]_{\mathcal E}=P[v]_{\mathcal B} on the left by P−1P^{-1}.

The $\lvert\pm\rangle$ basis of a qubit#

Define ∣+⟩=12(1,1)T\lvert+\rangle=\tfrac1{\sqrt2}(1,1)^T and ∣−⟩=12(1,−1)T\lvert-\rangle=\tfrac1{\sqrt2}(1,-1)^T, i.e. ∣±⟩=12(∣0⟩±∣1⟩)\lvert\pm\rangle=\tfrac1{\sqrt2}(\lvert0\rangle\pm\lvert1\rangle). Their change-of-basis matrix is the Hadamard matrix HH shown below.

P=( ∣+⟩ ∣ ∣−⟩ )=12(111−1)=HP=\bigl(\,\lvert+\rangle\ \big\vert\ \lvert-\rangle\,\bigr)=\frac{1}{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}=H
Change-of-basis matrix from the ± basis to the computational basis (the Hadamard matrix)2×2

Unitary verified: U†U=IU^\dagger U = I (max deviation 2.2e-16)

Proposition

{∣+⟩,∣−⟩}\{\lvert+\rangle,\lvert-\rangle\} is a basis of C2\mathbb{C}^2 and P−1=PP^{-1}=P

The vectors ∣+⟩,∣−⟩\lvert+\rangle,\lvert-\rangle are linearly independent, hence a basis of the 22-dimensional space C2\mathbb{C}^2, and the change-of-basis matrix satisfies P−1=PP^{-1}=P, so [v]±=P [v]E[v]_\pm=P\,[v]_{\mathcal E}.

Proof (5 steps)
  1. Step 1:
    det⁡P=12⋅12det⁡(111−1)\det P=\frac{1}{\sqrt2}\cdot\frac{1}{\sqrt2}\det\begin{pmatrix}1&1\\1&-1\end{pmatrix}
    Pull the factor 12\tfrac1{\sqrt2} out of each of the two columns; the determinant is linear in each column.
  2. Step 2:
    =12(1⋅(−1)−1⋅1)=12(−2)=−1≠0=\frac12\bigl(1\cdot(-1)-1\cdot1\bigr)=\frac12(-2)=-1\ne0
    2×22\times2 determinant formula ad−bcad-bc.
  3. Step 3:
    ⇒ ∣+⟩,∣−⟩ independent; two vectors in dim⁡C2=2 ⇒ basis\Rightarrow\ \lvert+\rangle,\lvert-\rangle\ \text{independent; two vectors in }\dim\mathbb{C}^2=2\ \Rightarrow\ \text{basis}
    Nonzero determinant means independent columns, and nn independent vectors in an nn-dimensional space form a basis.
  4. Step 4:
    P2=12(1⋅1+1⋅11⋅1+1⋅(−1)1⋅1+(−1)⋅11⋅1+(−1)(−1))=12(2002)=IP^2=\frac12\begin{pmatrix}1\cdot1+1\cdot1&1\cdot1+1\cdot(-1)\\1\cdot1+(-1)\cdot1&1\cdot1+(-1)(-1)\end{pmatrix}=\frac12\begin{pmatrix}2&0\\0&2\end{pmatrix}=I
    Multiply the matrix by itself row by column.
  5. Step 5:
    ⇒ P−1=P,[v]±=P−1[v]E=P [v]E\Rightarrow\ P^{-1}=P,\qquad [v]_{\pm}=P^{-1}[v]_{\mathcal E}=P\,[v]_{\mathcal E}
    P⋅P=IP\cdot P=I says PP is its own inverse; substitute into the change-of-basis formula.

∎

Derivation

Worked example: v=(3+i, 1−i)Tv=(3+i,\,1-i)^T in the ±\pm basis

  1. Step 1:
    (c+c−)=12(111−1)(3+i1−i)\begin{pmatrix}c_+\\c_-\end{pmatrix}=\frac{1}{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}\begin{pmatrix}3+i\\1-i\end{pmatrix}
    [v]±=P[v]E[v]_\pm=P[v]_{\mathcal E} with P−1=PP^{-1}=P.
  2. Step 2:
    =12((3+i)+(1−i)(3+i)−(1−i))=\frac{1}{\sqrt2}\begin{pmatrix}(3+i)+(1-i)\\(3+i)-(1-i)\end{pmatrix}
    Matrix-vector product: first row adds the entries, second row subtracts them.
  3. Step 3:
    =12(42+2i)=(222 (1+i))=\frac{1}{\sqrt2}\begin{pmatrix}4\\2+2i\end{pmatrix}=\begin{pmatrix}2\sqrt2\\\sqrt2\,(1+i)\end{pmatrix}
    Complex addition component-wise, then 4/2=224/\sqrt2=2\sqrt2 and 2/2=22/\sqrt2=\sqrt2.
  4. Step 4:
    c+∣+⟩+c−∣−⟩=22⋅12(11)+2(1+i)⋅12(1−1)c_+\lvert+\rangle+c_-\lvert-\rangle=2\sqrt2\cdot\frac{1}{\sqrt2}\begin{pmatrix}1\\1\end{pmatrix}+\sqrt2(1+i)\cdot\frac{1}{\sqrt2}\begin{pmatrix}1\\-1\end{pmatrix}
    Check: rebuild vv from its new coordinates.
  5. Step 5:
    =(22)+(1+i−1−i)=(3+i1−i)=v ✓=\begin{pmatrix}2\\2\end{pmatrix}+\begin{pmatrix}1+i\\-1-i\end{pmatrix}=\begin{pmatrix}3+i\\1-i\end{pmatrix}=v\ \checkmark
    The factors 2⋅12=1\sqrt2\cdot\tfrac1{\sqrt2}=1 cancel and the columns add component-wise.

A second basis that appears constantly is the circular or ±i\pm i basis ∣+i⟩=12(1,i)T\lvert{+i}\rangle=\tfrac1{\sqrt2}(1,i)^T, ∣−i⟩=12(1,−i)T\lvert{-i}\rangle=\tfrac1{\sqrt2}(1,-i)^T, the eigenbasis of the Pauli YY operator. Its change-of-basis matrix is Q=12(11i−i)Q=\tfrac1{\sqrt2}\begin{pmatrix}1&1\\i&-i\end{pmatrix} with det⁡Q=12(−i−i)=−i≠0\det Q=\tfrac12(-i-i)=-i\ne0, so it is a basis too. Solving Q (c+i,c−i)T=(v1,v2)TQ\,(c_{+i},c_{-i})^T=(v_1,v_2)^T gives c±i=12(v1∓iv2)c_{\pm i}=\tfrac{1}{\sqrt2}(v_1\mp i v_2); for v=∣0⟩=(1,0)Tv=\lvert0\rangle=(1,0)^T this is c+i=c−i=12c_{+i}=c_{-i}=\tfrac1{\sqrt2}, and indeed 12(∣+i⟩+∣−i⟩)=12(2,0)T=∣0⟩\tfrac1{\sqrt2}(\lvert{+i}\rangle+\lvert{-i}\rangle)=\tfrac12(2,0)^T=\lvert0\rangle. In the widget below, edit a vector and watch its coordinates in all three bases update simultaneously.

Check your understanding#

Quick check

Are (1,i)T(1,i)^T and (i,−1)T(i,-1)^T linearly independent in C2\mathbb{C}^2?

Select one answer

Quick check

What is the ∣+⟩\lvert+\rangle-coordinate c+c_+ of ∣0⟩=(1,0)T\lvert0\rangle=(1,0)^T? (decimal)

tolerance ±0.001

Quick check

What is the complex dimension of the state space of a register of 55 qubits?

tolerance ±0.5

Quick check

PP has the new basis vectors as its columns. Which formula gives the new coordinates of vv?

Select one answer

References

  1. S. Axler, Linear Algebra Done Right, 4th ed., Springer (2024), Ch. 1 (vector spaces) and Ch. 2 (span, independence, bases, dimension).linear.axler.net
  2. M. A. Nielsen, I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press (2010), §2.1.1 (bases and linear independence).
  3. G. Strang, Introduction to Linear Algebra, 6th ed., Wellesley-Cambridge Press (2023), Ch. 3 (independence, basis and dimension) and §8.3 (change of basis).

Hands-on labs

  • Coordinates in the ± basis

    1 step · auto-graded

    Express v=(3+i)∣0⟩+(1−i)∣1⟩v=(3+i)\lvert0\rangle+(1-i)\lvert1\rangle in the basis {∣+⟩,∣−⟩}\{\lvert+\rangle,\lvert-\rangle\} of C2\mathbb{C}^2.

    Open lab