The main definitions, formulas, theorems and algorithms of Linear Algebra I on one page, unit by unit, with links to the lessons that explain each topic in full.
This sheet follows the eleven units of the course in order. Each unit starts with the big idea in a few sentences, then gives the definitions, formulas, theorems and algorithms you will look up most often, with the conditions they need. When you want the full explanation, a proof or more examples, follow the lesson links under each topic.
Scalars are real numbers until complex numbers enter in the unit on eigenvalues. Vectors are columns and get bold lowercase letters such as v, with the zero vector 0 and the standard unit vectors e1,…,en. In running text a tuple such as (3,−1) stands for the column with those entries. Vectors of an abstract vector space are bold too, while a polynomial p or a matrix used as a vector keeps its usual name. Scalars are plain italic letters, matrices are capitals such as A, and a real m×n matrix is a map from Rn to Rm. The transpose is A⊤, the dot product is x⋅y=x⊤y, the norm is ∥x∥ and a general inner product is ⟨u,v⟩.
A matrix has the subspaces ColA, RowA and NullA, and a linear map T has kerT and imT. An ordered basis is B=(b1,…,bn), the coordinate column of v in it is [v]B, and coordinates change by [v]C=PC←B[v]B. The characteristic polynomial is χA(t)=det(tI−A), eigenvalues come in no particular order, and singular values are nonnegative and listed in decreasing order. For complex matrices A∗=A⊤ and ⟨x,y⟩=x∗y, which is conjugate-linear in the first argument. Row operations are written as R2→R2−3R1. A formula holds wherever both sides are defined unless a condition says otherwise.
Vectors and Matrices
Vectors are lists of numbers that can be added and scaled, and matrices collect vectors as columns. Multiplying a matrix by a vector forms a weighted sum of its columns. Linear transformations are the maps that respect addition and scaling, and composing two of them multiplies their matrices in a definite order.
Vectors and linear combinations
A vector in Rn is an ordered list of n real numbers. Vectors of the same size are added and scaled entry by entry,
u+v=u1+v1⋮un+vn,cv=cv1⋮cvn.
In the plane and in space a sum follows the tip-to-tail rule, and for v=0 the multiple cv points along v when c>0 and against it when c<0, with ∣c∣ times the length. A point P is a location, while the displacement from P to Q is the vector Q−P, endpoint minus starting point, wherever its arrow is drawn. A data vector lists measurements in a fixed order, and a sum of two data vectors means something only when matching positions hold the same quantity in the same unit.
A linear combination of v1,…,vk is a1v1+⋯+akvk with real coefficients, and span{v1,…,vk} is the set of all of them. It always contains 0. A vector b lies in the span exactly when the system x1v1+⋯+xkvk=b has a solution. A generator that is a combination of the others is redundant, and removing it leaves the span unchanged.
For example a(1,0,1)+b(0,1,1)=(a,b,a+b), so these two vectors span the plane z=x+y in R3. The vector (2,−1,1) equals 2(1,0,1)−(0,1,1), while (2,−1,0) is not in the span, because its third entry is not the sum of the first two.
A map T from Rn to Rm is linear when, for all u and v in Rn and every real c,
T(u+v)=T(u)+T(v),T(cu)=cT(u).
These are additivity and homogeneity, and together they say that T keeps every linear combination, T(au+bv)=aT(u)+bT(v). Every linear map has T(0)=0, but a map that fixes 0 need not be linear.
Standard matrix. A linear T is multiplication by exactly one m×n matrix, the one whose columns are the images of the standard unit vectors,
A=[T(e1)⋯T(en)],T(x)=Ax.
Conversely every map x↦Ax is linear. Two linear maps that agree on e1,…,en agree everywhere.
The shear H(x,y)=(x+y,y) has H(e1)=(1,0) and H(e2)=(1,1), which are the columns of its matrix. A translation x↦x+b with b=0 is not linear, since it moves 0. The map G(x,y)=(x2,y) fixes 0 and is still not linear, because G(2,0)=(4,0) while 2G(1,0)=(2,0). One failed identity proves that a map is not linear, and no number of successful spot checks proves that it is.
If A is m×n and B is n×p with columns b1,…,bp, then AB is the m×p matrix
AB=[Ab1⋯Abp],(AB)ij=k=1∑naikbkj.
It is defined only when A has as many columns as B has rows. It is the matrix of the composition that applies B first and then A, so (AB)x=A(Bx).
Rule
Statement
Condition
Associativity
(AB)C=A(BC)
compatible sizes
Distributivity
A(B+C)=AB+AC and (A+B)C=AC+BC
compatible sizes
Identity
ImA=A=AIn
A is m×n
Transpose of a product
(AB)⊤=B⊤A⊤
AB defined, and the order reverses
Order
AB=BA in general
BA may be undefined or of another size
Block multiplication. When the column groups of A match the row groups of B, the product can be formed block by block, with block (i,j) of AB equal to ∑kAikBkj. Each block product keeps its order.
For the shear matrix H above and D=diag(2,1),
DH=[2021],HD=[2011],
so shearing first and then stretching sends e2 to (2,1), while stretching first sends it to (1,1).
A linear system asks for every input that satisfies several linear equations at once. Row operations simplify a system without changing its solutions, and pivots and free variables then describe all of them. A square matrix with a pivot in every column has an inverse, and the LU factorization stores elimination so that it can be reused for new right-hand sides.
Linear systems and their two pictures
A system of m linear equations in n unknowns is one matrix equation Ax=b, with an m×n coefficient matrix A, unknowns x in Rn and right-hand side b in Rm. Its augmented matrix is [A∣b].
Row picture. Each equation describes the set of points of Rn that satisfy it, which is a line, plane or hyperplane when its coefficients are not all zero. The solution set is the intersection of all these sets.
Column picture. The system asks for weights with x1a1+⋯+xnan=b, so it is consistent exactly when b lies in the span of the columns.
Every linear system has no solution, exactly one, or infinitely many, because if p=q are solutions, so is every p+t(q−p). A square coefficient matrix does not by itself guarantee one solution, and more equations than unknowns do not rule out infinitely many.
For example x+y=3 and x−y=1 meet at (2,1), and in the column picture 2(1,1)+1(1,−1)=(3,1). The pair x+y=2 and 2x+2y=4 has the whole line of solutions (t,2−t), and the pair x+y=2 and 2x+2y=5 has none.
Each operation acts on whole rows of [A∣b], constants included, and can be undone, so row equivalent augmented matrices have the same solution set. Applying an operation to Im gives an elementary matrix E, and EA performs that operation on A. Operations E1,…,Ek applied in that order give Ek⋯E1A.
A matrix is in row echelon form when its zero rows are at the bottom, each leading entry lies strictly to the right of the leading entry above it, and every entry below a leading entry is zero. Its leading entries are the pivots. Gaussian elimination reaches an echelon form column by column, swapping in a nonzero pivot when needed and clearing the entries below it. Back-substitution then solves from the last equation upward.
For x+y+z=6, 2x+3y+z=11 and x+2y+3z=14, the augmented matrix
12113211361114
becomes, after R2→R2−2R1 and R3→R3−R1 and then R3→R3−R2,
1001101−136−19.
Back-substitution gives z=3, then y=−1+z=2, then x=6−y−z=1, and (1,2,3) satisfies all three original equations.
The pivot columns of A are the columns that hold pivots in an echelon form, and the unknowns of the other columns are free variables. The reduced row echelon form also has every pivot equal to 1 and zeros above each pivot, and every matrix has exactly one.
Echelon form of [A∣b]
Solutions
a row [0⋯0∣c] with c=0
none
no such row, every column of A a pivot column
exactly one
no such row, some column of A without a pivot
infinitely many, one parameter for each free variable
A consistent system with n unknowns and r pivots has k=n−r free variables. Every solution is one particular solution xp plus a solution of the homogeneous system Ax=0. Setting each free variable equal to its own parameter and solving for the pivot variables gives the complete solution family
x=xp+t1v1+⋯+tkvk,
with one real parameter ti for each free variable and fixed vectors vi that satisfy Avi=0. For the 2×3 matrix A and b=(4,3), the third unknown is free, and setting x3=t gives
x=430+t−1−11,t∈R.
Coefficient parameters. A letter among the coefficients selects a system, while a free variable selects a solution within one system. Dividing by an expression in the parameter is valid only where it is nonzero, so each value where it vanishes is solved again from the equations before the division. For
[111a]x=[23],
the replacement R2→R2−R1 leaves (a−1)x2=1. For a=1 the unique solution is
x1=a−12a−3,x2=a−11.
For a=1 the row reads 0=1 and there is no solution. Check every answer in the original equations, with the parameter kept as a letter.
An n×n matrix A is invertible when some n×n matrix A−1 satisfies A−1A=I and AA−1=I. The inverse is unique, and a square matrix without one is singular. For an n×n matrix A the following statements are equivalent.
The matrix A has n pivots.
The system Ax=b has exactly one solution for every b in Rn, namely x=A−1b.
The only solution of Ax=0 is x=0.
The matrix A is invertible.
Rule
Condition
(AB)−1=B−1A−1
A and B invertible of the same size
(A⊤)−1=(A−1)⊤
A invertible
(cA)−1=c1A−1
A invertible and c=0
For a 2×2 matrix with ad−bc=0,
[acbd]−1=ad−bc1[d−c−ba].
Computing an inverse. Row reduce [A∣I]. If the left block becomes I, the right block is A−1, and if an echelon form of A has fewer than n pivots, then A is singular. To solve a single system, eliminating on [A∣b] takes less work than forming A−1.
For example
[2413]−1=21[3−4−12],
and this inverse sends (5,11) to (2,1), the solution of the system with right-hand side (5,11).
Suppose Gaussian elimination reduces a square matrix A to an upper triangular U without row swaps, working through the columns from left to right and applying Ri→Ri−ℓijRj to each row i>j in column j. Then
A=LU,
where L is unit lower triangular, with ones on the diagonal and the multiplier ℓij in position (i,j). To solve Ax=b, solve Lw=b by forward substitution and then Ux=w by back-substitution. The factors are computed once and reused for every new right-hand side.
When a zero or small pivot calls for row swaps, the factorization reads PA=LU with a permutation matrix P, the identity with its rows reordered, which satisfies P−1=P⊤. Then solve Lw=Pb and Ux=w. The swaps reorder equations, never unknowns, and a swap made after some multipliers are stored moves those multipliers with their rows. Partial pivoting takes as pivot an entry of largest absolute value in the current column, on or below the current row, so every multiplier has absolute value at most 1. A zero in a pivot position does not by itself make A singular.
For example
[2413]=[1201][2011]
with the multiplier ℓ21=2. For b=(5,11), forward substitution gives w=(5,1) and back-substitution gives x=(2,1), and the same factors solve the system with b=(1,1), giving (1,−1).
A subspace is a set of vectors that contains 0 and is closed under addition and scaling. Linear independence makes coefficients unique, a basis is an independent list that spans, and the dimension counts the vectors in any basis. Every matrix has four fundamental subspaces, and elimination finds a basis of each.
Subspaces
A subset W of Rn is a subspace when
it contains 0,
the sum u+v lies in W for all u and v in W, and
the multiple cu lies in W for every u in W and every real c.
A nonempty subset that is closed under both operations already contains 0=0u. To prove that a set is a subspace, check these conditions for arbitrary members, and to prove that it is not, give one failure.
Set
Subspace
Reason
span{v1,…,vk}
yes
sums and multiples of combinations are combinations
solutions of Ax=0
yes
A(u+cv)=Au+cAv
solutions of Ax=b with b=0
no
0 is not a solution
U∩V and U+V={u+v∣u∈U,v∈V}
yes, for subspaces U and V
closure holds in each piece
U∪V
only when U⊆V or V⊆U
a sum can leave the union
A translate p+W of a subspace is an affine set, and it is a subspace only when p lies in W. The solution set of a consistent system Ax=b is the affine set xp+{x∣Ax=0}.
The plane z=x+y is a subspace of R3, and the parallel plane z=x+y+1 is not, since it misses 0. The union of the two coordinate axes of R2 is not a subspace, because (1,0)+(0,1) leaves it. For U=span{e1,e2} and V=span{e1,e3} in R3, the intersection is span{e1} and the sum is R3.
and dependent otherwise. A combination with coefficients not all zero that equals 0 is a dependence relation.
An independent list gives unique coefficients. Every vector of its span is a combination of the list in exactly one way.
A list of two or more vectors is dependent exactly when one of its vectors is a combination of the others.
A list that contains 0 is dependent, and two vectors are dependent exactly when one is a multiple of the other.
More than n vectors in Rn are always dependent.
Test by elimination. Put the vectors in the columns of a matrix and row reduce. They are independent exactly when every column has a pivot. A column without a pivot gives a free variable, and setting it to 1 produces a dependence relation.
The vectors (1,0,1), (0,1,1) and (1,1,2) are dependent, with the relation (1,0,1)+(0,1,1)−(1,1,2)=0, even though no two of them are parallel.
A basis of a subspace W is a list of vectors in W that is linearly independent and spans W, so every vector of W is a combination of the list in exactly one way. For an ordered basis B=(b1,…,bk), the coordinate vector [v]B=(c1,…,ck) lists the coefficients in v=c1b1+⋯+ckbk. It has one entry for each basis vector, and reordering the basis reorders the coordinates. The standard basis (e1,…,en) of Rn gives each vector its own entries as coordinates.
Dimension. All bases of W have the same number of vectors, dimW. In W an independent list has at most dimW vectors and a spanning list has at least dimW. The zero subspace has dimension 0, and a subspace of Rn has dimW≤n, with equality only for W=Rn.
Pruning and extending. Removing, one at a time, a vector that is a combination of the remaining ones shrinks a spanning list to a basis. Adding, one at a time, a vector that lies outside the current span grows an independent list to a basis.
Counting shortcut. A list of exactly dimW vectors in W is a basis as soon as it is independent, and also as soon as it spans.
With b1=(1,0) and b2=(1,1), every (x,y) equals (x−y)b1+yb2, so (3,2) has coordinates (1,2) and (4,1) has coordinates (3,1). The plane z=x+y has dimension 2, with basis (1,0,1), (0,1,1), and adding e3, which lies off the plane, extends it to a basis of R3.
Let A be a real m×n matrix of rank r, the number of pivots in an echelon form. Its column space ColA is the span of the columns, which is the set of all Ax. Its row space RowA=ColA⊤ is the span of the rows, read as vectors of Rn. Its null space NullA is the solution set of Ax=0, and its left null space NullA⊤ is the solution set of A⊤y=0.
Subspace
Ambient space
Dimension
Basis by elimination
ColA
Rm
r
the pivot columns of A itself
RowA
Rn
r
the nonzero rows of an echelon form
NullA
Rn
n−r
one solution for each free variable
NullA⊤
Rm
m−r
the same method applied to A⊤
Row operations keep the row space and the null space but usually change the column space, so a basis of ColA uses the pivot columns of the original matrix. The rank satisfies rankA=dimColA=dimRowA, so rankA⊤=rankA≤min(m,n). The system Ax=b is consistent exactly when b lies in ColA. A matrix of rank r≥1 has a rank factorizationA=CR, with C the m×r matrix of pivot columns and R the r nonzero rows of the reduced row echelon form.
The matrix
M=123246101
has reduced row echelon form with nonzero rows (1,2,0) and (0,0,1), so its rank is 2 and columns 1 and 3 are the pivot columns.
The column space has basis (1,2,3), (1,0,1), taken from M itself.
This unit studies linear maps apart from any one matrix. When the input space is finite-dimensional, the dimensions of the kernel and the image add up to its dimension. A fixed vector gets new coordinates in a new basis, a fixed map gets a new matrix, and polynomials and matrices become vectors with coordinates of their own.
Kernel, image and rank-nullity
For a linear map T:V→W, the kernel kerT is the set of v in V with T(v)=0, a subspace of V, and the image imT is the set of all outputs T(v), a subspace of W. For T(x)=Ax they are NullA and ColA. When V is finite-dimensional, the rank-nullity theorem says
dimkerT+rankT=dimV,
where rankT=dimimT. For an m×n matrix this reads dimNullA+rankA=n.
Property
Test
Possible only when
Injective, one-to-one
kerT={0}, equivalently rankT=dimV
dimV≤dimW
Surjective, onto
imT=W, equivalently rankT=dimW
dimV≥dimW
Bijective
both tests
dimV=dimW, and then either test implies the other
The table assumes V and W finite-dimensional. The fiber over b, the set of inputs with T(x)=b, is either empty or a translated kernel xp+kerT. For linear maps T:U→V and S:V→W, the composition satisfies kerT⊆ker(S∘T) and rank(S∘T)≤min(rankS,rankT), so a later map cannot restore a direction that an earlier one lost.
The 2×3 matrix A has rank 2 and nullity 1, and 2+1=3. No linear map from R4 to R2 is injective, since its rank is at most 2 and so its nullity is at least 2.
Let B=(b1,…,bn) be an ordered basis of Rn with basis matrix B=[b1⋯bn], which is invertible. Then
v=B[v]B,[v]B=B−1v,
and in practice [v]B is found by solving Bc=v. For a second ordered basis C with basis matrix C, the change-of-basis matrix from B to C is
PC←B=C−1B,[v]C=PC←B[v]B.
Its column j is [bj]C, its inverse is PB←C=B−1C, and conversions chain as PD←CPC←B=PD←B. A change of coordinates is passive. The vector stays where it is and only its description changes, while applying a matrix as a map is active and can move the vector. A coordinate list means something only together with the name of its basis.
Take B=((1,0),(1,1)) and C=((1,1),(1,−1)). Then
PC←B=C−1B=21[1120],
and the vector v=(3,2), with [v]B=(1,2), has [v]C=(25,21). Rebuilding gives 25(1,1)+21(1,−1)=(3,2).
For a linear map T:V→W between finite-dimensional spaces, with an ordered basis B=(v1,…,vn) of V and an ordered basis C of W, the matrix of T has the output coordinates of the input basis vectors as columns,
[T]C←B=[[T(v1)]C⋯[T(vn)]C].
It is the only matrix with [T(v)]C=[T]C←B[v]B for every v in V. For a map from Rn to Rm with standard matrix A and basis matrices B and C,
[T]C←B=C−1AB.
A linear operator maps a space to itself and uses one basis on both sides, so [T]B=B−1AB, or equivalently B[T]B=AB, which says that the two routes around the commutative diagram agree.
Similar matrices. Square matrices A and A′ are similar when A′=P−1AP for an invertible P. The matrices of one operator in two bases are similar, and similar matrices share rank, determinant, trace, characteristic polynomial and eigenvalues. Passing from A to C−1AB, with unrelated input and output bases, is more general and is not called similarity. Changing the basis can change the entries, but never the operator, its kernel or its image.
For A=diag(2,1) and the basis B=((1,0),(1,1)),
[T]B=B−1AB=[2011].
The vector (3,2) has B-coordinates (1,2), this matrix sends them to (4,2), and 4(1,0)+2(1,1)=(6,2) is exactly A times (3,2).
A real vector space is a set V with an addition and a multiplication by real scalars that stay in V and obey the usual laws. Addition is commutative and associative, there is a zero vector, every vector has an additive inverse, a(bu)=(ab)u and 1u=u, and both distributive laws hold. Subspaces, spans, independence, bases, dimension, kernels and images carry over unchanged.
Space
Vectors
Standard ordered basis
Dimension
Rn
columns of n real numbers
e1,…,en
n
P2
polynomials a0+a1t+a2t2
1,t,t2
3
Pn
polynomials of degree at most n
1,t,…,tn
n+1
M2×2
real 2×2 matrices
E11,E12,E21,E22
4
Mm×n
real m×n matrices
the matrix units Eij
mn
Here Eij has a 1 in row i and column j and zeros elsewhere. Coordinates in these bases are the coefficients or the entries, so in the basis S=(1,t,t2) the polynomial 2+3t−t2 has coordinates (2,3,−1). Polynomials of degree exactly 2 do not form a vector space, since the zero polynomial is missing and a sum can drop the degree. The degree of a polynomial, the shape of its graph and the dimension of the space it lives in are three different things.
A linear map on a finite-dimensional space is determined by the images of a basis, and any choice of images in the target space, repeats allowed, gives exactly one linear map. Its matrix in chosen bases is built column by column as above, and kernel, image and rank-nullity are computed through coordinates. To verify a proposed basis of a subspace H, check that each vector lies in H, that the list is independent and that it spans H, or replace the last check by a dimension count when dimH is known.
Evaluation. For sample points s1,…,sk, the map E(p)=(p(s1),…,p(sk)) from P2 to Rk is linear. With E(p)=(p(0),p(1)), the basis (1,t,t2) and the standard basis of R2, its matrix is
[110101],
so E(2+3t−t2)=(2,4), the kernel is span{t2−t}, the image is R2, and 1+2=3=dimP2. For any two distinct sample points s1=s2 the kernel is spanned by (t−s1)(t−s2).
Trace. The trace trX=x11+⋯+xnn is a linear map from Mn×n to R. On M2×2, in the basis (E11,E12,E21,E22), it has the 1×4 matrix [1001], rank 1 and a kernel of dimension 3 with basis E12, E21, E11−E22.
The determinant of a square matrix is the signed factor by which its map scales area or volume. Its sign records orientation, it is zero exactly when the columns are dependent, and the determinant of a product is the product of the determinants. Row operations compute it efficiently, and Cramer’s rule uses it to solve small square systems.
Determinants as oriented area and volume
For a real 2×2 matrix,
det[acbd]=ad−bc,
the oriented area of the parallelogram spanned by the ordered columns, positive when the counterclockwise angle from the first column to the second lies strictly between 0 and π. For a 3×3 matrix it is the oriented volume of the parallelepiped spanned by the columns, positive for a right-handed triple. Only square matrices have determinants.
Volume scale factor. The map x↦Ax multiplies every area in the plane, or every volume in space, by ∣detA∣, and in Rn it scales n-dimensional volume by the same factor.
Orientation. An invertible map keeps orientation when detA>0 and reverses it when detA<0.
Collapse. The determinant is 0 exactly when the columns are linearly dependent, and then the map flattens space into a subspace of lower dimension.
The matrix with columns (2,0) and (1,3) has determinant 6, so it multiplies areas by 6 and keeps orientation. Swapping its columns gives −6, the same area with the orientation reversed. The matrix diag(2,3,−1) has determinant −6 and volume scale factor 6, and the columns (1,2) and (2,4) give determinant 0.
Since detA⊤=detA, the same rules hold for columns. The determinant of a triangular matrix is the product of its diagonal entries, so reducing A to an upper triangular U with s swaps and some replacements, and no scalings, gives
detA=(−1)su11u22⋯unn.
Cofactor expansion. Let the minor Mij be the determinant of A with row i and column j deleted, and the cofactor be Cij=(−1)i+jMij. Expansion along any row i or any column j gives
detA=k=1∑naikCik=k=1∑nakjCkj.
The signs follow a checkerboard that starts with + in the top left corner. Expansion pays off along a row or column with many zeros.
Rule
Condition
det(AB)=detAdetB
A and B both n×n
det(A−1)=detA1
A invertible
det(cA)=cndetA
A is n×n
linear in each column when the other columns are fixed
in general det(A+B)=detA+detB
two equal columns or rows give 0
square A
The matrix
M=120251013⟶100210012
is reduced by R2→R2−2R1 and then R3→R3−R2, two replacements, so detM=1⋅1⋅2=2. Expansion along the first row agrees, 1(15−1)−2(6−0)+0=2.
For a real n×n matrix A the following statements are equivalent.
The determinant detA is not zero.
The matrix A is invertible, with n pivots and rank n.
The null space is {0}, and the columns form a basis of Rn.
Every system Ax=b with b in Rn has exactly one solution.
The number 0 is not an eigenvalue of A.
When detA=0, a square system has either no solution or infinitely many, and the determinant cannot tell which, since it does not depend on b. Row reduction of [A∣b] decides. Rectangular matrices have no determinant and are studied with rank.
Cramer’s rule. Let detA=0 and let Ai be A with column i replaced by b. The unique solution of Ax=b is
xi=detAdetAi,i=1,…,n.
It suits small or symbolic systems. For larger systems it costs far more than elimination or an LU factorization, and elimination also handles singular systems.
For x+y=3 and 2x−y=0 the determinants are detA=−3, detA1=−3 and detA2=−6, so x=1 and y=2.
Inner products bring length, angle and perpendicularity into linear algebra. Projection finds the closest vector on a line or in a subspace, orthogonal complements pair up the four fundamental subspaces, and the Gram-Schmidt process turns independent vectors into orthonormal ones, recorded as a QR factorization.
Dot product, length and angle
Quantity
Formula
Condition
Dot product
x⋅y=x⊤y=x1y1+⋯+xnyn
same number of entries
Length
∥x∥=x⋅x
zero only for x=0
Unit vector
∥x∥x
x=0
Distance
∥x−y∥
any x and y in Rn
Orthogonal
x⋅y=0
0 is orthogonal to every vector
Angle
cosθ=∥x∥∥y∥x⋅y with 0≤θ≤π
x and y nonzero
The rules ∥cx∥=∣c∣∥x∥ and
∥x−y∥2=∥x∥2+∥y∥2−2x⋅y
hold for all vectors, so orthogonality is the Pythagorean condition. The vectors (1,2) and (2,−1) are orthogonal and both have length 5. The distance between (1,2) and (4,6) is the length of (3,4), which is 5. The angle between (1,1,0) and (1,0,1) has cosine 221=21, so it is 3π.
These are symmetry, linearity in the first argument and positive definiteness. The norm is ∥v∥=⟨v,v⟩, and distance, orthogonality and angle are defined from the inner product as for the dot product. On Rn the weighted inner product ⟨x,y⟩G=x⊤Gy with G=diag(w1,…,wn) needs every weight wi>0. More generally x⊤Gy is an inner product exactly when G is symmetric and positive definite. For all vectors in a real inner product space,
∣⟨u,v⟩∣≤∥u∥∥v∥,∥u+v∥≤∥u∥+∥v∥.
The first is the Cauchy-Schwarz inequality. It is an equality exactly when u and v are linearly dependent, and it puts the cosine of every angle in [−1,1]. The second is the triangle inequality, an equality exactly when one vector is a nonnegative multiple of the other.
With G=diag(4,1), the vectors (1,1) and (1,−1), which are perpendicular for the dot product, have inner product 4−1=3 and norms 5, so their angle has cosine 53. Length and angle depend on the inner product chosen. The weights 1 and −1 do not give an inner product, since (0,1) would have ⟨v,v⟩=−1.
A list is orthogonal when its vectors are pairwise orthogonal, and orthonormal when in addition each vector has norm 1. An orthogonal list of nonzero vectors is linearly independent. In an orthonormal basis (q1,…,qn) the coordinates are inner products,
v=⟨q1,v⟩q1+⋯+⟨qn,v⟩qn.
Projection onto a line. For u=0 and the line L=span{u},
projLb=u⋅uu⋅bu.
The scalar in front is the projection coefficient. It changes when u is rescaled, while the projected vector depends only on the line. The residual r=b−projLb is orthogonal to u, the lengths satisfy ∥b∥2=∥projLb∥2+∥r∥2, and the projection is the unique point of L closest to b, at distance ∥r∥.
Orthogonal matrix. A real n×n matrix Q is orthogonal when its columns form an orthonormal basis of Rn, that is, when Q⊤Q=I. Then Q−1=Q⊤, also QQ⊤=I, and Q preserves dot products and lengths. An m×n matrix with orthonormal columns and m>n still has Q⊤Q=In, but QQ⊤=Im.
Projecting b=(3,1) onto the line through u=(1,2) gives the coefficient 55=1, the projection (1,2) and the residual (2,−1), which is orthogonal to u. In the orthonormal basis 21(1,1), 21(1,−1) the same b has coordinates (22,2).
For a subspace W of Rn, the orthogonal complement W⊥ is the set of vectors of Rn orthogonal to every vector of W, and it is enough to test a spanning list of W. Then W∩W⊥={0},
dimW+dimW⊥=n,(W⊥)⊥=W,
and every vector of Rn splits in exactly one way as w+z with w in W and z in W⊥, written Rn=W⊕W⊥. For a real m×n matrix A, each entry of Ax is a row of A dotted with x, which gives
NullANullA⊤=(RowA)⊥ in Rn,=(ColA)⊥ in Rm.
So Rn=RowA⊕NullA and Rm=ColA⊕NullA⊤, and Ax=b has a solution exactly when b is orthogonal to every vector of NullA⊤. Orthogonality is taken inside one space, never between an input in Rn and an output in Rm.
The columns (1,0,1) and (0,1,1) of A⊤ span the plane z=x+y, whose orthogonal complement is the line through n=(−1,−1,1). The vector (1,−1,0) is orthogonal to the sum (1,1,2) of the two columns but to neither column, so it is not in that complement.
The orthogonal projection of b in Rm onto a subspace W of Rm is the unique p in W with b−p in W⊥. It is the closest vector of W to b, since ∥b−y∥2=∥b−p∥2+∥p−y∥2 for every y in W. If the columns of an m×k matrix C form a basis of W, then p=Cx^, where x^ solves the normal equations, and p=Pb with the projection matrix P,
C⊤Cx^=C⊤b,P=C(C⊤C)−1C⊤.
The k×k matrix C⊤C is invertible because the columns are independent.
Description of W
Projection
Condition
orthonormal columns of Q
P=QQ⊤, so p=∑i(qi⋅b)qi
Q⊤Q=I
orthogonal basis w1,…,wk
p=∑iwi⋅wiwi⋅bwi
nonzero and pairwise orthogonal
any basis, the columns of C
P=C(C⊤C)−1C⊤
independent columns
plane n⋅x=0
p=b−n⋅nb⋅nn
n=0
Every orthogonal projection matrix satisfies P2=P and P⊤=P, and conversely a real square matrix with both properties is the orthogonal projection onto its column space. The projection depends only on W, not on the basis. For a basis that is not orthogonal, adding the line projections onto the basis vectors does not give the projection in general.
For C with columns (1,0,1) and (0,1,1) and b=(1,1,0), the normal equations read
[2112]x^=[11],
so x^=(31,31), the projection is p=(31,31,32), and the residual (32,32,−32) is orthogonal to both columns.
For linearly independent a1,…,an in Rm, the Gram-Schmidt process sets, for j=1,…,n in turn,
ujqj=aj−i=1∑j−1(qi⋅aj)qi,=∥uj∥uj.
Each remainder uj is nonzero and orthogonal to the earlier qi, the vectors qj are orthonormal, and for every j the first j of them span the same subspace as a1,…,aj. For a dependent list, a zero remainder appears exactly when aj is a combination of the earlier vectors, and it cannot be normalized. Normalizing changes lengths only, so it never makes vectors orthogonal by itself.
Reduced QR factorization. An m×n matrix A with independent columns factors as A=QR, where the m×n matrix Q has the orthonormal columns qj and R=Q⊤A is n×n upper triangular, with rij=qi⋅aj for i<j and rjj=∥uj∥>0. With a positive diagonal the factors are unique. In floating-point arithmetic this direct form of the process can lose orthogonality, so a tiny computed remainder needs care.
For a1=(1,0,1) and a2=(0,1,1), the first step gives q1=21(1,0,1). Then q1⋅a2=21, the remainder is u2=(−21,1,21) with length 26, and q2=61(−1,2,1), so
When a system has no exact solution, least squares picks the inputs whose output comes closest to the data. The closest output is the projection of the data onto the column space, found with the normal equations or with QR. Fitted values are always unique while coefficients may not be, and conditioning measures how far small changes in the data can move a solution.
Least-squares solutions and the normal equations
For a real m×n matrix A and b in Rm, a least-squares solution x^ minimizes ∥b−Ax∥2 over all x in Rn. Least-squares solutions always exist, and they are exactly the solutions of the normal equations
A⊤Ax^=A⊤b,
which say that the residual r=b−Ax^ is orthogonal to every column, A⊤r=0.
Object
Unique
Description
fitted vector Ax^
always
the projection of b onto ColA
residual r
always
the component of b in (ColA)⊥
coefficients x^
exactly when rankA=n
then x^=(A⊤A)−1A⊤b
When the columns are dependent, the least-squares solutions are x^+h with h in NullA, and all give the same fitted vector. When b lies in ColA, they are the ordinary solutions. If A⊤r=0, then every x satisfies
A model f(t)=c1φ1(t)+⋯+cnφn(t) with known functions φj is linear in its coefficients, even when the φj are not linear in t, so fitting it is a linear algebra problem. For data points (t1,y1),…,(tm,ym) it uses the m×n design matrix X with entries Xij=φj(ti) and the observation vector y=(y1,…,ym), and least squares minimizes the sum of squared vertical residuals
i=1∑m(yi−(Xc)i)2=∥y−Xc∥2.
For a line y=a+bt row i of X is [1ti], and the line is unique as soon as two of the ti differ. When X has a column of ones, the least-squares residuals add up to 0. The residuals are vertical in the scatter plot, and the right angle appears in observation space Rm, between the residual vector and ColX. A model such as c1ec2t is not linear in c2, and proportional design columns leave the fitted values unique but the coefficients not.
For the points (0,1), (1,2), (2,2),
X⊤X=[3335],X⊤y=[56],
so a=67 and b=21. The fitted values are (67,35,613), the residuals (−61,31,−61) add up to 0, and the smallest sum of squared errors is 61. The best constant fit to the same outputs is their mean 35, with squared error 32.
Let X be an m×n matrix with independent columns and reduced QR factorization X=QR. The unique least-squares solution solves the triangular system
Rc^=Q⊤y
by back-substitution, without forming X⊤X. The entries of Q⊤y are the coordinates of the fitted vector QQ⊤y in the orthonormal basis of ColX, not the model coefficients. For every c in Rn,
∥Xc−y∥2=∥Rc−Q⊤y∥2+∥(I−QQ⊤)y∥2,
so the smallest squared error is ∥(I−QQ⊤)y∥2=∥y∥2−∥Q⊤y∥2, the squared length of the part of y outside the model space. The triangular equation finds the best coefficients and does not claim that Xc=y holds exactly.
For the line fit above,
Q=313131−21021,R=[3032],
and Q⊤y=(35,21). Back-substitution gives b=21 and then a=67 again, and 9−325−21=61 is the same squared error.
The induced norm ∥A∥2=max∥u∥=1∥Au∥ is the largest stretch of A, and ∥Av∥≤∥A∥2∥v∥ for every v. For an invertible n×n matrix with largest and smallest singular values σ1 and σn, the condition number is
κ2(A)=∥A∥2∥A−1∥2=σnσ1≥1,
the ratio of the largest to the smallest stretch, with κ2(cA)=κ2(A) for c=0. If Ax=b with b=0 and the data change to b+δb with A fixed, the solution changes by δx=A−1δb and
∥x∥∥δx∥≤κ2(A)∥b∥∥δb∥.
When b=0, use the absolute bound ∥δx∥≤∥A−1∥2∥δb∥ instead. The same bounds relate the error x−x^ of an approximate solution to its residual b−Ax^, so a small relative residual guarantees a small relative error only when κ2(A) is moderate.
Ill-conditioned means that κ2(A) is large, so that some small relative changes in the data cause much larger relative changes in the solution. There is no fixed cutoff, since whether κ2(A) counts as large depends on how accurate the data are. A small determinant is not the test, since 0.001I has a tiny determinant and condition number 1.
Conditioning versus stability. Conditioning belongs to the problem and stability to the algorithm. Pivoting and guard digits help an algorithm, but nothing lowers the condition number of the problem itself.
Normal equations. For X of full column rank, forming X⊤X squares the ratio σ1/σn, while QR keeps it, so QR is the safer route in floating point.
The system
[1111.01]x=[22.01]
has the solution (1,1). Changing 2.01 to 2.02, a relative change of about 0.35 percent in b, moves the solution to (0,2), a relative change of 100 percent. Here κ2(A)≈402.
Fix the error criterion before calculating, because each criterion asks a different question and needs its own check.
Question
Criterion
Solve and check
exact solve
Ax=b, possible when b lies in ColA
elimination, then a residual of exactly 0
projection onto W
minimize ∥b−p∥ over p in W
normal equations, then p in W and b−p in W⊥
least-squares fit
minimize ∥y−Xc∥2
normal equations or QR, then X⊤r=0 and the rank of X
weighted fit
minimize ∑iwiri2 with every wi>0
scale row i of X and yi by wi, then ordinary least squares
Membership and orthogonality are needed together, since every point of W passes the first test and every point of b+W⊥ passes the second. Projecting (1,0,0) onto the plane x+y+z=0 removes 31(1,1,1) and leaves (32,−31,−31), which passes both.
An eigenvector of a square matrix is a nonzero vector that the matrix sends to a multiple of itself. The characteristic polynomial gives the eigenvalues and elimination gives the eigenspaces. A matrix can be diagonalized exactly when it has enough independent eigenvectors for a basis, and complex numbers supply the eigenvalues that real matrices such as rotations lack.
Eigenvalues and eigenvectors
Let A be a real n×n matrix. A nonzero vector v is an eigenvector with eigenvalue λ when
Av=λv.
The eigenspace Eλ=Null(A−λI) holds 0 and all eigenvectors for λ, and every nonzero multiple of an eigenvector is again one. The line through an eigenvector is invariant. Along it the map keeps the direction when λ>0, reverses it when λ<0, and collapses the line to 0 when λ=0, with length factor ∣λ∣.
The number 0 is an eigenvalue exactly when A is singular. The zero vector is never an eigenvector.
Eigenvectors for distinct eigenvalues are linearly independent, so A has at most n distinct eigenvalues.
If Av=λv, then Akv=λkv for every integer k≥0, and A−1v=λ−1v when A is invertible.
For
S=[2112],
the vector (1,1) goes to (3,3), so it is an eigenvector with eigenvalue 3, and (1,−1) is fixed, with eigenvalue 1. The vector e1 goes to (2,1), which is not a multiple of e1.
The characteristic polynomial χA(t)=det(tI−A) of an n×n matrix has degree n and leading coefficient 1. Its real roots are exactly the real eigenvalues of A, and once complex scalars are allowed every root is an eigenvalue. For a 2×2 matrix,
χA(t)=t2−(trA)t+detA.
To find the eigenspace of a root λ, row reduce A−λI and write the general solution of (A−λI)v=0 with one basis vector for each free variable. A root only guarantees that some nonzero solution exists, and an eigenspace of dimension 2 or more needs a full basis, not one eigenvector.
Fact
Condition
the eigenvalues are the diagonal entries
A triangular
the eigenvalues add up to trA and multiply to detA
counted with algebraic multiplicity, complex ones included
A and P−1AP have the same characteristic polynomial and eigenvalues
P invertible
The matrix
M=[4213]
has χM(t)=t2−7t+10=(t−5)(t−2). Solving (M−5I)v=0 gives E5=span{(1,1)}, and solving (M−2I)v=0 gives E2=span{(−1,2)}. The checks 5+2=7=trM and 5⋅2=10=detM pass.
For an eigenvalue λ of an n×n matrix A, the algebraic multiplicity am(λ) is the number of times the factor t−λ occurs in χA, and the geometric multiplicity is
gm(λ)=dimEλ=n−rank(A−λI).
Always 1≤gm(λ)≤am(λ). A matrix with gm(λ)<am(λ) for some eigenvalue is defective, and it has fewer than n independent eigenvectors. Only a repeated eigenvalue can be deficient, since a simple root has both multiplicities equal to 1. In the table, J is the matrix with rows (2,1) and (0,2).
Matrix
χA(t)
Eigenvalue 2
Defective
diag(2,2,3)
(t−2)2(t−3)
am 2, gm 2, E2=span{e1,e2}
no
J
(t−2)2
am 2, gm 1, E2=span{e1}
yes
2I in R2
(t−2)2
am 2, gm 2, E2=R2
no
A repeated root counts roots, not independent eigenvectors, so the eigenspace has to be computed.
A real n×n matrix A is diagonalizable over R when A=PDP−1 with P invertible and D diagonal, both real. This happens exactly when the columns of P are n independent eigenvectors, an eigenbasis, and the diagonal entries of D are their eigenvalues in the same order. Then D=P−1AP is the matrix of the map in the eigenbasis.
Test. The matrix is diagonalizable over R exactly when its real eigenspaces have dimensions adding up to n.
Sufficient condition. Having n distinct real eigenvalues is enough, but not necessary, as diag(2,2,3) shows.
Failures. A defective matrix is not diagonalizable over R or over C, and a real matrix whose characteristic polynomial has a nonreal root is not diagonalizable over R.
Powers. If A=PDP−1, where P has the eigenvectors v1,…,vn as columns and D=diag(λ1,…,λn), then for every integer k≥0
Ak=PDkP−1,Dk=diag(λ1k,…,λnk).
For a repeated update xk+1=Axk that starts at x0=c1v1+⋯+cnvn, where (c1,…,cn)=P−1x0,
xk=c1λ1kv1+⋯+cnλnkvn,
so a component with ci=0 grows when ∣λi∣>1, dies out when ∣λi∣<1, and alternates in sign when λi<0.
For the matrix S above, P=[111−1] and D=diag(3,1) give
Ske1=21[3k+13k−1],
which is (5,4) for k=2. The defective matrix J has no eigenbasis, so this method does not apply to it, and direct multiplication gives J2=[4044].
Over C every n×n matrix has n eigenvalues counted with algebraic multiplicity, because χA factors into linear factors, and their sum and product are trA and detA. Complex eigenvectors live in Cn, the space of columns of n complex numbers, and for a real matrix the eigenvectors of a nonreal eigenvalue are not arrows in Rn. A real matrix is diagonalizable over C when Cn has a basis of its eigenvectors, so a claim of diagonalizability should name the scalars.
Conjugate pairs. If A is real and Av=λv, then Av=λv. The nonreal eigenvalues of a real matrix come in conjugate pairs, so a real matrix of odd size has a real eigenvalue.
Rotation and scaling. For real a and b=0, the matrix [ab−ba] has no real eigenvalue, and it has the eigenvalues a+bi and a−bi with eigenvectors (1,−i) and (1,i) in that order. It is diagonalizable over C but not over R.
Conjugate transpose. The matrix A∗=A⊤ replaces the transpose for complex vectors. Inner products in Cn use ⟨x,y⟩=x∗y, and lengths use ∥v∥2=v∗v=∣v1∣2+⋯+∣vn∣2.
The quarter-turn R=[01−10] has χR(t)=t2+1 and no real eigenvector. Over C it has the eigenvalue i with eigenvector (1,−i), since R sends (1,−i) to (i,1)=i(1,−i), and the eigenvalue −i with eigenvector (1,i). For v=(1,i) the plain product v⊤v=1+i2 is 0, while v∗v=2.
A real symmetric matrix always has an orthonormal basis of eigenvectors, so it can be diagonalized by an orthogonal change of coordinates. In those coordinates a quadratic form has no cross terms, and the signs of the eigenvalues classify it. Each eigenvalue method comes with a hypothesis that decides whether it applies.
The spectral theorem
Real spectral theorem. Let A be a real symmetric n×n matrix, so A⊤=A. Then every eigenvalue of A is real, and there are a real orthogonal matrix Q and a real diagonal matrix D with
A=QDQ⊤=λ1q1q1⊤+⋯+λnqnqn⊤,
where the columns qi of Q are orthonormal eigenvectors and the λi are their eigenvalues. A real matrix is orthogonally diagonalizable in this way exactly when it is symmetric.
Eigenvectors of a symmetric matrix for distinct eigenvalues λ=μ are orthogonal, because λ(u⋅v)=(Au)⋅v=u⋅(Av)=μ(u⋅v).
Inside an eigenspace of dimension 2 or more, basis vectors need not be orthogonal, so apply Gram-Schmidt there.
Symmetry does not make the eigenvalues positive.
Method. Check that A⊤=A, find the eigenvalues, find an orthonormal basis of each eigenspace, and place the vectors in Q and their eigenvalues in D in matching order. No inverse is needed, since Q−1=Q⊤.
For the symmetric matrix S with rows (2,1) and (1,2),
A quadratic form on Rn is q(x)=x⊤Ax with A real symmetric, the matrix of the form. A cross term kxixj with i=j puts 2k in both positions (i,j) and (j,i), as in
ax2+2bxy+cy2=[xy][abbc][xy].
A form written as x⊤Mx with M not symmetric has the matrix 21(M+M⊤). With A=QDQ⊤ and new coordinates z=Q⊤x along the principal axes, the lines spanned by the qi,
q(x)=λ1z12+⋯+λnzn2.
For n=2 and two positive eigenvalues, the level curve q=1 is an ellipse with semi-axes λ11 along q1 and λ21 along q2.
The form 2x2+2xy+2y2 has matrix S, and with s=2x+y and t=2x−y it becomes 3s2+t2. Its level curve q=1 is an ellipse with semi-axis 31 along (1,1) and 1 along (1,−1).
A real symmetric matrix A, and its form q(x)=x⊤Ax, are classified by the signs that q takes, and the eigenvalues decide them.
Class
Condition on q
Eigenvalues
positive definite
q(x)>0 for every x=0
all >0
positive semidefinite
q(x)≥0 for every x
all ≥0
negative definite
q(x)<0 for every x=0
all <0
negative semidefinite
q(x)≤0 for every x
all ≤0
indefinite
q takes both signs
some >0 and some <0
The classes are inclusive, so a positive definite matrix is also positive semidefinite, and the zero matrix is both positive and negative semidefinite. A positive semidefinite matrix is positive definite exactly when it is invertible. For a symmetric 2×2 matrix, both eigenvalues are positive exactly when detA>0 and trA>0. For every real matrix C, the matrix C⊤C is positive semidefinite, and it is positive definite exactly when C has independent columns.
Positive entries do not make a matrix positive definite. The matrix [1221] has eigenvalues 3 and −1, and its form gives q(1,−1)=1−4+1=−2, so it is indefinite. Two vectors with values of opposite signs prove that a form is indefinite without any eigenvalue.
The matrix J with rows (2,1) and (0,2) has the single eigenvalue 2 with a one-dimensional eigenspace. It is defective and diagonalizable over neither R nor C.
The matrix [02−20] has the eigenvalues ±2i, no real eigenvector and a complex eigenbasis.
The symmetric matrix [3113] has the eigenvalues 4 and 2 with orthogonal eigenvectors (1,1) and (1,−1). It is positive definite and orthogonally diagonalizable, and its square sends e1 to (10,6).
Every real matrix, square or rectangular, has a singular value decomposition. It finds orthonormal input directions that the matrix sends to orthogonal outputs, which shows the rank, the four fundamental subspaces and the largest stretch at once. It also gives the pseudoinverse, the best approximations of lower rank and, for centered data, principal component analysis.
The singular value decomposition
Let A be a real m×n matrix and q=min(m,n). A singular value decomposition is
A=UΣV⊤,
with U an m×m orthogonal matrix, V an n×n orthogonal matrix and Σ an m×n matrix that is zero off the diagonal, with diagonal entries σ1≥σ2≥⋯≥σq≥0, the singular values. Every real matrix has one, and the singular values are determined by A. The columns vi of V are the right singular vectors, in the input space Rn, and the columns ui of U are the left singular vectors, in the output space Rm, paired by
Avi=σiui,A⊤ui=σivi,i=1,…,q.
The squares σ12,…,σq2 are the q largest eigenvalues of A⊤A, whose other eigenvalues, if any, are 0, and the positive ones are also the positive eigenvalues of AA⊤.
Quantity
Read from the SVD, with r positive singular values
rank
rankA=r
ColA and NullA⊤
spans of u1,…,ur and of ur+1,…,um
RowA and NullA
spans of v1,…,vr and of vr+1,…,vn
largest stretch
max∥x∥=1∥Ax∥=∥A∥2=σ1
condition number
κ2(A)=σ1/σn for invertible A
determinant
∣detA∣=σ1σ2⋯σn for square A
Singular values are in general not eigenvalues. They exist for every shape and are never negative. For a symmetric matrix they are the absolute values of the eigenvalues, so diag(−3,1) has eigenvalues −3 and 1 but singular values 3 and 1. The two lists agree exactly for the symmetric positive semidefinite matrices.
The 2×3 matrix A has singular values 3 and 1, with u1=21(1,1), u2=21(1,−1), v1=61(1,1,2), v2=21(1,−1,0) and v3=31(−1,−1,1). Then Av1=3u1, Av2=u2 and Av3=0, so the rank is 2 and v3 spans NullA.
Algorithm. Find the eigenvalues λ1≥⋯≥λn≥0 of the symmetric matrix A⊤A and an orthonormal basis of eigenvectors v1,…,vn in the same order. Set σi=λi for i≤q and, for each positive σi,
ui=σi1Avi.
These ui are automatically orthonormal. For a full SVD, complete them with an orthonormal basis of NullA⊤. When m<n it is quicker to start from AA⊤, which has the same positive eigenvalues with the same multiplicities, set vi=σi1A⊤ui, and complete the vi with an orthonormal basis of NullA. Compute the second vector of each pair from the first, never separately, since independent sign choices can break Avi=σiui.
Form
U
Σ
V
Singular values kept
Full
m×m
m×n
n×n
all q, padded with zero rows or columns
Economy
m×q
q×q
n×q
all q, zeros included
Compact
m×r
r×r
n×r
only the r positive ones
All three products equal A, the compact one when r≥1. The rectangular factors have orthonormal columns, so Ur⊤Ur=Ir, while UrUr⊤ is the orthogonal projection onto ColA and not the identity unless r=m. Books and software use the names reduced and thin for different forms, so check the sizes. A proposed full SVD is correct when the factors have the sizes of the full form, U⊤U=Im, V⊤V=In, Σ is zero off the diagonal, the σi are nonnegative and decreasing, Avi=σiui for i≤q and Avi=0 for q<i≤n. Singular vectors are not unique. A pair (ui,vi) can change sign together, and for a repeated positive singular value the right singular vectors can be any orthonormal basis of their subspace, with the partners computed from them.
The rank-one matrix
B=000200
has σ1=2 and σ2=0. A full SVD uses U=I3, V=[e2e1] and the 3×2 matrix Σ with diagonal entries 2 and 0. The economy form keeps the zero singular value in the 2×2 factor diag(2,0), while the compact form is B=2e1e2⊤, with e1 in R3 and e2 in R2.
For an SVD A=UΣV⊤ of rank r, the pseudoinverse of Σ is the n×m matrix Σ+ with diagonal entries σ11,…,σr1 followed by zeros, and the pseudoinverse of A is the n×m matrix
A+=VΣ+U⊤.
For r≥1 the compact SVD gives the same matrix, A+=VrΣr−1Ur⊤. For every b, the vector A+b is the least-squares solution of Ax=b of smallest norm, the unique one in RowA. When the system is consistent it is the minimum-norm solution x+, and every other solution adds a null-space component h, with ∥x++h∥2=∥x+∥2+∥h∥2.
Case
Pseudoinverse
A square and invertible
A+=A−1
full column rank, r=n
A+=(A⊤A)−1A⊤
full row rank, r=m
A+=A⊤(AA⊤)−1
every A
AA+ is the orthogonal projection onto ColA and A+A the one onto RowA
The pseudoinverse inverts only the positive singular values. It cannot recover a null-space component that the measurements never saw, and setting small positive singular values to zero is a different procedure, truncation, which needs its own stated criterion. The minimum norm is measured in the given units of the unknowns, so rescaling them can change the answer.
For the 2×3 matrix A, which has full row rank,
A+=312−11−121.
With b=(4,3) it gives x+=(35,32,37), the member t=37 of the solution family (4−t,3−t,t) and the only one orthogonal to (−1,−1,1). For the single equation x+y=2 the minimum-norm solution is (1,1).
The outer product of x in Rm and y in Rn is the m×n matrix xy⊤, with entries xiyj and (xy⊤)z=(y⋅z)x. For nonzero factors it has rank one, and every rank-one matrix has this form. An SVD writes a matrix of rank r as a sum of rank-one layers, and the truncated SVD keeps the first k,
A=i=1∑rσiuivi⊤,Ak=i=1∑kσiuivi⊤.
The Frobenius norm is the length of the list of all entries, and the spectral norm is the largest stretch,
∥A∥F∥A∥2=(i,j∑aij2)1/2=σ12+⋯+σr2,=σ1.
Eckart-Young theorem. For 0≤k<r and every m×n matrix B of rank at most k,
So Ak is a best approximation of rank at most k in both norms. For 1≤k<r it is the only best approximation in the Frobenius norm when σk>σk+1. When σk=σk+1, a tie at the cutoff, different choices of singular vectors give different truncations that are equally good. Storing Ak takes k(m+n+1) numbers instead of mn.
Put N>1 observations of p features in the rows x1⊤,…,xN⊤ of an N×p data matrix X, and let xˉ=N1(x1+⋯+xN) be the mean vector in Rp. The centered data matrix and the sample covariance matrix are
Xc=X−1xˉ⊤,C=N−11Xc⊤Xc,
where 1 is the vector of ones in RN. The p×p matrix C is symmetric and positive semidefinite, its diagonal holds the feature variances, and its trace is the total variance.
Projected variance. For a unit vector w the scores Xcw have sample variance w⊤Cw.
Principal components. Let C have eigenvalues λ1≥⋯≥λp≥0 with orthonormal eigenvectors w1,…,wp. The direction w1 maximizes the projected variance, which then equals λ1, and each wk does the same among unit vectors orthogonal to the earlier ones.
Retained variance. Keeping k directions retains λ1+⋯+λk of the total trC. With Wk=[w1⋯wk], the reconstructions xˉ+WkWk⊤(xi−xˉ) have total squared error (N−1)(λk+1+⋯+λp), the smallest possible for k directions through the mean.
Through the SVD. If Xc=UΣV⊤, the right singular vectors are principal directions, λi=N−1σi2, and the scores on the first k components are UkΣk.
Choices. Without centering, a large rank-one term along the mean can dominate. Measuring a feature in other units rescales its column, which can change C, its eigenvectors and their order. Standardizing every feature is one such rescaling, not an automatic correction. A large variance does not show that a direction matters for a given question.
The four observations (2,1), (2,−1), (−2,1), (−2,−1) have mean 0 and C=diag(316,34). The first principal direction e1 retains 2016=54 of the total variance, and the one-dimensional reconstruction has squared error 3⋅34=4.
The course closes with flows in a network and with problems of fitting and reconstruction from measurements. An incidence matrix turns conservation at each node into a linear system whose kernel describes circulation around cycles. Fitting and reconstruction ask different questions of a matrix, and each answer needs its own checks.
Network flows
A directed graph with n nodes and m edges has the n×m incidence matrix B with bik=1 when edge k leaves node i, bik=−1 when it enters node i, and bik=0 otherwise. For edge flows f in Rm and net supplies s in Rn, positive at a source and negative where material is consumed, conservation at every node reads
Bf=s.
A negative flow runs against the arrow of its edge.
Fact
Condition
s1+⋯+sn=0 is necessary
always, since every column of B sums to 0
the same condition is also sufficient
connected graph and signed flows
rankB=n−1 and NullB⊤=span{1}
connected graph
dimNullB=m−n+1, spanned by circulations around cycles
connected graph
all solutions are f0+z with z in NullB
one solution f0 known
A circulation puts 1 on the edges of a cycle traversed along their arrows and −1 on those traversed against them, and it changes no node balance. Requiring f≥0 adds inequalities that the linear system does not imply, and the feasible set can shrink to a segment, a single point or nothing.
For the edges 1→2, 2→3 and 1→3,
B=1−1001−110−1.
The supplies s=(3,−1,−2) add up to 0, and every solution is f=(t,t−1,3−t), which moves along the circulation (1,1,−1) as t changes. Nonnegative flows need 1≤t≤3.
consistent, with NullA={0}, which always holds when m<n
choose one input
the minimum-norm solution A+b
Ax+=b and x+ orthogonal to NullA
The count of equations settles nothing by itself. An overdetermined system can still be consistent, and an underdetermined one can be inconsistent. A consistent underdetermined system has the solutions xp+NullA with dimNullA≥n−m>0, and the data cannot tell them apart. An exact new measurement a⊤x=β with a outside RowA raises the rank and lowers the nullity by one. A small or zero residual shows agreement with the data used, not a validated model, which needs new observations and justified assumptions.
Fitting a+bt to the points (0,1), (1,2), (2,4) gives a=65 and b=23, with residuals (61,−31,61) and squared error 61. For the 2×3 matrix A and b=(4,3), the minimum-norm reconstruction is (35,32,37), and an added exact measurement x3=2 selects the solution (2,1,2) instead.
May we count page visits to understand which courses and learning features are useful? Cloudflare collects visit and performance statistics, without your account details or answers. Your choice does not affect access. Details