Author @amnanoor Verifier - Public
Back to 1 Verify Mark as read Debunk me Download PDF Locked

Chapter 3: Linear Algebra for Quantum Thinking

Quantum computing is often introduced with unfamiliar words: qubits, superposition, entanglement, gates, Hamiltonians, measurement. Those ideas can sound mysterious at first, but their everyday working language is not magic. It is linear algebra.

Linear algebra is the mathematics of vectors and the transformations that move vectors around. In quantum computing, a state of a system is represented by a vector, and a quantum operation is represented by a special kind of matrix acting on that vector. This is the standard finite-dimensional mathematical framework used in introductory quantum information theory (Nielsen and Chuang, 2010).

In this chapter, we will build the part of linear algebra that we need for quantum optimization. We will not try to cover every topic in a full linear algebra course. Instead, we will focus on the ideas that will appear again and again:

  • vectors,
  • matrices,
  • complex numbers,
  • inner products,
  • norms,
  • orthogonality,
  • eigenvalues and eigenvectors,
  • tensor products.

These ideas are not only mathematical tools. They are the grammar of quantum computation.

By the end of this chapter, you should be able to look at a small quantum state or quantum gate and understand what kind of object it is, what it does, and why linear algebra is the right language for it.

3.1 Why quantum computing uses linear algebra

Let us begin with a familiar kind of object: a list of numbers.

Suppose a bakery makes bread and cakes. We could describe today’s production plan as

\[ \begin{bmatrix} 20 \\ 5 \end{bmatrix}. \]

The first number might mean 20 loaves of bread, and the second number might mean 5 cakes. This vertical list is a vector.

A vector can store several pieces of numerical information at once.

Now suppose we have a rule that changes the plan. Maybe tomorrow the bakery wants to double both quantities:

\[ \begin{bmatrix} 20 \\ 5 \end{bmatrix} \longmapsto \begin{bmatrix} 40 \\ 10 \end{bmatrix}. \]

That rule is a transformation. In linear algebra, many important transformations are represented by matrices.

A matrix is a rectangular table of numbers. For example,

\[ \begin{bmatrix} 2 & 0 \\ 0 & 2 \end{bmatrix} \]

is a matrix that doubles a two-number vector:

\[ \begin{bmatrix} 2 & 0 \\ 0 & 2 \end{bmatrix} \begin{bmatrix} 20 \\ 5 \end{bmatrix} = \begin{bmatrix} 40 \\ 10 \end{bmatrix}. \]

Quantum computing uses a similar idea. A quantum state is represented by a vector, and a quantum operation is represented by a matrix. But there are two important differences.

First, quantum vectors usually contain complex numbers, not just ordinary real numbers.

Second, quantum matrices must obey special rules so that total probability is preserved. Later, these special matrices will be called unitary matrices.

For now, we are not yet doing quantum mechanics. We are learning the mathematical stage on which quantum mechanics will act.

3.2 Scalars, vectors, and dimensions

A scalar is a single number.

For example,

\[ 7, \quad -2, \quad 3.5 \]

are scalars.

A vector is an ordered list of numbers.

For example,

\[ \begin{bmatrix} 3 \\ 4 \end{bmatrix} \]

is a vector with two entries. We call it a two-dimensional vector because it has two components.

The vector

\[ \begin{bmatrix} 2 \\ -1 \\ 5 \end{bmatrix} \]

has three components, so it is a three-dimensional vector.

The word dimension can mean different things in different contexts, but here it means the number of independent coordinates needed to describe the vector. A vector with two entries lives in a two-dimensional vector space. A vector with three entries lives in a three-dimensional vector space.

A vector space is a collection of vectors where we can add vectors together and multiply them by scalars while staying inside the collection. Standard linear algebra texts define vector spaces using these closure and arithmetic rules (Strang, 2016; Axler, 2015).

For example, all two-entry real vectors form a vector space:

\[ \mathbb{R}^2 = \left\{ \begin{bmatrix} x \\ y \end{bmatrix} : x,y \in \mathbb{R} \right\}. \]

The symbol \(\mathbb{R}\) means the set of real numbers. So \(\mathbb{R}^2\) means “all vectors with two real-number components.”

Examples include

\[ \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad \begin{bmatrix} -3 \\ 7 \end{bmatrix}, \quad \begin{bmatrix} 0.5 \\ 2.1 \end{bmatrix}. \]

In quantum computing, we usually work with complex vector spaces such as \(\mathbb{C}^2\), \(\mathbb{C}^4\), and larger spaces. The symbol \(\mathbb{C}\) means the set of complex numbers.

We will explain complex numbers soon. For now, remember the basic idea:

A vector is a structured list of numbers, and linear algebra studies how such lists can be combined and transformed.

3.3 Adding vectors and scaling vectors

Vectors can be added component by component.

For example,

\[ \begin{bmatrix} 2 \\ 3 \end{bmatrix} + \begin{bmatrix} 5 \\ 1 \end{bmatrix} = \begin{bmatrix} 7 \\ 4 \end{bmatrix}. \]

We can also multiply a vector by a scalar:

\[ 3 \begin{bmatrix} 2 \\ 3 \end{bmatrix} = \begin{bmatrix} 6 \\ 9 \end{bmatrix}. \]

This operation is called scalar multiplication.

These two operations—addition and scalar multiplication—are the basic operations of linear algebra.

For example, suppose

\[ u = \begin{bmatrix} 1 \\ 2 \end{bmatrix}, \quad v = \begin{bmatrix} 3 \\ -1 \end{bmatrix}. \]

Then

\[ 2u + 3v = 2 \begin{bmatrix} 1 \\ 2 \end{bmatrix} + 3 \begin{bmatrix} 3 \\ -1 \end{bmatrix} = \begin{bmatrix} 2 \\ 4 \end{bmatrix} + \begin{bmatrix} 9 \\ -3 \end{bmatrix} = \begin{bmatrix} 11 \\ 1 \end{bmatrix}. \]

An expression like

\[ 2u + 3v \]

is called a linear combination of \(u\) and \(v\).

Linear combinations are central because they tell us how complicated vectors can be built from simpler vectors.

For example, every vector in \(\mathbb{R}^2\) can be built from these two simple vectors:

\[ e_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad e_2 = \begin{bmatrix} 0 \\ 1 \end{bmatrix}. \]

If

\[ w = \begin{bmatrix} a \\ b \end{bmatrix}, \]

then

\[ w = a e_1 + b e_2. \]

That is,

\[ \begin{bmatrix} a \\ b \end{bmatrix} = a \begin{bmatrix} 1 \\ 0 \end{bmatrix} + b \begin{bmatrix} 0 \\ 1 \end{bmatrix}. \]

The vectors \(e_1\) and \(e_2\) are examples of basis vectors.

3.4 Basis vectors: the coordinate system of a vector space

A basis is a set of vectors that can be used to build every vector in a space in exactly one way.

In \(\mathbb{R}^2\), the standard basis is

\[ \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad \begin{bmatrix} 0 \\ 1 \end{bmatrix}. \]

These basis vectors represent the coordinate directions.

For example,

\[ \begin{bmatrix} 4 \\ -2 \end{bmatrix} = 4 \begin{bmatrix} 1 \\ 0 \end{bmatrix} - 2 \begin{bmatrix} 0 \\ 1 \end{bmatrix}. \]

So the numbers \(4\) and \(-2\) are the coordinates of the vector in this basis.

In quantum computing, we often use a special basis called the computational basis. For a single qubit, the computational basis consists of two vectors:

\[ |0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad |1\rangle = \begin{bmatrix} 0 \\ 1 \end{bmatrix}. \]

The symbols \(|0\rangle\) and \(|1\rangle\) are part of Dirac notation, also called bra-ket notation. This notation is widely used in quantum mechanics and quantum information (Nielsen and Chuang, 2010).

For now, you can read

\[ |0\rangle \]

as “the vector labeled zero,” and

\[ |1\rangle \]

as “the vector labeled one.”

A general two-dimensional vector can be written as

\[ \begin{bmatrix} \alpha \\ \beta \end{bmatrix} = \alpha \begin{bmatrix} 1 \\ 0 \end{bmatrix} + \beta \begin{bmatrix} 0 \\ 1 \end{bmatrix}. \]

In Dirac notation, we write this as

\[ \alpha |0\rangle + \beta |1\rangle. \]

This expression will become very important when we study qubits. The numbers \(\alpha\) and \(\beta\) are called amplitudes. In quantum mechanics, amplitudes are generally complex numbers, and their squared magnitudes determine measurement probabilities. We will explain this carefully in Chapters 4 and 5.

For now, focus on the linear algebra:

\[ \alpha |0\rangle + \beta |1\rangle \]

is simply a linear combination of two basis vectors.

3.5 Complex numbers: numbers with two parts

Ordinary real numbers lie on a line:

\[ \ldots, -2, -1, 0, 1, 2, \ldots \]

Complex numbers extend this idea. A complex number has two parts:

\[ a + bi. \]

Here:

  • \(a\) is the real part,
  • \(b\) is the imaginary part,
  • \(i\) is a special number satisfying

\[ i^2 = -1. \]

This may look strange at first because no real number has a square equal to \(-1\). Complex numbers were created to extend arithmetic so that equations like

\[ x^2 + 1 = 0 \]

have solutions. The solutions are

\[ x = i \quad \text{and} \quad x = -i. \]

A complex number can be drawn as a point in a plane. For example,

\[ 3 + 2i \]

has real part \(3\) and imaginary part \(2\). You can picture it as the point \((3,2)\).

So complex numbers are not “imaginary” in the sense of being fake. They are two-dimensional numbers with consistent arithmetic.

Adding complex numbers

Complex numbers are added by adding their real parts and imaginary parts separately:

\[ (3 + 2i) + (1 + 5i) = 4 + 7i. \]

Multiplying complex numbers

To multiply complex numbers, we use ordinary expansion and the rule \(i^2 = -1\):

\[ (2 + 3i)(4 + i) = 8 + 2i + 12i + 3i^2. \]

Since \(i^2 = -1\),

\[ 8 + 2i + 12i + 3i^2 = 8 + 14i - 3 = 5 + 14i. \]

Complex conjugates

The complex conjugate of

\[ z = a + bi \]

is

\[ z^* = a - bi. \]

The star symbol \(^*\) means complex conjugation.

For example,

\[ (3 + 2i)^* = 3 - 2i. \]

Complex conjugates are important because they help us define lengths and probabilities correctly.

If

\[ z = a + bi, \]

then

\[ z^*z = (a - bi)(a + bi). \]

Expanding gives

\[ z^*z = a^2 + b^2. \]

This is always a nonnegative real number.

The magnitude or absolute value of \(z\) is

\[ |z| = \sqrt{z^*z} = \sqrt{a^2 + b^2}. \]

For example, if

\[ z = 3 + 4i, \]

then

\[ |z| = \sqrt{3^2 + 4^2} = 5. \]

In quantum computing, complex numbers are essential because quantum amplitudes are complex. Their phases—the angular information contained in complex numbers—allow quantum interference, one of the key differences between quantum and ordinary probabilistic computation (Nielsen and Chuang, 2010).

3.6 Complex vectors

A complex vector is a vector whose entries are complex numbers.

For example,

\[ v = \begin{bmatrix} 2+i \\ 3-4i \end{bmatrix} \]

is a complex vector.

The set of all two-entry complex vectors is called \(\mathbb{C}^2\):

\[ \mathbb{C}^2 = \left\{ \begin{bmatrix} \alpha \\ \beta \end{bmatrix} : \alpha,\beta \in \mathbb{C} \right\}. \]

A typical vector in \(\mathbb{C}^2\) is

\[ \begin{bmatrix} \alpha \\ \beta \end{bmatrix}. \]

In quantum computing, a single qubit state is represented by a vector in \(\mathbb{C}^2\) whose norm is \(1\). We are not ready to unpack the physical meaning yet, but this is the mathematical shape:

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

The Greek letter \(\psi\), pronounced “psi,” is commonly used to name a quantum state.

The vertical bar and angle bracket notation,

\[ |\psi\rangle, \]

means that \(\psi\) is being treated as a column vector. In Dirac notation, this kind of vector is called a ket.

So when you see

\[ |\psi\rangle, \]

you can think:

This is a vector, usually a complex column vector, representing a quantum state.

3.7 Matrices: machines that transform vectors

A matrix is a rectangular array of numbers.

For example,

\[ A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \]

is a \(2 \times 2\) matrix because it has 2 rows and 2 columns.

Matrices can act on vectors.

If

\[ A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \quad \text{and} \quad v = \begin{bmatrix} 5 \\ 6 \end{bmatrix}, \]

then

\[ Av = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \begin{bmatrix} 5 \\ 6 \end{bmatrix}. \]

To compute the result, each row of the matrix combines with the vector:

\[ Av = \begin{bmatrix} 1\cdot 5 + 2\cdot 6 \\ 3\cdot 5 + 4\cdot 6 \end{bmatrix} = \begin{bmatrix} 17 \\ 39 \end{bmatrix}. \]

So the matrix \(A\) transforms the vector \(v\) into a new vector.

In quantum computing, gates are matrices. For example, one important quantum gate is the Pauli-\(X\) gate:

\[ X = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}. \]

If \(X\) acts on \(|0\rangle\), we get

\[ X|0\rangle = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix} = |1\rangle. \]

If \(X\) acts on \(|1\rangle\), we get

\[ X|1\rangle = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} = |0\rangle. \]

So \(X\) swaps \(|0\rangle\) and \(|1\rangle\). Later, we will see that this is the quantum version of a bit flip.

3.8 Matrix multiplication as doing transformations in sequence

Matrices can also multiply other matrices.

The most important interpretation is this:

Matrix multiplication represents doing one transformation after another.

Suppose \(A\) and \(B\) are matrices, and \(v\) is a vector. The expression

\[ ABv \]

means:

  1. First apply \(B\) to \(v\).
  2. Then apply \(A\) to the result.

So the rightmost matrix acts first.

This order matters. In general,

\[ AB \neq BA. \]

That means matrix multiplication is usually not commutative.

Let us see an example.

Let

\[ A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}, \quad B = \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix}. \]

Compute \(AB\):

\[ AB = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 2 & 1 \\ 0 & 1 \end{bmatrix}. \]

Compute \(BA\):

\[ BA = \begin{bmatrix} 2 & 0 \\ 0 & 1 \end{bmatrix} \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix} = \begin{bmatrix} 2 & 2 \\ 0 & 1 \end{bmatrix}. \]

These are different:

\[ AB \neq BA. \]

In quantum circuits, this matters deeply. If you apply gate \(B\) and then gate \(A\), you may get a different result than if you apply gate \(A\) and then gate \(B\).

This is one reason circuit diagrams must be read carefully.

3.9 The identity matrix: doing nothing

The identity matrix is the matrix that leaves every vector unchanged.

In two dimensions, it is

\[ I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}. \]

For example,

\[ I \begin{bmatrix} 7 \\ -3 \end{bmatrix} = \begin{bmatrix} 7 \\ -3 \end{bmatrix}. \]

The identity matrix behaves like the number \(1\) does in ordinary multiplication:

\[ 1 \cdot x = x. \]

Similarly,

\[ Iv = v. \]

In quantum computing, the identity operation means “do nothing to this quantum system.” It is often written as \(I\).

For a single qubit,

\[ I|0\rangle = |0\rangle, \quad I|1\rangle = |1\rangle. \]

The identity matrix may seem boring, but it becomes very useful when we describe multi-qubit systems. For example, we may want to apply a gate to one qubit while doing nothing to another. Tensor products will help us describe that.

3.10 Inner products: measuring overlap

The inner product is a way to combine two vectors and get a scalar.

For real two-dimensional vectors,

\[ u = \begin{bmatrix} u_1 \\ u_2 \end{bmatrix}, \quad v = \begin{bmatrix} v_1 \\ v_2 \end{bmatrix}, \]

the inner product is

\[ u \cdot v = u_1v_1 + u_2v_2. \]

This is also called the dot product.

For example,

\[ \begin{bmatrix} 2 \\ 3 \end{bmatrix} \cdot \begin{bmatrix} 4 \\ 1 \end{bmatrix} = 2\cdot 4 + 3\cdot 1 = 11. \]

The inner product tells us how much two vectors point in the same direction.

If two vectors point in similar directions, their inner product is positive and large. If they point in opposite directions, their inner product is negative. If they are perpendicular, their inner product is zero.

For complex vectors, the inner product must use complex conjugation. If

\[ u = \begin{bmatrix} u_1 \\ u_2 \end{bmatrix}, \quad v = \begin{bmatrix} v_1 \\ v_2 \end{bmatrix}, \]

then the quantum convention is

\[ \langle u|v\rangle = u_1^*v_1 + u_2^*v_2. \]

Here \(u_1^*\) means the complex conjugate of \(u_1\).

The notation \(\langle u|\) is called a bra, and \(|v\rangle\) is a ket. Together, \(\langle u|v\rangle\) is a bra-ket, meaning the inner product of \(u\) and \(v\).

Let

\[ u = \begin{bmatrix} 1+i \\ 2 \end{bmatrix}, \quad v = \begin{bmatrix} 3 \\ i \end{bmatrix}. \]

Then

\[ \langle u|v\rangle = (1+i)^*3 + 2^*i. \]

Since

\[ (1+i)^* = 1-i \quad \text{and} \quad 2^* = 2, \]

we get

\[ \langle u|v\rangle = (1-i)3 + 2i = 3 - 3i + 2i = 3 - i. \]

So the inner product can itself be a complex number.

In quantum computing, inner products measure overlap between states. If two normalized quantum states have inner product close to zero, they are very distinguishable. If their inner product has magnitude close to one, they are very similar. This connection between inner products and distinguishability is part of the standard geometric view of quantum states (Nielsen and Chuang, 2010).

3.11 Norms: the length of a vector

A norm is a way to measure the length or size of a vector.

For a real vector

\[ v = \begin{bmatrix} 3 \\ 4 \end{bmatrix}, \]

the usual length is

\[ \|v\| = \sqrt{3^2 + 4^2} = 5. \]

This is the same length formula from geometry.

For a complex vector, we use the inner product:

\[ \|v\| = \sqrt{\langle v|v\rangle}. \]

Let

\[ v = \begin{bmatrix} 1+i \\ 2 \end{bmatrix}. \]

Then

\[ \langle v|v\rangle = (1+i)^*(1+i) + 2^*2. \]

Now

\[ (1+i)^*(1+i) = (1-i)(1+i) = 1 + 1 = 2. \]

Also,

\[ 2^*2 = 4. \]

So

\[ \langle v|v\rangle = 2 + 4 = 6. \]

Therefore,

\[ \|v\| = \sqrt{6}. \]

In quantum computing, valid state vectors are usually normalized, meaning their norm is \(1\). For a one-qubit state

\[ |\psi\rangle = \alpha |0\rangle + \beta |1\rangle, \]

normalization means

\[ |\alpha|^2 + |\beta|^2 = 1. \]

This equation will become central when we learn measurement probabilities. If \(|\alpha|^2\) and \(|\beta|^2\) are probabilities, then they must add to \(1\). That is why norm matters.

3.12 Orthogonality: perfectly separate directions

Two vectors are orthogonal if their inner product is zero.

For real vectors, orthogonal usually means perpendicular.

For example,

\[ u = \begin{bmatrix} 1 \\ 0 \end{bmatrix}, \quad v = \begin{bmatrix} 0 \\ 1 \end{bmatrix}. \]

Their inner product is

\[ u \cdot v = 1\cdot 0 + 0\cdot 1 = 0. \]

So they are orthogonal.

In Dirac notation,

\[ \langle 0|1\rangle = 0. \]

Also,

\[ \langle 0|0\rangle = 1, \quad \langle 1|1\rangle = 1. \]

So \(|0\rangle\) and \(|1\rangle\) are not only orthogonal; they are also normalized.

A set of vectors that are both orthogonal and normalized is called orthonormal.

The computational basis

\[ \{|0\rangle, |1\rangle\} \]

is an orthonormal basis for \(\mathbb{C}^2\).

In quantum computing, orthonormal bases are important because measurement outcomes are often associated with basis states. For example, when a qubit is measured in the computational basis, the possible outcomes correspond to \(|0\rangle\) and \(|1\rangle\). The mathematical representation of such measurements uses orthonormal bases and projection operators in the standard quantum information framework (Nielsen and Chuang, 2010).

3.13 Transpose, conjugate transpose, bras, and kets

A column vector is written vertically:

\[ |v\rangle = \begin{bmatrix} v_1 \\ v_2 \end{bmatrix}. \]

A row vector is written horizontally:

\[ \begin{bmatrix} v_1 & v_2 \end{bmatrix}. \]

The transpose of a column vector turns it into a row vector:

\[ \begin{bmatrix} v_1 \\ v_2 \end{bmatrix}^T = \begin{bmatrix} v_1 & v_2 \end{bmatrix}. \]

For complex vectors, we usually need the conjugate transpose. This means:

  1. transpose the vector,
  2. take the complex conjugate of each entry.

If

\[ |v\rangle = \begin{bmatrix} 1+i \\ 2-3i \end{bmatrix}, \]

then

\[ \langle v| = |v\rangle^\dagger = \begin{bmatrix} 1-i & 2+3i \end{bmatrix}. \]

The symbol \(\dagger\), pronounced “dagger,” means conjugate transpose.

In Dirac notation:

  • a ket \(|v\rangle\) is a column vector,
  • a bra \(\langle v|\) is its conjugate transpose,
  • \(\langle u|v\rangle\) is an inner product.

For example,

\[ \langle v|v\rangle = \begin{bmatrix} 1-i & 2+3i \end{bmatrix} \begin{bmatrix} 1+i \\ 2-3i \end{bmatrix}. \]

This gives the squared norm of \(v\).

The conjugate transpose also applies to matrices. If

\[ A = \begin{bmatrix} 1 & i \\ 2-i & 3 \end{bmatrix}, \]

then

\[ A^\dagger = \begin{bmatrix} 1 & 2+i \\ -i & 3 \end{bmatrix}. \]

We transposed the matrix and conjugated every entry.

This operation is crucial for quantum gates, because a matrix \(U\) is unitary when

\[ U^\dagger U = I. \]

We will study unitary matrices more fully in Chapter 7. For now, remember the intuition:

A unitary matrix preserves vector length, which is why it can preserve total probability in quantum computation.

Unitary transformations are the standard mathematical model for closed-system quantum evolution in finite-dimensional quantum computing (Nielsen and Chuang, 2010).

3.14 Eigenvectors and eigenvalues: directions that stay themselves

Some vectors have a special relationship with a matrix.

Usually, when a matrix acts on a vector, it changes the vector’s direction and length.

For example,

\[ A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \]

will transform most vectors into new vectors pointing in different directions.

But sometimes a vector keeps its direction. It may stretch, shrink, or flip, but it does not turn.

If

\[ Av = \lambda v \]

for some nonzero vector \(v\), then:

  • \(v\) is an eigenvector of \(A\),
  • \(\lambda\) is the corresponding eigenvalue.

The word “eigen” comes from German and is often translated as “own” or “characteristic.” An eigenvector is a characteristic direction of a transformation.

Let us use a simple example.

Take

\[ A = \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix}. \]

Apply \(A\) to

\[ e_1 = \begin{bmatrix} 1 \\ 0 \end{bmatrix}. \]

We get

\[ Ae_1 = \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 2 \\ 0 \end{bmatrix} = 2 \begin{bmatrix} 1 \\ 0 \end{bmatrix}. \]

So \(e_1\) is an eigenvector with eigenvalue \(2\).

Now apply \(A\) to

\[ e_2 = \begin{bmatrix} 0 \\ 1 \end{bmatrix}. \]

We get

\[ Ae_2 = \begin{bmatrix} 2 & 0 \\ 0 & 3 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ 3 \end{bmatrix} = 3 \begin{bmatrix} 0 \\ 1 \end{bmatrix}. \]

So \(e_2\) is an eigenvector with eigenvalue \(3\).

The matrix \(A\) stretches the \(e_1\) direction by \(2\) and the \(e_2\) direction by \(3\).

Eigenvalues and eigenvectors will become very important when we study Hamiltonians.

A Hamiltonian is a mathematical object that represents the energy of a physical system. In finite-dimensional quantum mechanics, Hamiltonians are represented by Hermitian matrices, and their eigenvalues correspond to possible energy values of the system (Nielsen and Chuang, 2010). Quantum optimization often turns an optimization problem into the task of finding a low-energy eigenstate, especially the ground state, which is the state with the smallest energy.

We will study this carefully in Chapter 8. For now, the key idea is:

Eigenvectors are special states of a matrix, and eigenvalues are the numbers associated with those states.

3.15 Hermitian matrices: matrices with real eigenvalues

A matrix \(A\) is Hermitian if

\[ A^\dagger = A. \]

That means the matrix equals its own conjugate transpose.

For example,

\[ A = \begin{bmatrix} 2 & 1+i \\ 1-i & 3 \end{bmatrix} \]

is Hermitian.

Let us check:

\[ A^\dagger = \begin{bmatrix} 2 & 1+i \\ 1-i & 3 \end{bmatrix}. \]

So

\[ A^\dagger = A. \]

Hermitian matrices matter because their eigenvalues are always real numbers, and eigenvectors belonging to distinct eigenvalues are orthogonal. These are standard results in finite-dimensional linear algebra and are part of the spectral theorem for Hermitian operators (Axler, 2015).

This is exactly what we want for physical observables such as energy. A measured energy should be a real number, not a complex number like \(3+2i\).

That is why Hamiltonians in quantum computing are Hermitian matrices.

A simple Hermitian matrix is

\[ Z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}. \]

This is called the Pauli-\(Z\) matrix.

Apply it to \(|0\rangle\):

\[ Z|0\rangle = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} = |0\rangle. \]

So \(|0\rangle\) is an eigenvector with eigenvalue \(1\).

Apply it to \(|1\rangle\):

\[ Z|1\rangle = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ -1 \end{bmatrix} = -|1\rangle. \]

So \(|1\rangle\) is an eigenvector with eigenvalue \(-1\).

This tiny example will reappear many times. The \(Z\) matrix is one of the basic building blocks for Ising models, cost Hamiltonians, and quantum optimization formulations.

3.16 Diagonal matrices: easy-to-read transformations

A diagonal matrix is a square matrix whose nonzero entries appear only on the main diagonal.

For example,

\[ D = \begin{bmatrix} 5 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 2 \end{bmatrix} \]

is diagonal.

Diagonal matrices are easy to understand. They scale each basis direction separately.

If

\[ v = \begin{bmatrix} a \\ b \\ c \end{bmatrix}, \]

then

\[ Dv = \begin{bmatrix} 5a \\ -b \\ 2c \end{bmatrix}. \]

The standard basis vectors are eigenvectors of this diagonal matrix:

\[ \begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \quad \text{has eigenvalue } 5, \]

\[ \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} \quad \text{has eigenvalue } -1, \]

\[ \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix} \quad \text{has eigenvalue } 2. \]

Diagonal matrices are important in optimization because many cost functions become diagonal Hamiltonians when written in the computational basis.

Here is the intuition.

Suppose we have four possible binary solutions:

\[ 00,\quad 01,\quad 10,\quad 11. \]

Imagine their costs are:

\[ C(00)=3, \quad C(01)=5, \quad C(10)=1, \quad C(11)=4. \]

We can build a diagonal matrix whose entries are these costs:

\[ H_C = \begin{bmatrix} 3 & 0 & 0 & 0 \\ 0 & 5 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 4 \end{bmatrix}. \]

The smallest diagonal entry is \(1\), corresponding to the solution \(10\).

Later, we will call \(H_C\) a cost Hamiltonian. Its ground state corresponds to the lowest-cost solution. This is one of the central bridges between classical optimization and quantum optimization.

3.17 Tensor products: combining systems

So far, our vectors have represented single systems.

But optimization problems usually involve many variables.

Quantum computers also involve

τ TheoryTrace