Lesson 5 · 45 min · introductory
Linear Operators & Matrix Representations
A linear operator on a finite-dimensional Hilbert space is completely described by a square matrix of numbers . This lesson derives that representation, shows that composing operators is multiplying matrices, defines the adjoint and proves how a matrix changes when we switch orthonormal bases.
Prerequisites: Dirac Bra–Ket Notation & Outer Products
Objectives and key results
Represent a linear map by its matrix elements in an orthonormal basis and reconstruct .
Compose operators as matrix products, deriving from the completeness relation.
Compute adjoints from the defining identity and use and .
Change orthonormal basis with and explain why the trace does not depend on the basis.
- definition · Matrix element
- identity · Composition is matrix multiplication
- identity · Adjoint
- theorem · Change of orthonormal basis
- identity · Trace is basis independent
Linear maps and their matrices#
Quantum states live in a Hilbert space , and everything that happens to a state — a gate, a time evolution, a measurement observable — is described by a linear operator on that space. Before we can talk about Hermitian observables or unitary gates we need a precise, computational handle on operators in general. The key message of this lesson is simple: once an orthonormal basis is fixed, an operator is a complex matrix, and every abstract statement about operators becomes a statement about matrices that we can check with a calculator or a simulator.
Throughout, is an orthonormal basis, so , and we use the completeness relation from the Dirac-notation lesson:
Definition
Linear operator
A map is linear if for all vectors and all scalars . We write or for the image of .
A linear operator is determined by the images of the basis vectors
Let be linear on with orthonormal basis . Then for every we have . In particular, two linear operators that agree on every basis vector are equal, and is fully specified by the vectors .
Proof (4 steps)
- Step 1:Expand in the orthonormal basis; the coefficients are the inner products (Parseval).
- Step 2:Apply to both sides of the expansion.
- Step 3:Linearity lets us pull the finite sum and the scalars outside .
- Step 4:If two linear maps agree on the basis, the same expansion shows they agree on every vector, so .
∎
From basis images to the matrix
- Step 1:Expand the vector in the basis by inserting on the left.
- Step 2:Name the coefficients: column of the matrix holds the coordinates of the image .
- Step 3:Combine with the proposition above and swap the two finite sums.
- Step 4:The -th coordinate of the image is the ordinary matrix–vector product of the matrix with the column .
- Step 5:Inserting completeness on both sides writes the operator itself as a sum of outer products weighted by its matrix elements.
Result
Worked example — the bit flip. Define on a qubit by and and extend linearly. Column 0 is the image of , i.e. ; column 1 is the image of , i.e. . So and for a general state . The matrix elements are and , exactly as the formula predicts.
Worked example — a non-unitary operator. The operator ("lowering") sends and . Its matrix is . It is perfectly linear but it destroys information (two different inputs, and , collapse together), so it can never be a quantum gate; it appears later as a Kraus operator of amplitude damping.
Unitary verified: (max deviation 0.0e+0)
Quick check
An operator satisfies and . What is ?
Composition is matrix multiplication#
Applying first and then gives the operator defined by . It is linear because both factors are. In a quantum circuit read left to right, the gate applied first stands rightmost in the product: the circuit " then " has unitary . The matrix of follows from one insertion of the completeness relation.
Matrix of a composition
- Step 1:Definition of the matrix element of the operator .
- Step 2:Insert the identity operator between the two factors; this changes nothing.
- Step 3:Replace by the completeness relation .
- Step 4:Linearity of the inner product lets the finite sum move outside.
- Step 5:Recognise each bracket as a matrix element; this is exactly the row-times-column rule of matrix multiplication.
Result
Worked example — order matters. With and : So : the two Pauli operators anticommute. Comparing with we find and . The commutator is non-zero, which is the algebraic root of the uncertainty relation between bit and phase measurements. Operator multiplication is associative, , because matrix multiplication is, but it is not commutative.
Unitary verified: (max deviation 0.0e+0)
Quick check
A circuit applies and then to one qubit. Which operator describes the whole circuit?
The adjoint operator#
Definition
Adjoint (Hermitian conjugate)
The adjoint of is the unique operator such that for all . Uniqueness: if and both satisfy the identity then for all , and choosing gives for every .
The adjoint is the conjugate transpose
In any orthonormal basis, . Conversely, the operator whose matrix is the conjugate transpose of satisfies the defining identity, so the adjoint exists.
Proof (5 steps)
- Step 1:Matrix element of written as an inner product of with .
- Step 2:Conjugate symmetry of the inner product: .
- Step 3:Defining identity of the adjoint with , : .
- Step 4:is the matrix element .
- Step 5:Existence: expanding both sides in coordinates shows that the conjugate-transpose matrix satisfies the defining identity.
∎
Adjoint of a product reverses the order
For all operators on : . Also and .
Proof (5 steps)
- Step 1:Apply the defining identity of with the vector in the second slot.
- Step 2:Apply the defining identity of with the vector in the first slot.
- Step 3:satisfies the defining identity of for all , and the adjoint is unique.
- Step 4:Apply the conjugate-transpose rule twice.
- Step 5:Complex conjugation is additive and multiplicative, giving antilinearity of the dagger.
∎
Worked example. For we transpose and conjugate: . For the phase gate we get and . The dagger also connects kets and bras: a ket is a matrix and is the conjugate row, so is just the product rule above.
Unitary verified: (max deviation 0.0e+0)
Quick check
For , what is the entry (row 1, column 0, zero-based)?
Change of orthonormal basis and the trace#
The same operator has different matrices in different bases. In quantum computing we constantly switch between the computational basis and, for instance, the Hadamard basis with . Measuring "in the basis" on hardware literally means applying the change-of-basis unitary and then measuring in . We now derive the transformation rule.
Change of orthonormal basis
Let and be orthonormal bases and . Then is unitary and for every operator , , where and .
Proof (6 steps)
- Step 1:Expand each new basis vector in the old basis: column of holds the -coordinates of .
- Step 2:Matrix product with .
- Step 3:Completeness and orthonormality of ; hence and is unitary.
- Step 4:Insert identities on both sides of .
- Step 5:Write each identity as the completeness relation of .
- Step 6:Identify the three factors as matrix elements and apply the product rule twice.
∎
Worked example: the Hadamard operator in the basis
- Step 1:The change-of-basis matrix has the new basis vectors as columns; for the basis it is itself.
- Step 2:Apply the theorem with .
- Step 3:because is unitary (checked in the matrix block below).
- Step 4:Direct check using and .
- Step 5:Same computation for the second row; the four entries reproduce .
- Step 6:The same rule shows that is diagonal in the basis () and swaps .
Result
Unitary verified: (max deviation 2.2e-16)
The trace does not depend on the orthonormal basis
Define . Then for all square , and consequently for any two orthonormal bases.
Proof (5 steps)
- Step 1:Definition of the trace and the product rule.
- Step 2:Swap the finite sums and commute the scalar factors.
- Step 3:Change-of-basis theorem, then cyclicity with the two factors and .
- Step 4:as well: , then completeness of the basis and orthonormality of . (The next lesson shows that implies for every square matrix.)
- Step 5:Associativity of the matrix product, then from the previous step.
∎
Quick check
What is the matrix of Pauli in the ordered basis ?
Check it numerically. The following NumPy cell verifies the change-of-basis results of this lesson: , , the conjugate-transpose example, the basis independence of the trace and .
import numpy as np
H = np.array([[1, 1], [1, -1]]) / np.sqrt(2)
X = np.array([[0, 1], [1, 0]])
Z = np.array([[1, 0], [0, -1]])
P = H # columns are |+> and |->
print(np.allclose(P.conj().T @ H @ P, H))
print(np.allclose(P.conj().T @ X @ P, Z))
A = np.array([[1, 2j], [3, 4 - 1j]])
print(np.allclose(A.conj().T, [[1, 3], [-2j, 4 + 1j]]))
print(np.isclose(np.trace(P.conj().T @ A @ P), np.trace(A)))
print(np.allclose(X @ Z, -1j * np.array([[0, -1j], [1j, 0]])))Expected output
True True True True True
References
- M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press (2010), §2.1.2 (linear operators and matrices) and §2.1.6 (adjoints and Hermitian operators).
- S. Axler, Linear Algebra Done Right, 4th ed., Springer (2024), Chapters 3 and 7.linear.axler.net
- R. A. Horn and C. R. Johnson, Matrix Analysis, 2nd ed., Cambridge University Press (2013), Chapter 0, §0.4–0.10 (including change of basis in §0.10).
Hands-on labs
Hadamard in the ± basis
1 step · auto-gradedOpen labRepresent the Hadamard operator in the ordered basis using matrix elements .