Skip to content
ImagineWorld

EigenStuff

node_idnode-book_essential-mathematics-for-quantum-computing_chapter-07-eigenstuff
node_typechapter_node
schema_profileworld.chapter_node.v1
entropyhigh
manifoldworld
domainimagineworld.net
authorityinforms
layercorpus
statusactive
chapter_num7
chapter_titleEigenStuff
governed_byCORPUS
constitutional_citationCONSTITUTION
local graph

Eigen (pronounced EYE-GUN) is a German prefix to words such as eigentum (property), eigenschaft (a feature or characteristic), and eigensinn (an idiosyncrasy). To sum up, we are looking for some values and vectors that are characteristic, idiosyncratic, and a property of something. What is that something? That something is our old friend the linear operator and its representations as square matrices. But before we get there, we’ll need to look at some other concepts such as the matrix inverse and determinant. We’ll wrap it all up with the trace of a matrix and some properties that the trace, determinant, and eigenvalues all share. These concepts will allow us to reach even further heights in the chapters that follow.

In this chapter, we are going to cover the following main topics:

  • The inverse of a matrix
  • Determinants
  • Invertible matrix theorem
  • Eigenvalues and eigenvectors
  • Trace
  • The special properties of eigenvalues

It would be nice to have a way to do algebra on matrices the way we do for simple algebraic expressions, like so:

3xy=6divide both sides by 3x3xy3x=63xy=2x\begin{aligned} 3xy &= 6 \\ \text{divide both sides by } 3x \\ \frac{3xy}{3x} &= \frac{6}{3x} \\ y &= \frac{2}{x} \end{aligned}

The inverse of a matrix provides us with a way to do this. It is very similar to the reciprocal for rational numbers. For rational numbers, the following is true:

x−1=1xx⋅x−1=1\begin{aligned} x^{-1} &= \frac{1}{x} \\ x \cdot x^{-1} &= 1 \end{aligned}

In a similar way, the inverse of a matrix is defined to be a matrix that when multiplied by the original matrix, you get the identity matrix. Here it is mathematically:

A⋅A−1=Iwhere A−1 denotes the matrix inverse of AA \cdot A^{-1} = I \quad \text{where } A^{-1} \text{ denotes the matrix inverse of } A

The matrix inverse can then be used when trying to algebraically modify a matrix equation. Let’s say we are trying to find the vector |x⟩ in the following equation:

A∣x⟩=∣y⟩A|x\rangle = |y\rangle

Since we now have a multiplicative inverse of a matrix, we can multiply both sides by it to get the following:

A−1A∣x⟩=A−1∣y⟩I∣x⟩=A−1∣y⟩∣x⟩=A−1∣y⟩\begin{aligned} A^{-1}A|x\rangle &= A^{-1}|y\rangle \\ I|x\rangle &= A^{-1}|y\rangle \\ |x\rangle &= A^{-1}|y\rangle \end{aligned}

Please remember that matrix multiplication is not commutative, so if you left multiply a matrix on one side of an equation, you must left multiply on the other side. The same applies if you right multiply a matrix. We now have a way to find |x⟩ by using the inverse of matrix A. But there is a catch – not all matrices have an inverse. Determinants will help us here though.

Determinants determine whether a square matrix is invertible. This is a huge help to us, as we will see. In the literature, you will see either a function abbreviation for the determinant or vertical bars, like so:

det⁡(A)=∣A∣\det(A) = |A|

The determinant is a function from ℂn × n to ℂ. In other words, it takes an n × n square matrix as input and spits out a scalar. For a 1 × 1 matrix, the determinant is just the number (easy enough). For a 2 × 2 matrix, this is the formula. You should probably just commit it to memory if you can:

If A=[abcd],then det⁡(A)=∣A∣=ad−bc\text{If } A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} ,\quad \text{then } \det(A) = |A| = ad - bc

I will give you exercises at the end of this section to help with the memorization part, which will also give you a feel for the determinant itself.

There is a method for calculating determinants for bigger matrices, but it is rather involved, and once you’ve mastered 2 × 2 matrices, I would suggest using a matrix calculator. It’s just like arithmetic; you should know how to do it for small numbers before using a calculator for everything else. Just so you get a glimpse of how it gets increasingly difficult to calculate determinants, here is the formula for a 3 × 3 matrix:

∣A∣=∣abcdefghi∣=a∣efhi∣−b∣dfgi∣+c∣degh∣=aei+bfg+cdh−ceg−bdi−afh.\begin{aligned} |A| &= \begin{vmatrix} a & b & c \\ d & e & f \\ g & h & i \end{vmatrix} = a \begin{vmatrix} e & f \\ h & i \end{vmatrix} - b \begin{vmatrix} d & f \\ g & i \end{vmatrix} + c \begin{vmatrix} d & e \\ g & h \end{vmatrix} \\ &= aei + bfg + cdh - ceg - bdi - afh. \end{aligned}

For reference, a good matrix calculator is WolframAlpha’s determinant calculator (https://www.wolframalpha.com/calculators/determinant-calculator), as shown here:

Figure 7.1 – The WolframAlpha online determinant calculator

Okay, let’s see this in action and work through a quick example for determinants. What is the determinant of the following matrix?

[−5−4−2−3]\begin{bmatrix} -5 & -4 \\ -2 & -3 \end{bmatrix}

Using our formula, we can calculate it as follows:

∣−5−4−2−3∣=(−5)(−3)−(−4)(−2)=15−8=7\begin{aligned} \begin{vmatrix} -5 & -4 \\ -2 & -3 \end{vmatrix} &= (-5)(-3) - (-4)(-2) \\ &= 15 - 8 \\ &= 7 \end{aligned}

See? Easy-peasy!

So, at the start of this section, we said that the determinant helps to determine whether a matrix is invertible. How is that possible? I’ll put this in a callout, as it is quite important:

Determinants and Invertibility

If the determinant of a matrix equals zero, it is not invertible. Otherwise, the matrix is invertible.

If a matrix is not invertible, we call it singular or degenerate. We will now use the determinant in the next sections on calculating the inverse of a matrix and calculating eigenvalues. But first, it leads us to a very important and useful theorem in linear algebra, the invertible matrix theorem.

What is the determinant of the following 2 × 2 matrices?

[1234][1001][−1321−1]\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \qquad \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \qquad \begin{bmatrix} -1 & \frac{3}{2} \\ 1 & -1 \end{bmatrix}

The invertible matrix theorem is a great result in linear algebra because based on the invertibility of a matrix, we can say a great many things about that matrix that are also true. Since we now know a quick way to determine the invertibility of a matrix through the computation of the determinant, we get all these other properties for free!

Here is the actual definition. Let A be a square n × n matrix. If A is invertible (det(A) ≠ 0), then the following properties follow:

  • The column vectors of A are linearly independent.
  • The column vectors of A form a basis for ℂn.
  • The row vectors of A form a basis for ℂn and are also linearly independent.
  • The linear transformation mapping |x⟩ to A|x⟩ is a bijection from ℂn to ℂn (we studied bijections in Chapter 3, Foundations).

If the matrix A is not invertible (det(A) = 0), then all the preceding properties are false.

While it may not seem that these are a lot of properties, there are many more I did not include because we didn’t cover the concepts in this book. But even with the four properties listed here, it should show how powerful the determinant is when it is computed.

But wait – there’s more! We can use the determinant of a matrix to calculate its inverse. Here is the formula to calculate the inverse of a 2 × 2 matrix:

A−1=[abcd]−1=1det⁡(A)[d−b−ca]A^{-1} = \begin{bmatrix} a & b \\ c & d \end{bmatrix}^{-1} = \frac{1}{\det(A)} \begin{bmatrix} d & -b \\ -c & a \end{bmatrix}

The first thing to notice is that the reciprocal of the determinant is used. Now, what if the determinant is zero? We can’t divide by zero! So the formula is undefined, but remember that if the determinant is zero, it doesn’t matter because the matrix is not invertible to begin with!

The other thing to notice is that a and d just switch position. Then, b and c are just multiplied by -1.

That was a lot of words! Let’s look at an example with the following matrix:

D=[24−22]D = \begin{bmatrix} 2 & 4 \\ -2 & 2 \end{bmatrix}

Let’s calculate the determinant first:

det⁡(D)=∣D∣=2⋅2−(−2)(4)=4+8=12\det(D) = |D| = 2 \cdot 2 - (-2)(4) = 4 + 8 = 12

Alright, let’s use that to calculate the inverse:

D−1=112[2−422]=[16−131616]D^{-1} = \frac{1}{12} \begin{bmatrix} 2 & -4 \\ 2 & 2 \end{bmatrix} = \begin{bmatrix} \frac{1}{6} & -\frac{1}{3} \\ \frac{1}{6} & \frac{1}{6} \end{bmatrix}

And there you have it. Let’s make sure that it is the inverse by using the definition we had for the inverse of a matrix:

DD−1=[24−22][16−131616]=[13+23−23+23−13+1323+13]=[1001]=IDD^{-1} = \begin{bmatrix} 2 & 4 \\ -2 & 2 \end{bmatrix} \begin{bmatrix} \frac{1}{6} & -\frac{1}{3} \\ \frac{1}{6} & \frac{1}{6} \end{bmatrix} = \begin{bmatrix} \frac{1}{3} + \frac{2}{3} & -\frac{2}{3} + \frac{2}{3} \\ -\frac{1}{3} + \frac{1}{3} & \frac{2}{3} + \frac{1}{3} \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} = I

Now, let’s do some exercises.

Calculate the inverse of the following matrices:

[1234][432−1][1i22i]\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \qquad \begin{bmatrix} 4 & 3 \\ 2 & -1 \end{bmatrix} \qquad \begin{bmatrix} 1 & i \\ 2 & 2i \end{bmatrix}

You should note that in the last exercise, I included complex numbers in the matrix. You should get used to this now that we have covered complex numbers.

Now let’s move on to the main feature, eigenvalues and eigenvectors!

Ah, yes – we have arrived at the meat of this chapter, the eigen-stuff! We know that linear transformations are involved in this somehow, but how? Well, let’s start with something we are familiar with, the reflection transformation we covered in Chapter 5, Using Matrices to Transform Space. Here is the diagram that describes it:

Figure 7.2 – Reflection transformation

Now, the special vectors we are looking for, called eigenvectors, are the ones that only get multiplied by a scalar when they are transformed. Here’s a look at a number of vectors being reflected, with the reflections being the dashed lines. Stare at the diagram and see if you see any reflections that are the same as multiplying by a scalar:

Figure 7.3 – Vectors and their reflections

Well, I don’t want you to stare too long, so here is the first one:

Figure 7.4 – The first eigenvector

Any vector along this line going through a reflection transformation is the same as being multiplied by the scalar -1. This scalar is called the eigenvalue.

Did you notice any other eigenvectors? This one is a little harder to tease out, but here it is:

Figure 7.5 – The second eigenvector

If you remember in our discussion about reflection, we said that any vector that is on the axis of reflection will be reflected onto itself. In other words, it is multiplied by the scalar 1. The set of eigenvectors is any vector on this line, and the corresponding eigenvalue is 1.

So, there you have it – for reflection, an eigenvector is any vector perpendicular to the axis of reflection with an eigenvalue of -1 or any vector parallel to the axis of reflection with an eigenvalue of 1.

Let’s get rigorous and define eigenvectors and eigenvalues. Given a linear operator  an eigenvector is a non-zero vector that when transformed by  is equal to being multiplied by a scalar λ (pronounced lamb-da). This can be written as the following:

A^∣v⟩=λ∣v⟩\hat{A}|v\rangle = \lambda|v\rangle

This is also true for any matrix A that represents the linear operator, Â:

A∣x⟩=λ∣x⟩A|x\rangle = \lambda|x\rangle

where A is a matrix. The scalar λ is called an eigenvalue.

Now for some comic relief from all this rigor!

“What is a baby eigensheep?”

“A lamb, duh!”

Alright, let’s see this eigen-stuff in action with an example matrix. Here’s our chosen matrix:

B=[3002]B = \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix}

Let’s see what it does to a variety of vectors:

[3002][12]=[34][3002][−24]=[−68][3002][10]=[30]\begin{aligned} \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix} \begin{bmatrix} 1 \\ 2 \end{bmatrix} &= \begin{bmatrix} 3 \\ 4 \end{bmatrix} \\[1em] \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix} \begin{bmatrix} -2 \\ 4 \end{bmatrix} &= \begin{bmatrix} -6 \\ 8 \end{bmatrix} \\[1em] \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} &= \begin{bmatrix} 3 \\ 0 \end{bmatrix} \end{aligned}

Do any of the resultant vectors look like a scalar multiple of the original? If you said the last one, you are correct! Let’s write it again with its eigenvalue, 3:

[3002][10]=[30]3[10]=[30]\begin{aligned} \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} &= \begin{bmatrix} 3 \\ 0 \end{bmatrix} \\ 3 \begin{bmatrix} 1 \\ 0 \end{bmatrix} &= \begin{bmatrix} 3 \\ 0 \end{bmatrix} \end{aligned}

You may have noticed that there is more than one eigenvector for an eigenvalue – in fact, there is a set. This leads us to the fact that an eigenvalue with its set of eigenvectors, plus the zero vector, constitutes a subspace of the overall vector space that a linear operator is transforming. For our matrix B, this happens to be a one-dimensional line through (1,0) if we are dealing with a real vector space. Let’s see some more eigenvectors of the eigenvalue 3 to drive the point home:

[3002][−10]=3[−10]=[−30][3002][20]=3[20]=[60]\begin{aligned} \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix} \begin{bmatrix} -1 \\ 0 \end{bmatrix} &= 3 \begin{bmatrix} -1 \\ 0 \end{bmatrix} = \begin{bmatrix} -3 \\ 0 \end{bmatrix} \\[1em] \begin{bmatrix} 3 & 0 \\ 0 & 2 \end{bmatrix} \begin{bmatrix} 2 \\ 0 \end{bmatrix} &= 3 \begin{bmatrix} 2 \\ 0 \end{bmatrix} = \begin{bmatrix} 6 \\ 0 \end{bmatrix} \end{aligned}

This subspace of vectors is called the eigenspace. To define the eigenspace mathematically for the matrix B and the eigenvalue 3 in ℝn, it is as follows:

{[x0]:x∈R}\left\{ \begin{bmatrix} x \\ 0 \end{bmatrix} : x \in \mathbb{R} \right\}

We can also just give the vector (1,0) as a basis vector. When doing this, the basis set of vectors is called the eigenbasis.

So, how do we find eigenvalues when given a square matrix? Well, let’s start with what we are trying to find:

A∣x⟩=λ∣x⟩A|x\rangle = \lambda|x\rangle

(1)

We want to find λ. So, let’s start with manipulating Equation (1) algebraically. Let’s subtract λ|x⟩ from both sides of the equation:

A∣x⟩−λ∣x⟩=0A|x\rangle - \lambda|x\rangle = \mathbf{0}

Okay, after doing that, let’s take out the vector |x⟩:

(A−λ)∣x⟩=0(A - \lambda)|x\rangle = \mathbf{0}

Hmm – this is not a valid equation because λ is a scalar and A is a matrix. What should we do? Let’s multiply λ by the identity matrix so that we are subtracting two matrices:

(A−λI)∣x⟩=0(A - \lambda I)|x\rangle = \mathbf{0}

(2)

Okay, we now have one vector multiplied by the difference of two matrices on the left side of our equation and the zero vector on the other. It just so happens that a part of the invertible matrix theorem that I left unstated says that for Equation (2) to have a non-trivial solution (a solution other than the zero vector), the determinant of the matrix on the left side has to equal zero:

det⁡(A−λI)=0\det(A - \lambda I) = 0

(3)

Equation (3) is called the characteristic equation of matrix A. If we can solve it, we will get all the eigenvalues of A! Let’s see how we can do it with an example.

Okay, let’s use the matrix A, defined as follows:

A=[3−21−1]A = \begin{bmatrix} 3 & -2 \\ 1 & -1 \end{bmatrix}

Now, let’s solve its characteristic equation by first finding the matrix on the left in Equation (3):

A−λI=[3−21−1]−λ[1001]=[3−21−1]−[λ00λ]=[3−λ−21−1−λ]\begin{aligned} A - \lambda I &= \begin{bmatrix} 3 & -2 \\ 1 & -1 \end{bmatrix} - \lambda \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \\ &= \begin{bmatrix} 3 & -2 \\ 1 & -1 \end{bmatrix} - \begin{bmatrix} \lambda & 0 \\ 0 & \lambda \end{bmatrix} \\ &= \begin{bmatrix} 3 - \lambda & -2 \\ 1 & -1 - \lambda \end{bmatrix} \end{aligned}

Okay, now that we’ve found that, let’s set the determinant of that matrix to 0 and solve for λ:

det⁡(A−λI)=(3−λ)(−1−λ)−(−2)=0det⁡(A−λI)=−3−3λ+λ+λ2+2=0det⁡(A−λI)=λ2−2λ−1=0\begin{aligned} \det(A - \lambda I) &= (3 - \lambda)(-1 - \lambda) - (-2) = 0 \\ \det(A - \lambda I) &= -3 - 3\lambda + \lambda + \lambda^2 + 2 = 0 \\ \det(A - \lambda I) &= \lambda^2 - 2\lambda - 1 = 0 \end{aligned}

The polynomial we have found in the preceding equation is called the characteristic polynomial of the matrix A for reference. There seems to be a lot of characteristics floating around, which gets back to our discussion of what eigen stands for in German! If we put the characteristic polynomial into the quadratic formula, we will find that our two eigenvalues for the matrix A are as follows:

λ=1±2\lambda = 1 \pm \sqrt{2}

And there you go – you now know how to find eigenvalues for 2 × 2 matrices. What about bigger matrices? Well, the characteristic polynomials get harder and harder to solve symbolically, and we have to rely on computers to find them numerically. Once again, a handy matrix calculator comes to save the day. For getting eigenvalues and eigenvectors, I’d like to recommend Symbolab (https://www.symbolab.com/) as an online calculator as well (another tool in your toolbelt); a text version is shown in the following figure:

Figure 7.6 – The Symbolab online calculator

Now that we have found the eigenvalues, how do we find the eigenvectors?

In this section, we will answer that question. In a nutshell, we put the eigenvalues back into the definition and solve for the eigenvectors. Let’s say I use the linear operator Y, which is a common gate in quantum computing. Here it is in the computational basis:

Y=[0−ii0]Y = \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix}

I’ll go ahead and tell you that the eigenvalues are 1 and -1. The definition for eigenvalues is as follows:

Y∣x⟩=λ∣x⟩Y|x\rangle = \lambda|x\rangle

Now, let’s solve for the eigenvalue 1, to find its eigenvectors. First, we put in the matrix and eigenvalue:

[0−ii0][x1x2]=1[x1x2]\begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = 1 \begin{bmatrix} x_1 \\ x_2 \end{bmatrix}

Multiplying this out gives us the following:

0x1−ix2=x1ix1+0x2=x2\begin{aligned} 0x_1 - ix_2 &= x_1 \\ ix_1 + 0x_2 &= x_2 \end{aligned}

This is a system of two linear equations, which is pretty simple to solve:

If 0x1−ix2=x1 then x1=−ix2\text{If } 0x_1 - ix_2 = x_1 \text{ then } x_1 = -ix_2

This means that we can choose any value for x2 and derive x1. Putting this back into the vector |x⟩, we get the following:

∣x⟩=[−ix2x2]|x\rangle = \begin{bmatrix} -ix_2 \\ x_2 \end{bmatrix}

So, any vector that has the components of |x⟩ will be an eigenvector for the eigenvalue of 1 for the matrix Y. Let’s set one component to get a “representative eigenvector” for the eigenvalue:

Let x2=1 then ∣x⟩=[−i1]\text{Let } x_2 = 1 \text{ then } |x\rangle = \begin{bmatrix} -i \\ 1 \end{bmatrix}

To find the other set of eigenvectors for Y, you repeat the process with the other eigenvalue of -1.

Sometimes, when we compute the characteristic polynomial for a matrix, it can output something like this:

(λ−1)2=0(\lambda - 1)^2 = 0

In this case, the only eigenvalue is 1, but it is the root of the characteristic polynomial twice. Therefore, this particular eigenvalue has an algebraic multiplicity of 2. In general, the algebraic multiplicity of a particular eigenvalue is the number of times it appears as a root of the characteristic polynomial.

The trace of a matrix is very easy to compute, but it helps to have its value, as it has special properties. It is defined as the sum of the values on the main diagonal of a matrix. So, let’s say we have the following:

A=[a11a12a13a21a22a23a31a32a33]=[135i−i6723]A = \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{bmatrix} = \begin{bmatrix} 1 & 3 & 5 \\ i & -i & 6 \\ 7 & \sqrt{2} & 3 \end{bmatrix}

The trace of A will then be the following:

tr⁡(A)=∑i=13aii=a11+a22+a33=1−i+3=4−i\operatorname{tr}(A) = \sum_{i=1}^{3} a_{ii} = a_{11} + a_{22} + a_{33} = 1 - i + 3 = 4 - i

In general, the definition of the trace for an n × n square matrix is as follows:

tr⁡(A)=∑i=1naii=a11+a22+⋯+ann\operatorname{tr}(A) = \sum_{i=1}^{n} a_{ii} = a_{11} + a_{22} + \cdots + a_{nn}

The trace of a linear operator is the same for any matrix that represents it.

Now that we have gone through the concept of the trace and determinant, let’s quickly look at some cool properties they have in relation to eigenvalues.

It happens that the sum of the eigenvalues of a matrix equals the trace of the matrix:

tr⁡(A)=∑iλi\operatorname{tr}(A) = \sum_i \lambda_i

Additionally, the product of all the eigenvalues of a matrix is equal to the determinant:

det⁡(A)=λ1⋅λ2⋅…⋅λn=∏iλi\det(A) = \lambda_1 \cdot \lambda_2 \cdot \ldots \cdot \lambda_n = \prod_i \lambda_i

I encourage you to go back to the matrices we have used as examples with their eigenvalues and prove to yourself that this is indeed true!

We have covered quite a bit of ground here in relatively few pages. We saw how to calculate the determinant and how it plays a role in finding the inverse of matrices. Many types of eigen-stuff were discussed, and ways to find them were also given. Finally, we saw how the trace is calculated and how it relates to everything else we covered in this chapter. These concepts will equip you to do serious linear algebra and quantum computing going forward. In the next chapter, we will bring everything together that we learned in the last seven chapters to explore the space where qubits live!