Skip to main content

linear-algebra-and-numerical-analysis

Intro to linear algebra

Spans and linear combinations

A linear combination of two vectors (v\vec v, w\vec w) is, where (a,b) are scalars:

av+bwa\vec v + b\vec w

The span of two vectors v\vec{v} and w\vec{w} is the set of all their linear combinations.

  • In 2D, two non-collinear vectors typically span the whole plane.
  • If two vectors line up (one is a scalar multiple of the other), they span only a line.

Based on span, we have the concept of linear dependence vs independence:

  • Linearly dependent: one vector can be expressed as a linear combination of others (redundant).
  • Linearly independent: no vector in the set is redundant.

Checking for linear independence

Given two vectors x\vec x and y\vec y, you test for linear independence by setting their linear combination equal to the zero vector.

c1x+c2y=0c_1 \vec x + c_2 \vec y = \vec 0

  • If the only solution is that both x\vec x and y\vec y are 0\vec 0, then they are linearly dependent.
  • If there is a solution with either x\vec x and y\vec y not being the zero vector, then they are linearly dependent.

Matrices as linear transformations

A matrix has its columns as basis vectors, and applies a transformation to vectors by using the matrix's basis vectors as the basis vectors for the vector it wants to transform, mapping that vector into the matrix's coordinate space.

Here is how a matrix AA translates a vector x\vec x in standard coordinate space (basis vectors are i\vec i and j\vec j) into a vector v\vec v.

Ax=vA\vec x = \vec v

NOTE

Ax=bA\vec x = \vec b has a solution if b\vec b is in the span of the columns of AA.

You can describe a linear transformation by just recording what happens to the i^\hat i and j^\hat j basis vectors of the original coordinate space and how they get transformed.

For example, if a linear transformation scales i^\hat i to 2i^2 \hat i, then the matrix representation of the linear transformation is 2001\begin{matrix} 2 & 0 \\ 0 & 1 \end{matrix}, or [2i^T,j^T][2 \hat i^T, \hat j^T]

For this example, let's assume A=2001A = \begin{matrix} 2 & 0 \\ 0 & 1 \end{matrix} and x=75\vec x = \begin{matrix} -7 \\ 5 \end{matrix}.

  1. The basis vectors of AA, let's call them a^1=20\hat a_1 = \begin{matrix} 2 \\ 0 \end{matrix} and a^2=01\hat a_2 = \begin{matrix} 0 \\ 1 \end{matrix}
  2. When we transform x\vec x into the coordinate space of AA, basically we're going to change the linear combination representation of x\vec x from using the standard coordinate space basis vectors (i^\hat i and j^\hat j) to the basis vectors of AA:

x=75=7i^+5j^\vec x = \begin{matrix} -7 \\ 5 \end{matrix} = -7 \hat i + 5 \hat j

Ax=7a^1+5a^2=75A \vec x = -7 \hat a_1 + 5 \hat a_2 = \begin{matrix} -7 \\ 5 \end{matrix}

  1. But this 75\begin{matrix} -7 \\ 5 \end{matrix} is now in the "language" of the non-standard basis vectors a^1\hat a_1 and a^2\hat a_2, and the only way for us to understand what truly happened to x\vec x is to translate the basis vectors into the standard coordinate space and then rewrite everything as a linear combination in the standard space:

Ax=7a^1+5a^2=7(20)+5(01)=145=vA \vec x = -7 \hat a_1 + 5 \hat a_2 = -7 \begin{pmatrix} 2 \\ 0 \end{pmatrix} + 5 \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{matrix} -14 \\ 5 \end{matrix} = \vec v

Matrix multiplication properties

  • Not commutative: (AB \ne BA) in general.
  • Associative: (A(BC)=(AB)C).
  • applied right to left: Applying one transformation after another is composition. If you first apply (B) then apply (A), the combined transformation is (AB), because matrix multiplication is applied right to left.

Change of basis

Let's assume

Determinants and invertible matrices

The geometric meaning of a determinant

For a 2×2 matrix, (det(A)|\det(A)|) is how much areas scale.

  • (det(A)>1|\det(A)| > 1): areas expand
  • (0<det(A)<10 < |\det(A)| < 1): areas shrink
  • (det(A)<0\det(A) < 0): orientation flips (a “mirror”/reflection component)

But what if the determinant is 0, meaning the basis vectors are collinear with each other? That's where determinants connect to linear independence and dependence and singular matrices:

  • det(A)=0\det(A)=0: space gets “squished” into a lower dimension (e.g., plane → line).
    • linearly dependent: basis vectors become linearly dependent.
    • singular: since the columns of the matrix (basis vectors) are linearly dependent, matrix is singular.
  • det(A)0\det(A) \ne 0: the parallelogram formed by the basis vectors has non-zero area
    • linearly dependent: basis vectors are not collinear, since that is the only way for the parallelogram formed by the basis vectors to have non-zero area
    • singular: since the columns of the matrix (basis vectors) are linearly dependent, matrix is singular.

Mathematical properties of determinants

  • multiplicative rule: if a matrix BB gets transformed via composition by matrix AA, then the area formed by its basis vectors (det(b)\det(b)) gets scaled by the area formed from the basis vectors of AA, namely det(a)\det(a).

    det(AB)=det(A)det(B)det(AB) = det(A) \cdot det(B)
  • inverse rule

    det(A1)=1det(A)det(A^{-1}) = \frac{1}{det(A)}
  • additive rule

    det(AB)=det(A)det(B)det(A-B) = det(A) - det(B)

Invertible and singular matrices

To represent a system of equations, you can use a coefficient matrix, multiply it by a variable vector, and set it equal to a constants vector: Ax=vA\vec{x}=\vec{v}.

In plain english:

We are looking for a vector x\vec{x} that when transformed by AA, lands on v\vec{v}.

To solve this system of equations, we can use inverse matrices: Inverse matrices are the inverse transformation of a matrix.

By applying a transformation, then subsequently applying the inverse of that transformation, you end up back where you started: A1A=IA^{-1}A=I.

  • If a matrix rotates space clockwise by 90 degrees, an inverse matrix of that matrix would rotate space counterclockwise 90 degrees.
  • doing a transformation AA then doing the transformation A1A^{-1} is the same thing as doing nothing.

By using the inverse, you can find the variable vector like so

x=A1v\vec{x} = A^{-1} \vec{v}

A matrix is invertible/nonsingular if it has an inverse, else we call it singular if it does not have an inverse.

Singular matrices are noninvertible (have det = 0) while nonsingular matrices are invertible. In terms of G.E, this means the following:

  • singular matrices: infinite solutions or no solutions. One row is just full zeros when reduced via G.E, so there is at least one free variable.
  • nonsingular: Has one solution for Ax=bA \vec x = \vec b, meaning there is a pivot in each row and along the diagonals in its correct spot.

when matrices don’t have an inverse

If the determinant of matrix is 0, then it does not have an inverse because it squishes all of space onto one line irreversibly. The area of the parallelogram formed by the basis vectors is 0. You cannot un-squish a line.

Also, a matrix transformation being injective and surjective plays a role in if its invertible or not.

  • injective: A linear map is injective iff the only vector mapped to (0) is the zero vector.
    • Basically, no transformed vector besides the zero vector should transform to the zero vector, otherwise the linear transformation is not injective.
  • surjective: Once transformed, the new basis matrix has the same span as the original basis matrix. Basically, the transformation matrix must be full rank and a square matrix.

Transformation matrices will only have inverses if they are bijective - meaning both injective and surjective.

So in summary, here are the three cases where a transformation matrix MM will not have an inverse:

  1. det(M)=0det(M) = 0: transformation matrix is not injective, because some vectors will get squished to the zero vector as a result of this transformation.
  2. nonsquare matrices: Not surjective, since their column space is not full rank.
  3. matrices that transform some vectors to the 0\vec 0: These matrices are not injective by definition.

Rank, column space, null space

  • Rank: number of dimensions in the output / the dimension of the column space.
  • Column space: the span of the columns of (AA).
  • null space: The null space is all vectors mapped to zero, which can be found through this equation:

Ax=0A\vec x = \vec 0

rank

rank means the number of dimensions in the output of the transformation, and is used to differentiate between transformations that either take up all the possible dimensions or have a zero-determinant and thus squish all vectors into a lower dimension.

  • When the output of a transformation is a line, the rank is 1.
  • When the output of a transformation is a plane, the rank is 2.
  • When the output of a transformation is all of space, the rank is 3.
  • Full rank means that the number of dimensions matches the number of columns.
    • example: full rank for an R4\mathbb{R}^4 space is 4.

IMPORTANT

Matrices are full rank iff they are injective, meaning its null space only has the trivial solution x=0\vec x = \vec 0.

column space

Column space is the span of the columns of the matrix, with the max column space for a m×nm \times n matrix being Rn\mathbb{R}^n.

  • when a matrix is singular based on column space: If your column space dimensions are less than the dimensions of the matrix, meaning less dimensional than Rn\mathbb{R}^n , then the matrix is singular.

null space

The null space is the set of all possible vectors that become null, or 0\vec 0 after a linear transformation.

Geometrically, it's the set of all vectors that land on the origin after a linear transformation, and has two types of solutions:

  • trivial solution: the only vector that maps to the origin is the origin itself, 0\vec 0, since by nature of a linear transformation the origin (zero vector) always stays fixed.
  • nontrivial solution: there is a non-empty set of non-zero vectors called the kernel that gets transformed into the 0\vec 0.

You can find the null space by solving a system of equations and setting the post-transformed vector to the 0\vec 0.

Ax=0A\vec x = \vec 0

NOTE

The kernel is the set of all solutions to the null space equation, and a trivial solution leads to a trivial kernel, and a nontrivial solution leads to a nontrivial kernel.

Cramer's rule

Cramer's rule comes into play when we have an equation Ax=bA \vec x = \vec b, where AA and b\vec b are known, and we want to find out what x=(xy)\vec x = \begin{pmatrix} x \\ y \end{pmatrix} is.

Intuition

Consider that for the standard identity matrix with basis vectors i^\hat i and j^\hat j, we can represent the coordinates of a vector x=(xy)\vec x = \begin{pmatrix} x \\ y \end{pmatrix} as two areas.

Let's form the following notation:

  • Areai^,x\text{Area}_{\hat i, \vec x}: the area of the parallelogram formed by x\vec x and i^\hat i
  • Areax,j^\text{Area}_{\vec x, \hat j}: the area of the parallelogram formed by x\vec x and j^\hat j

Let's dive into the calculations

  • xx: the area of the parallelogram formed by x\vec x and j^\hat j turns out to be xj^x \hat j.

x=xj^=det([x,j^])=xdet(I)=Areax,j^x = x \hat j = \det([ \vec x, \hat j]) = x \det(I) = \text{Area}_{\vec x, \hat j}

  • yy: the area of the parallelogram formed by x\vec x and i^\hat i turns out to be yi^y \hat i.

y=yj^=det([i^,x])=ydet(I)=Areai^,xy = y \hat j = \det([ \hat i, \vec x]) = y \det(I) = \text{Area}_{\hat i, \vec x}

Now that we found what xx and yy are in terms of basis vectors, we can swap those standard basis vectors out for any matrix, and understand that linear transformations AA will scale and stretch vectors evenly:

det(AB)=det(A)det(B)det(AB) = det(A)det(B)

  • Areai^,x=ydet(I)=y\text{Area}_{\hat i, \vec x} = y \cdot \det(I) = y, but after transformation from A, it becomes ydet(A)y \det(A), and now find the signed area using the output vector b\vec b, since Ax=bA\vec x = \vec b, thus we deal with b\vec b instead of x\vec x in the transformed coordinate space of AA and luckily since we know b\vec b, thus we arrive at this new formula:

y=Areaa^1,bdet(A)y = \frac{\text{Area}_{\hat a_1, \vec b}}{\det(A)}

  • Areax,j^=xdet(I)=x\text{Area}_{\vec x, \hat j} = x \cdot \det(I) = x, but after transformation from A, it becomes xdet(A)x \det(A), and now find the signed area using the output vector b\vec b, since Ax=bA\vec x = \vec b, thus we deal with b\vec b instead of x\vec x in the transformed coordinate space of AA and luckily since we know b\vec b, thus we arrive at this new formula:

x=Areab,j^det(A)x = \frac{\text{Area}_{\vec b, \hat j}}{\det(A)}

Dot product

For two vectors v\vec v and w\vec w, the dot product vw\vec v \cdot \vec w can be thought of as the length of projected w\vec w on v\vec v times the length of v\vec v

  • When two vectors point in generally the same direction, their dot product is positive
  • Whe two vectors point in generally the opposite directions, their dot product is negative.

This is another formula for the dot product that lets you find the angle between two vectors:

ab=abcosθ\vec{a} \cdot \vec{b} = \|\vec a\|\|\vec b\|cos{\theta}

Geometric interpretation

For two vectors v\vec v and w\vec w, the dot product vw\vec v \cdot \vec w can be thought of as the length of projected w\vec w on v\vec v times the length of v\vec v.

Here's how to geometrically visualize vw\vec v \cdot \vec w and wv\vec w \cdot \vec v:

  1. Think that you are projecting w\vec w onto v\vec v, so draw a line down from the tip of w\vec w towards v\vec v until you hit v\vec v, and that line should form a right triangle, with v\vec v and w\vec w.

  1. Now multiply the length of the projected w\vec w onto v\vec v by the length of v\vec v to achieve the dot product vw\vec v \cdot \vec w.

  1. Notice that this operation is commutative, where wv\vec w \cdot \vec v yields the same result, even though now we're projecting v\vec v onto w\vec w instead. This is because both geometric interpretations are exact mirror opposites of each other.

  1. Even with scalar multiplication that breaks symmetry, the overall effect is still the same if you go through the math:
    • 2vw2\vec v \cdot \vec w: The length of w\vec w projected onto 2v2\vec v doesn't change, but we now multiply by 2v\| 2 \vec v \|, which doubles the dot product.
    • w2v\vec w \cdot 2\vec v: The length of 2v2 \vec v projected onto w\vec w does change, but it approximately doubles the length of the previous projection of v\vec v onto w\vec w, so the overall effect still doubles the dot product.

Now let's understand how this geometric interpretation works with other cases:

  • vectors point in roughly same direction: results in a positive length
  • vectors point in roughly opposite directions: results in a negative length

  • vectors are perpendicular: geometrically, to form a projection you draw a line straight down from the tip of the vector you're trying to project onto the other vector. You can't do it if they're perpendicular, which is why the dot product is zero if the vectors are perpendicular, Because there's no way to draw a projection from one vector onto another if the vectors are perpendicular

Algebraic duality interpretation

Great. Now we know that dot products correspond to projections but we need to understand why the mathematical way of just ordered coordinate pair multiplication of dot products actually corresponds to a projection.

The way we can view this is through duality, which considers vectors as linear transformations that squish space onto a lower dimension, namely a single number line:

  • linear transformations that squish space onto a line have basis vectors land on a number in the number line.

Consider an example v=(43)\vec v = \begin{pmatrix} 4 \\ 3 \end{pmatrix} and w=(12)\vec w = \begin{pmatrix} 1\\ -2 \end{pmatrix}, and we are doing wv\vec w \cdot \vec v, which has the duality interpretation of transforming v\vec v into the coordinate space (single number line) of w\vec w using the basis vectors of w\vec w being w^1=1\hat w_1 = 1 and w^2=2\hat w_2 = -2, so we can rewrite the dot product as a linear transformation which ends up being just a linear combination:

wv=4w^1+3w^2=4(1)+3(2)=2\vec w \cdot \vec v = 4 \hat w_1 + 3 \hat w_2 = 4(1) + 3(-2) = -2

Projections

Although the dot product may seem asymmetric since the vector you are projecting is different depending on which vector comes first in the dot product, in the end they both calculate out to be the exact same thing.

This allows us to find the lengths of the individual projections even if the dot product is the same.

Let's start off with some notation:

Orthonormal transformations

here's a thought: in the standard coordinate space, we can represent an arbitrary vector like so:

(xy)=xi^+yj^=(xy)(10)+(xy)(01)=(xy)i^+(xy)j^\begin{pmatrix} x \\ y \end{pmatrix} = x \hat i + y \hat j = \begin{pmatrix} x \\ y \end{pmatrix} \cdot \begin{pmatrix} 1 \\ 0 \end{pmatrix} + \begin{pmatrix} x \\ y \end{pmatrix} \cdot \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} x \\ y \end{pmatrix} \cdot \hat i + \begin{pmatrix} x \\ y \end{pmatrix} \cdot \hat j

So we would naively think that we can represent any vector x\vec x as the sum of its dot products with each basis vector of a matrix.

But that only works in one special case: orthonormal transformations.

Orthonormal transformations are those in which the dot product of two vectors is preserved even after the same matrix transformation is applied to those two vectors.

The only matrices UU that provide orthonormal transformations are of the orthogonal family of matrices, where vectors 1) are not stretched and 2) maintain the same angle.

More formally, matrices UU that provide orthonormal transformations must satisfy these two properties:

  1. det(U)=1det(U) = 1: Because the basis vectors are uniform, transformed vectors are not stretched.

NOTE

So what does it really mean to have a matrix be representative of an orthonormal transformation?

Their rows and columns form orthonormal sets of vectors, which means they preserve the inner product of vectors, thus maintaining lengths and angles in complex vector spaces, which leads to the determinant having an absolute value of 1.

In the case of orthonormal transformations you can very easily find an input vector that results in a corresponding known output vector via these steps:

inner products vs outer products

Suppose you have two vectors of the same length, xx and yy such that x,yRnx, y \in \mathbb{R}^n

  • inner product: The inner product, also known as the dot product, is xTyx^T y
  • outer product: The outer product xyTxy^T produces an n×nn \times n matrix.

Cross product

The cross product of two vectors a\vec a and b\vec b measures the area of the parallelogram formed by those two vectors:

a×b=absinθ\vec a \times \vec b = \| \vec a \| \| \vec b \| \sin{\theta}

Here are the behaviors of a cross product:

  • greatest when two vectors are orthogonal: This is because sin90=1\sin90 = 1.
  • a×a=0\vec a \times \vec a = 0: this is because the angle between a vector and itself is 0, therefore sin0=0\sin 0 = 0

Eigenvectors and Eigenvalues

Eigenvectors are simply vectors that stay on their span after a linear transformation. More formally, they satisfy the equation Av=λvA\vec v = \lambda \vec v:

  • Eigenvector: a vector v\vec v that stays on its own span after transformation.
  • Eigenvalue: the factor λ\lambda by which that eigenvector is scaled.
  • Eigenpair: the pair of an eigenvector and its corresponding eigenvalue (λ,v)(\lambda, \vec v)

To compute eigenvalues, we can try to find the null space of Avλv=0A\vec v - \lambda \vec v= \vec 0, which will then give us all the eigenpairs possible.

So we start off with this:

(AλI)v=0(A-\lambda I)\vec v = \vec 0

If (AλI)v=0(A - \lambda I)\vec v = \vec 0, then det(AλI)=0det(A-\lambda I) = 0. Which then gives us the characteristic equation we can solve for as a polynomial:

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

NOTE

The reasoning is that the only way for a matrix times a vector to be the 0\vec 0 is if the matrix has a nontrivial null space and therefore is not full rank, and therefore the matrix is singular, therefore, the determinant of the matrix is 0.

You can now also use determinants to solve for eigenvectors and eigenvalues.

  1. Solve the polynomial det(AλI)=0det(A-\lambda I) = 0 for all the possible λ\lambda
  2. Plug in λ\lambda into Av=λvA \vec v = \lambda \vec v to solve for the eigenvectors

Solving for eigenpairs

Here are the general steps:

  1. Rewrite Av=λvA\vec v = \lambda \vec v to Avλv=0A\vec v - \lambda \vec v = \vec 0

  2. Since comparing matrix-vector multiplication with scalar-vector multiplication is awkward, we can rewrite λ\lambda as λI\lambda I, which will just put the eigenvalues λ\lambda along the diagonal of the matrix.

    (AλI)v=0(A - \lambda I)\vec v = \vec 0
  3. If (AλI)v=0(A - \lambda I)\vec v = \vec 0, then det(AλI)=0det(A-\lambda I) = 0. The reasoning is that the only way for a matrix times a vector to be the 0\vec 0 is if the matrix has a null space and is therefore non-invertible and therefore has a determinant = 0. Use this equation to find the eigenvalues.

  4. Plug back in the eigenvalues you found when you solved for λ\lambda back into the equation and solve for the eigenvectors:

    (AλI)v=0(A - \lambda I)\vec v = \vec 0

NOTE

A quick tip to find eigenvalues:


If AλIA - \lambda I produces a triangular matrix or a diagonal matrix, then the eigenvalues simply lie along the diagonal of AλIA - \lambda I. Proof and intuition in [[#Diagonal matrices and eigenvalues]].

Eigenvalue theorems

proof: The determinant of a matrix AA is equal to product of its eigenvalues

Prove that the determinant of an n×nn \times n matrix AA equals the product of its eigenvalues because the determinant is precisely the constant term of the matrix's characteristic polynomial.

The determinant of a matrix AA is equal to product of its eigenvalues:

det(A)=Πi=1nλidet(A) = \Pi_{i=1}^n \lambda_i

How do we prove this?

Proof via the Characteristic Polynomial

Every eigenvalue λ\lambda of AA satisfies the characteristic equation:

det(λIA)=0\det(\lambda I - A) = 0

Let p(λ)=det(λIA)p(\lambda) = \det(\lambda I - A). Because AA is an n×nn \times n matrix, p(λ)p(\lambda) is a monic polynomial of degree nn. By the Fundamental Theorem of Algebra, p(λ)p(\lambda) can be factored completely over the complex numbers in terms of its nn roots (the eigenvalues λ1,λ2,,λn\lambda_1, \lambda_2, \dots, \lambda_n, counted with multiplicity):

p(λ)=(λλ1)(λλ2)(λλn)p(\lambda) = (\lambda - \lambda_1)(\lambda - \lambda_2)\dots(\lambda - \lambda_n)

Now, evaluate both representations of p(λ)p(\lambda) at λ=0\lambda = 0:

  1. Determinant definition: p(0)=det(0IA)=det(A)p(0) = \det(0 \cdot I - A) = \det(-A)

    Factoring out the scalar 1-1 from all nn rows yields:

    det(A)=(1)ndet(A)\det(-A) = (-1)^n \det(A)

  2. Factored roots definition: p(0)=(0λ1)(0λ2)(0λn)=(1)ni=1nλip(0) = (0 - \lambda_1)(0 - \lambda_2)\dots(0 - \lambda_n) = (-1)^n \prod_{i=1}^{n} \lambda_i

Equating the two expressions for p(0)p(0):

(1)ndet(A)=(1)ni=1nλi(-1)^n \det(A) = (-1)^n \prod_{i=1}^{n} \lambda_i

Dividing both sides by (1)n(-1)^n leaves:

det(A)=i=1nλi\det(A) = \prod_{i=1}^{n} \lambda_i


Alternative Proof via Schur Decomposition

In numerical linear algebra, this result is often viewed through the Schur Decomposition ( a generalization of diagonalization), which states that any square matrix AA can be factored as:

A=QTQA = Q T Q^*

where QQ is unitary (QQ=IQ^* Q = I) and TT is upper triangular.

  • The diagonal entries of TT (t11,t22,,tnnt_{11}, t_{22}, \dots, t_{nn}) are precisely the eigenvalues λ1,,λn\lambda_1, \dots, \lambda_n of AA.

  • Using the multiplicative property of determinants: det(A)=det(Q)det(T)det(Q)=det(QQ)det(T)=det(I)det(T)=det(T)\det(A) = \det(Q)\det(T)\det(Q^*) = \det(Q Q^*)\det(T) = \det(I)\det(T) = \det(T)

  • Because TT is upper triangular, its determinant is simply the product of its diagonal entries:

    det(T)=i=1ntii=i=1nλi\det(T) = \prod_{i=1}^{n} t_{ii} = \prod_{i=1}^{n} \lambda_i

Both paths reach the same conclusion: if any eigenvalue λk=0\lambda_k = 0, the entire product collapses to zero, which is why a matrix with a zero eigenvalue is non-invertible.

Therefore, for any n×nn\times n matrix AA:

det(A)=i=1nλi\det(A)=\prod_{i=1}^n \lambda_i

NOTE

Coming from this theorem, if a matrix has an eigenvalue λ=0\lambda = 0, then it has a determinant = 0 and is thus noninvertible (the product of eigenvalues becomes 0, thus determinant becomes 0).

Diagonal matrices and eigenvalues

For both diagonal and triangular (upper or lower) matrices, the eigenvalues are simply the entries along the main diagonal.

NOTE

An intuitive look:


If a matrix is diagonal, the standard basis vectors are eigenvectors and diagonal entries are eigenvalues.

For both diagonal and triangular (upper or lower) matrices, the eigenvalues are simply the entries along the main diagonal.

Why This Holds

For any n×nn \times n upper triangular matrix UU:

U=(u11u12u1n0u22u2n00unn)U = \begin{pmatrix} u_{11} & u_{12} & \dots & u_{1n} \\ 0 & u_{22} & \dots & u_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & u_{nn} \end{pmatrix}

The eigenvalues are the roots of the characteristic equation det(λIU)=0\det(\lambda I - U) = 0.

Subtracting UU from λI\lambda I yields another upper triangular matrix:

λIU=(λu11u12u1n0λu22u2n00λunn)\lambda I - U = \begin{pmatrix} \lambda - u_{11} & -u_{12} & \dots & -u_{1n} \\ 0 & \lambda - u_{22} & \dots & -u_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & \lambda - u_{nn} \end{pmatrix}

Because the determinant of any triangular (or diagonal) matrix is the product of its diagonal entries:

det(λIU)=(λu11)(λu22)(λunn)=0\det(\lambda I - U) = (\lambda - u_{11})(\lambda - u_{22})\cdots(\lambda - u_{nn}) = 0

Setting this polynomial to zero gives the roots directly:

λ1=u11,λ2=u22,,λn=unn\lambda_1 = u_{11}, \quad \lambda_2 = u_{22}, \quad \dots, \quad \lambda_n = u_{nn}

Since a diagonal matrix is merely a special case of a triangular matrix (where all off-diagonal elements are zero), the exact same rule applies.


Significance in Numerical Analysis

Finding the roots of a high-degree polynomial directly is computationally unstable and expensive for large matrices. Because triangular and diagonal matrices reveal their eigenvalues by inspection, nearly all numerical eigenvalue algorithms work by transforming a general matrix into one of these simpler forms via similarity transformations (AX1AXA \mapsto X^{-1} A X), which preserve eigenvalues:

  • Eigendecomposition (A=XΛX1A = X \Lambda X^{-1}): Transforms a diagonalizable matrix into a pure diagonal matrix Λ\Lambda, where the diagonal holds the eigenvalues and the columns of XX are the eigenvectors.
  • Schur Decomposition (A=QTQA = Q T Q^*): Transforms any square matrix using a unitary matrix QQ into an upper triangular matrix TT (Schur form). The eigenvalues are read directly off the diagonal of TT.
  • QR Algorithm: The workhorse method in numerical linear algebra; it iteratively applies QR factorizations to drive a general matrix toward upper triangular (or quasi-triangular) form so the eigenvalues can be read straight off the diagonal.

Algebraic matrix properties

Inverse and transpose proofs

These are general proofs that work with all square matrices:

proof 1

We want to prove:

(AB)1=B1A1(AB)^{-1} = B^{-1}A^{-1}

proof 2

We want to prove:

(AB)T=BTAT(AB)^T = B^TA^T

Vector and matrix norms

Vector norms

A vector norm is a function that transforms a vector of any size into a scalar.

A vector norm is only valid if it satisfies these four properties:

  1. positive: the norm returns a positive real number
  2. injective: the norm is 0 only if the input is 0\vec 0.
  3. preservation of scalars: scalars in scalar multiplication can be taken out of the norm.
  4. satisfies triangle inequality

There are three vectors norms:

  • L1 norm: the sum of the absolute value of all the elements in the vector
  • L2 norm: the magnitude of the vector
  • infinity norm: the element with the maximum absolute value out of all the elements in the vector.

1 norm

The 1-norm is simply the sum of the absolute value of all the elements in the vector

x1=i=1nxi\| \mathbf{x}\|_1 =\sum_{i=1}^{n} |x_i|

2 norm

The 2-norm is the most common vector norm, which is just the magnitude of the vector

x2=(i=1nxi2)1/2\| \mathbf{x}\|_2 = \left( \sum_{i=1}^{n} x_i^2 \right)^{1/2}

infinity-norm

The infinity-norm is simply the maximum absolute value of the elements in the vector.

x=max1inxi\|\mathbf{x}\|_\infty = \max_{1 \le i \le n} |x_i|

Norm comparisons

xx2nx\| x \|_\infty \le \| x \|_2 \le \sqrt n \| x \|_\infty

Matrix norms

Matrix norm is a function that takes in a matrix and returns a single scalar value.

A matrix norm aggregates all the values inside it, and must have these properties:

Matrix norms measure how much a matrix can stretch a vector:

A=maxx0Axx.\|A\| = \max_{x\ne 0} \frac{\|Ax\|}{\|x\|}.

Common induced norms include A1,A,A2\|A\|_1, \|A\|_\infty, \|A\|_2.

L2 Norm (Frobenius Norm)

For matrices, the L2 norm is just the sum of the squares of all the elements in the matrix, and then take the square root of that.

This norm is also called the Frobenius Norm.

np.linalg.norm(matrix) # returns frobenius norm of matrix

Special matrices

Diagonal matrices

Diagonal matrices have these three core properties:

  • eigenvalues lie along the diagonal:
    • The product of the diagonals of a diagonal matrix is equal to the product of the eigenvalues.
    • the trace of a diagonal matrix is equal to the sum of the eigenvalues of the diagonal matrix.

Tr(D)=i=0nλiTr(D) = \sum_{i = 0}^n \lambda_i

  • diagonal matrix exponents are just exponentiating the diagonal elements: This means it’s trivial to calculate something like AnA^n.

  • matrix multiplication is commutative: If you have a diagonal matrix DD and a nondiagonal matrix AA, then matrix multiplication is commutative with diagonal matrices.

    AD=DAAD = DA

Diagonal proofs

determinant of a diagonal matrix is product of its diagonal elements and thus eigenvalues

A matrix’s determinant is equal to the product of its eigenvalues, so since diagonal elements in a diagonal matrix are the eigenvalues, the determinant of a diagonal matrix is equal to the product of its diagonal values.

Symmetric matrices

A symmetric matrix is a matrix that is equal to its transpose

A=ATA = A^T
  • A2=AATA^2 = AA^T

Orthogonal, unitary, and Hermitian matrices

Decompositions

Cholesky decomposition

Eigendecomposition

You can represent any n×nn \times n matrix AA with nn linearly independent eigenvectors as its eigendecomposition, which you can get by manipulating the eigenvector formula Ax=λxAx = \lambda x, which only works for square and invertible matrices AA.

Starting from a n×nn \times n invertible matrix AA:

  • λ\lambda: the diagonal matrix with eigenvalues of AA along the diagonal.
  • UU: the matrix of eigenvectors of AA, which we often normalize to be unit vectors.
  • Λ\Lambda: the diagonal matrix with the corresponding eigenvalues of UU along the diagonal, gotten from the neat trick of Λ=λI\Lambda = \lambda I

Here are the steps:

  1. Find the eigenpairs of AA
  2. We can form the matrix UU as the matrix whose columns are the eigenvectors of AA.
  3. From the standard eigenvector equation Av=λvA \vec v = \lambda \vec v, that corresponds to the matrix version AU=UΛA U = U \Lambda , where Λ=λI\Lambda = \lambda I, the diagonal matrix with the corresponding eigenvalues of UU along the diagonal.
  4. Multiply both sides by U1U^{-1}

From these to steps, we arrive this equation:

A=UλU1A = U\lambda U^{-1}

Similarity transforms, diagonalization, and Schur

Similarity transform

B=S1ASB = S^{-1}AS
  • Same eigenvalues.
  • Same determinant, trace, characteristic polynomial.

Diagonalization (special case)

If AA has nn independent eigenvectors:

A=PDP1A = P D P^{-1}

Schur decomposition (more general)

Every square matrix has a Schur form (over complex numbers):

A=QTQA = Q T Q^*

where QQ is unitary and TT is upper triangular.

Numerical relevance:

  • Many eigenvalue algorithms are based on Schur form because it’s stable.