Module 1: Systems of Linear Equations
Set up linear systems, encode them as augmented matrices, and solve them with Gaussian elimination.
Linear Equations and Systems
- Recognize a linear equation and write a system in standard form.
- Represent a system as a coefficient matrix and an augmented matrix.
- Classify a system as having one solution, no solution, or infinitely many.
Linear algebra begins with the humblest object in mathematics: the straight-line equation. Before any symbols, here is one in disguise. Suppose sandwiches cost 2 dollars each and drinks cost 3 dollars each, and your total comes to 12 dollars. If s counts sandwiches and d counts drinks, the receipt says 2s + 3d = 12. Each unknown gets multiplied by a plain number, the pieces are added, and the sum is set equal to a constant. That is the entire recipe, and everything in this course grows out of it.
Here is the general form. A linear equation in the variables x1, x2, ..., xn is any equation that can be written as a1 x1 + a2 x2 + ... + an xn = b. Read it aloud: a-one times x-one, plus a-two times x-two, and so on, equals b. The coefficients a1, ..., an and the constant b are known numbers; the x's are the unknowns we want. The defining feature is that every variable appears to the first power only: no squares, no products of variables, no roots, no trig or exponential functions.
Let us test that rule on a few candidates. The equation 2x - 3y = 5 is linear: each term is a number times one variable. But x^2 + y = 1 is not, because x^2 means x times x, a second power. The equation xy = 4 is not linear either, because two different unknowns are multiplied together; its graph is a curve, not a line. And sqrt(x) + y = 1 fails because a square root is not a first power. A useful habit: scan term by term, and ask of each one, is this a plain number times a single first-power variable?
Sometimes an equation is linear in disguise. Take 3(x - 2) + y = 7. Distribute the 3: 3x - 6 + y = 7. Add 6 to both sides: 3x + y = 13. Now it matches the pattern exactly. Rewriting an equation so the variable terms sit on the left, in a fixed order, and the constant sits on the right is called putting it in standard form, and we will do it before every computation.
Key idea: linear means each variable appears alone, to the first power, multiplied by a known number.
State the number system and the model
Unless a lesson explicitly says otherwise, variables and coefficients in this course are real numbers. A system over the reals has zero, one, or infinitely many solutions. If a model restricts variables to nonnegative integers, its feasible answers can be a finite subset of the real solution set. For the receipt 2s + 3d = 12, real solutions lie on a line, but nonnegative integer purchases are (6,0), (3,2), and (0,4). State restrictions after solving the linear equations.[1]
A two-variable equation ax + by = c describes a line only when at least one of a or b is nonzero. The equation 0x + 0y = 0 imposes no restriction, while 0x + 0y = 1 is impossible. The corresponding qualification holds for a plane in three variables.

Systems of equations
A system of linear equations is a collection of one or more linear equations in the same variables. A solution is a list of values, one for each variable, that satisfies every equation at once. Think of each equation as a separate clue about the same hidden numbers; the solution is the one story consistent with all the clues. For two variables, each equation draws a line in the plane, and a solution is a point where the lines cross.[1]
Consider the pair:
x + y = 5 and x - y = 1
Two numbers that add to 5 and differ by 1: you might guess 3 and 2. Let us get that answer by a method that scales up, working one small step at a time.
- Add the left sides and add the right sides:
(x + y) + (x - y) = 5 + 1. This is allowed because both equations are true at the solution, and adding equal quantities to equal quantities keeps a true statement true. - Combine the left side:
x + y + x - y = 2x, because+yand-ycancel. The right side is 6. So2x = 6. - Divide both sides by 2:
x = 3. - Put
x = 3back intox + y = 5: that reads3 + y = 5, soy = 2.
What happened there: adding the equations made y disappear, leaving one equation in one unknown, and everything after that was ordinary arithmetic. Check the answer in both original equations: 3 + 2 = 5 and 3 - 2 = 1. Both hold, so the single solution is the point (3, 2), exactly where the two lines meet. In three variables the picture upgrades: each equation like x + y + z = 6 describes a flat plane in space, and a solution is a point lying on every plane simultaneously.
Systems come from real questions. Suppose adult movie tickets cost 9 dollars, child tickets cost 5 dollars, and a family bought 5 tickets for 33 dollars. Let a and c count adult and child tickets. Counting tickets gives a + c = 5; counting dollars gives 9a + 5c = 33.
Multiply the first equation by 5 to get 5a + 5c = 25, and subtract it from the second: (9a + 5c) - (5a + 5c) = 33 - 25, so 4a = 8 and a = 2. Then c = 3. Check the money: 9*2 + 5*3 = 18 + 15 = 33. It fits.
Key idea: a solution must satisfy every equation in the system at the same time, not one equation at a time.
The augmented matrix
Writing the variables over and over is wasteful. Once every equation is in standard form, the letters are pure scaffolding: all of the information lives in the numbers. So we record only the numbers, in a rectangular array called a matrix. The coefficient matrix holds the coefficients, and the augmented matrix attaches the right-hand-side constants as an extra column, marked off conceptually by a bar. For the system x + y = 5, x - y = 1:[1]
| Coefficient matrix | Augmented matrix |
| [ 1 1 ; 1 -1 ] | [ 1 1 | 5 ; 1 -1 | 1 ] |
Read the layout like a table. Each row is one equation. Each column belongs to one variable, in a fixed order, and the last column holds the constants. To decode row 1 of the augmented matrix, reattach the letters: 1x + 1y = 5. Nothing was lost; we only stopped rewriting what never changes.
Two habits keep the translation honest. First, put every equation in the same variable order before copying numbers. The system y = 2x + 1 and 3x + y = 10 must first become -2x + y = 1 and 3x + y = 10; then the augmented matrix is [-2 1 | 1 ; 3 1 | 10].
Second, a missing variable is really there with coefficient 0. In the variables x, y, z, the system x + 2z = 5, y - z = 2 becomes the rows [1 0 2 | 5] and [0 1 -1 | 2]. The zeros hold each variable's place in its column.
Why bother with this bookkeeping? Because it scales. A weather model or an engineering simulation can involve thousands of equations in thousands of unknowns, and a computer stores exactly this array of numbers. Better still, the next lesson shows how to solve the system by doing arithmetic directly on the rows of the augmented matrix, with the variables never slowing us down.
Key idea: the augmented matrix is the whole system with the letters stripped away; rows are equations, columns are variables, and the last column is the constants.
Three possible outcomes
For real variables, a linear system has exactly one solution, no solutions, or infinitely many. A system is consistent when it has at least one solution and inconsistent otherwise. Do not equate a unique solution with having no redundant equations.[2]
- Unique: x + y = 5 and x - y = 1 give (3,2). Adding 2x + 2y = 10 makes one equation redundant but leaves the unique solution unchanged.
- None: x + y = 2 and x + y = 5 imply 0 = 3 after subtraction.
- Infinitely many: x + y = 2 and 2x + 2y = 4 give (t,2-t), t real. More generally, independent equations can also leave free choices: x + y + z = 0 alone leaves two parameters.
Here is a proof of the three-way classification. Suppose distinct vectors u and v both solve Ax = b. For every real t, A((1-t)u + tv) = (1-t)Au + tAv = (1-t)b + tb = b. Different t give different vectors because v - u is nonzero. Thus two distinct solutions force infinitely many, including points beyond the segment between them.
Elimination decides the outcome: a contradiction means no solution; if the system is consistent, a pivot in every variable column means uniqueness, and at least one free variable means infinitely many solutions.

A real use: keeping traffic moving
Consider a steady-flow model of two intersections, with no accumulation of cars during the time interval. Four hundred cars per hour enter A, and x leave toward B while y leave on another road, so x + y = 400. At B, x cars per hour arrive from A and 100 arrive from a side street; 350 leave, so x + 100 = 350. These are model assumptions, not universal statements about congested traffic.
The second balance gives x = 250 cars per hour, and the first then gives y = 150 cars per hour. Both are nonnegative and satisfy the assumed balances. If the number of cars stored in an intersection changes, the balance must include accumulation: inflow minus outflow equals the rate of change in stored cars. A negative solution would require reconsidering an assumed flow direction or the model, rather than reporting negative cars.
Common misconceptions
- Calling xy = 4 linear. Two unknowns multiplied together is a product of variables, which the definition forbids; the graph is a hyperbola, not a line. Test every term one at a time.[2]
- Copying coefficients before lining up the variables. If one equation is written
y + x = 5and the nextx - y = 1, copying numbers left to right scrambles the columns, and the matrix describes a different system. Standard form first, always. - Skipping the 0 for a missing variable. In
x + 2z = 5with variablesx, y, z, the row is[1 0 2 | 5]. Dropping the 0 shifts the 2 into the y-column, silently changing the equation tox + 2y = 5. - Checking a guess in only one equation. The point
(4, 1)satisfiesx + y = 5but failsx - y = 1, since4 - 1 = 3. Membership in the solution set requires passing every equation. - Counting equations to predict solutions. Two equations in two unknowns often give one solution, but not always: parallel lines give none and repeated lines give infinitely many. The structure of the equations, not their count, decides.
Try it
Solve the system x + 2y = 7, 3x - 2y = 5 by elimination, then write its augmented matrix.
Worked answer. Add the two equations: (x + 2y) + (3x - 2y) = 7 + 5. The +2y and -2y cancel, leaving 4x = 12, so x = 3. Substitute into the first equation: 3 + 2y = 7, so 2y = 4 and y = 2. The solution is (3, 2). Check: 3 + 2*2 = 7 and 3*3 - 2*2 = 9 - 4 = 5. Both pass. The augmented matrix is [1 2 | 7 ; 3 -2 | 5].
Recap
- A linear equation is a sum of number-times-variable terms set equal to a constant; first powers only.
- A system's solution satisfies every equation simultaneously; geometrically, it is where lines or planes intersect.
- The augmented matrix records the system as pure numbers: rows are equations, columns are variables, last column is constants.
- Exactly three outcomes exist: one solution, no solution, or infinitely many. Two distinct solutions force infinitely many.
Next we turn elimination, the trick that made y vanish, into a complete algorithm that runs on the augmented matrix itself: Gaussian elimination.
Retrieve, check, and revisit
Before looking back: Without notes, classify x+y=5, 2x+2y=10 and then change 10 to 11.
Feedback after attempting
The first system has infinitely many real solutions (t,5-t). The changed system is inconsistent.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Explain how two different solutions of a real linear system generate a whole line of solutions. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), systems of eqns. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), solution sets. Read the source.
- Key terms
- Linear equation
- An equation expressible as a sum of known scalar coefficients times individual variables, equal to a constant.
- System of linear equations
- A set of linear equations sharing the same variables.
- Solution
- Values for the variables that satisfy every equation in the system simultaneously.
- Augmented matrix
- The coefficient matrix with the constant column attached on the right.
- Consistent system
- A system that has at least one solution.
- Inconsistent system
- A system that has no solution.
Gaussian Elimination and Row Echelon Form
- Apply the three elementary row operations to an augmented matrix.
- Reduce a matrix to row echelon form and read off the solution by back-substitution.
- Use reduced row echelon form to identify free variables and describe infinite solution sets.
Gaussian elimination is a systematic procedure that solves any linear system, no matter its size, by simplifying its augmented matrix step by step. In the last lesson we added two equations and a variable vanished. Gaussian elimination turns that one-off trick into a complete algorithm with a guaranteed finish line. It uses three elementary row operations, each of which changes the matrix without changing its solution set:
- Swap two rows.
- Scale a row by a nonzero constant.
- Replace a row by itself plus a multiple of another row.
The goal is row echelon form: zero rows are at the bottom, each nonzero row's first nonzero entry (its pivot) is to the right of the pivot above, and entries below each pivot are zero. First check for contradictions. In a consistent system, choose any free variables and then use back-substitution to find the pivot variables. A bottom row need not contain only one variable.
Why row operations are safe
Before running the machine, it is worth seeing why these three moves are legal. Each row is an equation, and each operation is something we were always allowed to do to equations. Swapping rows only reorders the list; the clues are the same clues in a different order. Scaling a row multiplies both sides of one equation by the same nonzero number: if x - y = 1 is true, then 2x - 2y = 2 is true for exactly the same pairs, and dividing by 2 brings the original back.[1]
The replacement move is the workhorse. Replacing R2 with R2 + 3*R1 (read: row two plus three times row one) adds equal quantities to both sides of equation two, because whatever the solution is, row one's left side equals its right side there. A true statement plus a true statement is still true. And the move is reversible: subtract 3*R1 again and nothing is lost. Reversibility is the whole point. Because every move can be undone, the new system and the old system are true for exactly the same values, so the solution set never changes.
That reversibility requirement is also why scaling by zero is banned. Multiplying a row by 0 turns an equation into 0 = 0, which erases its information forever; there is no way to divide by zero and recover it. The three legal moves rearrange information without ever destroying it.
Key idea: row operations are reversible restatements of the system, so the simplified matrix has exactly the same solutions as the original.

Worked example, a 3x3 system
Solve the system whose augmented matrix is shown, using the rows R1, R2, R3:[1]
R1: [1 1 1 | 6] R2: [0 2 5 | -4] R3: [2 5 -1 | 27]
This came from x + y + z = 6, 2y + 5z = -4, and 2x + 5y - z = 27. The strategy is always the same: clear out one column at a time, left to right, using the pivot in that column to wipe out everything below it.
- Column 1 has its pivot, the 1 in R1. The only nonzero entry below it is the 2 in R3, so replace R3 with
R3 - 2*R1, entry by entry:2 - 2*1 = 0, then5 - 2*1 = 3, then-1 - 2*1 = -3, and on the right side27 - 2*6 = 15. The new R3 is[0 3 -3 | 15]. - Column 2 has its pivot, the 2 in R2, and a 3 below it in R3. The multiplier is
3/2, so replace R3 withR3 - (3/2)*R2: first entry0 - 0 = 0, then3 - (3/2)(2) = 3 - 3 = 0, then-3 - (3/2)(5) = -3 - 7.5 = -10.5, and15 - (3/2)(-4) = 15 + 6 = 21. The new R3 is[0 0 -10.5 | 21]. - The matrix is now in echelon form:
[1 1 1 | 6][0 2 5 | -4][0 0 -10.5 | 21]
Notice the fraction 3/2 did not stop us. Fractions and decimals are routine guests in elimination; the arithmetic rules are unchanged. Now back-substitute from the bottom. Row 3 says -10.5 z = 21; divide both sides by -10.5 to get z = -2. Row 2 says 2y + 5(-2) = -4, that is 2y - 10 = -4; add 10 to both sides for 2y = 6, so y = 3. Row 1 says x + 3 + (-2) = 6, that is x + 1 = 6, so x = 5.
The unique solution is (5, 3, -2). Verify it in the original third equation, the one we modified most: 2(5) + 5(3) - (-2) = 10 + 15 + 2 = 27. Correct. And in the first: 5 + 3 + (-2) = 6. Correct again. A thirty-second check like this catches most arithmetic slips, and it is worth doing every time.
Reading the staircase: what echelon form promises
For a consistent system with a pivot in every variable column, back-substitution starts with one unknown in the last nonzero row. With free variables, choose their values first. For example, [1 2 3 | 4 ; 0 0 1 | 2] gives z = 2, y = t, and x = -2 - 2t. The first row contains a free variable even though the matrix is in echelon form.[1]
Before parameterizing, inspect every row for [0 ... 0 | nonzero]. That row makes the whole system inconsistent, regardless of free columns. For [1 0 2 | 3 ; 0 0 0 | 1], some coefficient columns lack pivots but there is no solution. The consistency check comes first.
Key idea: the staircase identifies pivots and free variables; consistency determines whether those free choices actually describe solutions.
Reduced row echelon form and free variables
If we keep going, scaling each pivot to 1 and clearing the entries above each pivot too, we reach reduced row echelon form (RREF), where the solution can be read off with no back-substitution at all.[2]
Let us finish the worked example. Scale R3 by 1/(-10.5) to get [0 0 1 | -2]. Then clear column 3 upward: replace R2 with R2 - 5*R3, giving [0 2 0 | 6], and R1 with R1 - R3, giving [1 1 0 | 8]. Scale R2 by 1/2 to get [0 1 0 | 3], then replace R1 with R1 - R2: [1 0 0 | 5].
The final matrix is [1 0 0 | 5 ; 0 1 0 | 3 ; 0 0 1 | -2], which spells out x = 5, y = 3, z = -2 directly. RREF costs a few more operations than REF, but the answer sits on the surface, and unlike REF, the RREF of a matrix is unique.
RREF also exposes systems with infinitely many solutions. In a consistent reduced system, a variable column without a pivot corresponds to a free variable, which may take any real value. For instance, if reduction yields
[1 0 2 | 3] [0 1 -1 | 4] [0 0 0 | 0]
then column 3 has no pivot, so z is free. Writing z = t, the first row says x + 2t = 3, so x = 3 - 2t, and the second says y - t = 4, so y = 4 + t. The solution set is the infinite family (3 - 2t, 4 + t, t). Spot-check it: t = 0 gives (3, 4, 0) and t = 1 gives (1, 5, 1), and both satisfy x + 2z = 3.
Finally, a row like [0 0 0 | 5] would say 0 = 5, a contradiction signaling an inconsistent system with no solution. Gaussian elimination thus decides all three cases automatically.

A second full run, with a free variable
Solve x + 2y + z = 4, 2x + 4y + 3z = 9, -x - 2y + z = -2. The augmented matrix is [1 2 1 | 4 ; 2 4 3 | 9 ; -1 -2 1 | -2].[3]
- Clear column 1. Replace R2 with
R2 - 2*R1:2 - 2 = 0,4 - 4 = 0,3 - 2 = 1,9 - 8 = 1, giving[0 0 1 | 1]. Replace R3 withR3 + R1:-1 + 1 = 0,-2 + 2 = 0,1 + 1 = 2,-2 + 4 = 2, giving[0 0 2 | 2]. - Column 2 has no pivot available: both remaining rows have 0 there. That is fine; move to column 3, whose pivot is the 1 in R2. Replace R3 with
R3 - 2*R2:2 - 2 = 0and2 - 2 = 0, a zero row.
The echelon form is [1 2 1 | 4 ; 0 0 1 | 1 ; 0 0 0 | 0], with pivots in columns 1 and 3. Column 2 is pivot-free, so y is free: set y = t. Row 2 gives z = 1. Row 1 gives x + 2t + 1 = 4, so x = 3 - 2t. The solutions form the family (3 - 2t, t, 1), a line in space.
Check the middle original equation for every t at once: 2(3 - 2t) + 4t + 3(1) = 6 - 4t + 4t + 3 = 9. The t's cancel, so every member of the family works. For contrast, changing the last equation's constant from -2 to 1 would have produced the row [0 0 0 | 3] instead of a zero row: the false sentence 0 = 3, and no solution at all.
A real use: currents in a circuit
For an ideal steady direct-current circuit with fixed positive resistances, charge balance at a junction and voltage balance around loops give linear equations. Suppose a 9 V source drives current i1 through a 1 ohm resistor, then splits into i2 through 3 ohms and i3 through 6 ohms. The model equations are i1 - i2 - i3 = 0, i1 + 3i2 = 9, and 3i2 - 6i3 = 0. The coefficients in the voltage equations carry resistance units, so resistance times current is voltage.
Eliminate. The augmented matrix is [1 -1 -1 | 0 ; 1 3 0 | 9 ; 0 3 -6 | 0]. Replace R2 with R2 - R1: [0 4 1 | 9]. Replace R3 with R3 - (3/4)*R2: 3 - 3 = 0, -6 - (3/4)(1) = -6.75, 0 - (3/4)(9) = -6.75, giving [0 0 -6.75 | -6.75]. So i3 = 1 amp.
Back-substitution gives i2 = 2 A and i1 = 3 A. Check all balances: 3 - 2 - 1 = 0 A, (1 ohm)(3 A) + (3 ohms)(2 A) = 9 V, and (3 ohms)(2 A) - (6 ohms)(1 A) = 0 V. This verifies the stated ideal circuit model; nonlinear components or time-dependent storage can require different equations.
Common misconceptions
- Forgetting the constants column. A row operation applies to the entire row, bar included. Computing
R3 - 2*R1on the coefficients but not on the constant changes the system into a different one with different solutions. - Scaling a row by zero. It converts an equation to
0 = 0, deleting information irreversibly. Scale only by nonzero numbers. - Using a row you already changed in this step. Perform one operation at a time, writing the new matrix before the next move. Combining two replacements in your head is where sign errors breed.
- Refusing the swap. If the pivot position holds a 0, as in
[0 1 | 2 ; 3 4 | 5], you cannot clear a column with it. Swap rows first to bring a nonzero entry into the pivot seat. - Expecting echelon form to be unique. Different legal move orders give different REFs, and that is fine; the solution set they describe is identical. Only the fully reduced RREF is unique.
- Letting fractions reroute you. Multipliers like
3/2are legitimate. If you prefer, scale a row first (for example, double R3 before subtracting3*R2); reversible moves cost nothing.
Try it
Solve by elimination: 2x + y = 8, 4x + 3y = 18.
Worked answer. The augmented matrix is [2 1 | 8 ; 4 3 | 18]. Replace R2 with R2 - 2*R1: 4 - 4 = 0, 3 - 2 = 1, 18 - 16 = 2, giving [0 1 | 2]. That row says y = 2. Back-substitute: 2x + 2 = 8, so 2x = 6 and x = 3. Solution: (3, 2). Check: 4(3) + 3(2) = 12 + 6 = 18. It holds.
Recap
- Three row operations, all reversible, preserve the solution set: swap, scale by a nonzero constant, and add a multiple of one row to another.
- Forward elimination clears columns left to right, producing a staircase (REF); back-substitution climbs it from the bottom.
- Continuing to RREF puts a lone 1 in each pivot position and reveals the answer, or the free variables, at a glance.
- For a consistent system, a pivot-free variable column means a free variable and an infinite family; a row reading 0 = nonzero means no solution.
With solving under control, the next module treats matrices as objects in their own right, with an arithmetic of addition, multiplication, and, eventually, inverses.
Retrieve, check, and revisit
Before looking back: Reduce [1 2 1 | 4; 2 4 2 | 8]. Name each free variable before writing a vector answer.
Feedback after attempting
RREF is [1 2 1 | 4;0 0 0 | 0]. With x2=s,x3=t, x=[4;0;0]+s[-2;1;0]+t[-1;0;1].
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Change the last augmented entry to 9. Explain why counting free columns before checking consistency fails. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), row reduction. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), parametric form. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), solution sets. Read the source.
- Key terms
- Elementary row operation
- Swapping two rows, scaling a row by a nonzero scalar, or replacing a row by itself plus a multiple of another row.
- Pivot
- The first nonzero entry in a row of an echelon-form matrix.
- Row echelon form
- A staircase form with zeros below each pivot and zero rows at the bottom.
- Back-substitution
- Solving from the last equation upward once a matrix is in echelon form.
- Reduced row echelon form
- Echelon form with pivots equal to 1 and zeros both below and above each pivot.
- Free variable
- A variable in a column with no pivot, which may take any value.
Module 2: Matrix Algebra
Treat matrices as objects you can add, scale, multiply, and invert.
Matrix Operations
- Add, subtract, and scalar-multiply matrices of matching size.
- Multiply two matrices using the row-by-column rule.
- Recognize why matrix multiplication is not commutative.
A matrix is a rectangular array of numbers arranged in rows and columns, like a small spreadsheet. A matrix with m rows and n columns is called an m x n matrix (read: m by n), and the number in row i, column j is its (i, j) entry. So in the 2 x 3 matrix M = [4 7 0 ; 2 -1 5], the (2, 3) entry is 5: second row, third column. Rows are always named first, in both the size and the entry address.
Matrices are not only bookkeeping for systems of equations; they are objects with their own arithmetic. You can add them, scale them, and, most importantly, multiply them. This lesson builds that arithmetic one operation at a time, with every computation written out, because matrix multiplication follows a rule you would probably not guess on your own, and there is a good reason behind it.
Addition and scalar multiplication
Two matrices of the same size are added entry by entry: top-left with top-left, and so on across the whole array. A matrix is multiplied by a scalar (a single number) by multiplying every entry. For example, with[1]
A = [1 2 ; 3 4] and B = [5 6 ; 7 8]
the sum adds matching positions: A + B = [1+5 2+6 ; 3+7 4+8] = [6 8 ; 10 12]. Scaling triples every entry: 3A = [3*1 3*2 ; 3*3 3*4] = [3 6 ; 9 12]. Subtraction works the same way, position by position: B - A = [5-1 6-2 ; 7-3 8-4] = [4 4 ; 4 4].
Because each position is handled independently, addition inherits the comfortable habits of ordinary numbers: A + B = B + A, and grouping does not matter. The zero matrix, all entries 0, plays the role of the number zero: adding it changes nothing. One rule has no counterpart for numbers: sizes must match exactly. A 2 x 2 matrix plus a 2 x 3 matrix is undefined, because some entries would have no partner to pair with.
Key idea: addition and scalar multiplication work position by position, and only same-size matrices can be added.
A matrix times a vector
Before multiplying two matrices, let us multiply a matrix by a single column vector, the case that runs all of linear algebra. The rule: the result is a column, and each entry is one row of the matrix dotted with the vector, meaning multiply matching entries and add. Compute [1 2 ; 3 4][5 ; 6] one row at a time. Row 1: 1*5 + 2*6 = 5 + 12 = 17. Row 2: 3*5 + 4*6 = 15 + 24 = 39. So the product is [17 ; 39].[2]
There is a second way to read the same computation, and it is worth knowing both. The product is a linear combination of the columns, weighted by the vector's entries: 5[1 ; 3] + 6[2 ; 4] = [5 ; 15] + [12 ; 24] = [17 ; 39]. Same answer, different story. The row picture computes one output entry at a time; the column picture says the output is built from the matrix's columns. The column picture explains why Ax = b asks whether b can be assembled from the columns of A, a question that returns in Module 4.
![The product [2 1;1 2][2;1] is twice the first column plus the second, giving [5;4].](/assets/img/math-linalg-reviewed/column-combination.png)
Matrix multiplication
Now the full rule. The product AB is defined only when the number of columns of A equals the number of rows of B. If A is m x n and B is n x p, then AB is m x p: the inner sizes must agree and then they cancel, leaving the outer sizes. The entry in row i, column j of AB is the dot product of row i of A with column j of B. Equivalently, column j of AB is the matrix A times column j of B: matrix-vector products, done once per column.[1]
Worked example. Multiply the 2x2 matrices A = [1 2 ; 3 4] and B = [5 6 ; 7 8].
- Top-left: row 1 of A dotted with column 1 of B:
1*5 + 2*7 = 5 + 14 = 19. - Top-right: row 1 with column 2:
1*6 + 2*8 = 6 + 16 = 22. - Bottom-left: row 2 with column 1:
3*5 + 4*7 = 15 + 28 = 43. - Bottom-right: row 2 with column 2:
3*6 + 4*8 = 18 + 32 = 50.
So AB = [19 22 ; 43 50]. A useful habit while learning: point at the row with your left hand and the column with your right, and sweep them together as you multiply and add.
A rectangular example. Let A = [1 0 2 ; -1 3 1] (size 2 x 3) and B = [3 1 ; 2 0 ; 1 4] (size 3 x 2). The inner sizes are both 3, so AB exists and is 2 x 2.
Entry by entry: top-left is 1*3 + 0*2 + 2*1 = 3 + 0 + 2 = 5; top-right is 1*1 + 0*0 + 2*4 = 1 + 0 + 8 = 9; bottom-left is -1*3 + 3*2 + 1*1 = -3 + 6 + 1 = 4; bottom-right is -1*1 + 3*0 + 1*4 = -1 + 0 + 4 = 3. So AB = [5 9 ; 4 3].
Note that BA is also defined here, but it is 3 x 3, a different size entirely. The order of the factors is not a cosmetic detail.
Key idea: match inner sizes, then build each entry as a row-times-column dot product; each column of AB is A applied to a column of B.
Order matters
Unlike ordinary numbers, matrix multiplication is not commutative: in general AB is not equal to BA. Reversing the square product above gives BA = [5*1 + 6*3, 5*2 + 6*4 ; 7*1 + 8*3, 7*2 + 8*4] = [23 34 ; 31 46], a completely different matrix from AB = [19 22 ; 43 50]. The deep reason arrives in Module 6: matrices represent actions, and doing action B then action A rarely matches doing A then B, in the same way that putting on socks then shoes differs from shoes then socks.[1]
The identity matrix I, with 1s on the main diagonal and 0s elsewhere, is the one matrix that behaves like the number 1: AI = IA = A for any square A. Multiplication also distributes over addition, A(B + C) = AB + AC, and is associative, (AB)C = A(BC), so long chains of products can be grouped however is convenient. Only the freedom to swap factors is lost.
Matrices also differ from real numbers because nonzero matrices can multiply to zero. This fact is separate from noncommutativity. For A = [1 0 ; 0 0] and B = [0 0 ; 0 1], both AB and BA are zero even though neither factor is zero.
Without an appropriate injectivity or invertibility condition, cancellation can fail: with that same A, both A[1 0 ; 0 1] and A[1 0 ; 0 5] equal [1 0 ; 0 0], so AB = AC does not force B = C. And expanding (A + B)^2 gives A^2 + AB + BA + B^2; the middle terms cannot be merged into 2AB unless A and B happen to commute.
Key idea: keep every product in its written order; the familiar rules of algebra survive except the ones that quietly assume swapping.

Shapes, identities, and justified cancellation
For an m by n matrix A, the identity equations are ImA = A and AIn = A. The two identities need not have the same size. Associativity holds when all dimensions fit, so A(Bx) = (AB)x without commuting any factors.[3]
If a matrix A has independent columns, Ax = Ay implies x = y because A(x-y) = 0 has only the zero solution. Applying this argument column by column permits left cancellation in AB = AC even when A is tall. A square invertible A is an important special case. A nonsquare matrix has no two-sided inverse, but may still admit this kind of cancellation.
Powers and the transpose
Two small pieces of vocabulary complete the toolkit. For a square matrix, A^2 means A*A, with the same row-by-column rule. For A = [1 2 ; 3 4]: top-left 1*1 + 2*3 = 7, top-right 1*2 + 2*4 = 10, bottom-left 3*1 + 4*3 = 15, bottom-right 3*2 + 4*4 = 22, so A^2 = [7 10 ; 15 22].[1]
The transpose A^T flips a matrix across its main diagonal, turning rows into columns: [1 2 ; 3 4]^T = [1 3 ; 2 4]. It will star in the least-squares story of Module 8; for now, know the notation and the reversal rule (AB)^T = B^T A^T.
A real use: counting routes in a network
Here is multiplication earning its keep. An airline serves cities 1, 2, and 3 with one-way flights: 1 to 2, 1 to 3, 2 to 3, and 3 to 1. Record them in an adjacency matrix M whose (i, j) entry is 1 if there is a flight from city i to city j, else 0: M = [0 1 1 ; 0 0 1 ; 1 0 0].
Now compute M^2 row by row. Row 1: (0*0 + 1*0 + 1*1, 0*1 + 1*0 + 1*0, 0*1 + 1*1 + 1*0) = (1, 0, 1). Row 2: (1, 0, 0). Row 3: (0, 1, 1). So M^2 = [1 0 1 ; 1 0 0 ; 0 1 1].
The remarkable part: the (i, j) entry of M^2 counts the two-leg routes from i to j. The 1 in position (1, 3) is the route 1 to 2 to 3; the 1 in position (1, 1) is the round trip 1 to 3 to 1. The dot product sums, over every stopover city k, flight(i to k) times flight(k to j), which is exactly a count of connections. Higher nonnegative integer powers count walks of the specified length in this finite directed graph. Walks may revisit vertices or edges; they are not necessarily simple paths or feasible flight itineraries with scheduled connection times.
Common misconceptions
- Multiplying entry by entry. The tempting rule
[1 2 ; 3 4][5 6 ; 7 8] = [5 12 ; 21 32]is not matrix multiplication and breaks the connection to systems and transformations. Rows dot columns, always. - Ignoring the size test. A 2 x 3 times a 2 x 3 is undefined: the inner numbers read 3 then 2, and they disagree. Write the sizes side by side,
(2 x 3)(3 x 2), before computing anything. - Swapping factors mid-calculation. Replacing
ABwithBAsilently changes the answer, and sometimes even the size of the answer. - Cancelling matrices like numbers. From
AB = ACyou may not concludeB = C, and fromAB = 0you may not conclude that A or B is zero; the examples above break both. - Expanding squares by habit.
(A + B)^2 = A^2 + AB + BA + B^2. Writing2ABassumes commutativity you do not have.
Try it
Let A = [0 1 ; 1 0] and B = [2 3 ; 4 5]. Compute AB and BA.
Worked answer. For AB: top-left 0*2 + 1*4 = 4, top-right 0*3 + 1*5 = 5, bottom-left 1*2 + 0*4 = 2, bottom-right 1*3 + 0*5 = 3, so AB = [4 5 ; 2 3]. For BA: top-left 2*0 + 3*1 = 3, top-right 2*1 + 3*0 = 2, bottom-left 4*0 + 5*1 = 5, bottom-right 4*1 + 5*0 = 4, so BA = [3 2 ; 5 4]. They differ, and there is a pattern worth noticing: multiplying by this A on the left swapped B's rows, while multiplying on the right swapped B's columns.
Recap
- Same-size matrices add entry by entry; scalars multiply every entry; the zero matrix is the additive identity.
- A matrix times a vector is a dot product per row, or equivalently a weighted combination of the columns.
ABneeds columns of A to match rows of B; entry (i, j) is row i of A dotted with column j of B.- Multiplication is associative and distributive but not commutative, and cancellation can fail.
Next we ask when a matrix can be undone: the inverse, the matrix version of a reciprocal.
Retrieve, check, and revisit
Before looking back: Use A=[1 1;0 1] and B=[1 0;1 1] to compute AB and BA.
Feedback after attempting
AB=[2 1;1 1], BA=[1 1;1 2]. Both products exist and differ.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Draw the two successive shears and explain why order matters. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), matrix multiplication. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), matrix equations. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), one to one onto. Read the source.
- Key terms
- Matrix
- A rectangular array of numbers with m rows and n columns.
- Entry
- The number in a specific row and column, written a sub i j.
- Scalar multiplication
- Multiplying every entry of a matrix by a single number.
- Matrix product
- AB has (i,j) entry equal to the dot product of row i of A with column j of B.
- Identity matrix
- A square matrix with 1s on the diagonal and 0s elsewhere; it acts like the number 1.
- Noncommutative
- AB and BA are generally different for matrices.
The Inverse of a Matrix
- Define the inverse of a square matrix and state when it exists.
- Compute the inverse of a 2x2 matrix with the shortcut formula.
- Use the inverse to solve a matrix equation Ax = b.
For an ordinary nonzero number a, the reciprocal 1/a undoes multiplication: a * (1/a) = 1. Multiply by 5, then by 1/5, and you are back where you started. The matrix version of this undo button is the inverse. A square matrix A is invertible (or nonsingular) if there is a matrix A^(-1) (read: A inverse) with
A * A^(-1) = A^(-1) * A = I,
where I is the identity matrix, the do-nothing matrix with 1s on the diagonal. Think of A as a machine that scrambles vectors; A^(-1) is the machine that unscrambles them, and running the two in either order lands you back at the start. Not every matrix has an inverse. A matrix that lacks one is called singular. Only square matrices can be invertible, and even then it depends on the entries.
One reassuring fact before computing: a matrix never has two different inverses. If B and C both undid A, then B = B I = B (A C) = (B A) C = I C = C, so the two candidates were the same matrix all along. Each step there uses only associativity and the definition of an inverse, and it means we may speak of the inverse of A.
The 2x2 inverse formula
For a 2x2 matrix there is a clean shortcut. If A = [a b ; c d], define the number det(A) = ad - bc, called the determinant. Then:[1]
A^(-1) = (1 / (ad - bc)) * [d -b ; -c a]
In words: swap the diagonal entries, negate the off-diagonal entries, and divide everything by ad - bc. The formula works if and only if ad - bc is not zero. If ad - bc = 0, the matrix is singular and has no inverse.
Why does swapping and negating work? Multiply the two matrices symbolically, before any division. The top-left entry of [a b ; c d][d -b ; -c a] is ad + b(-c) = ad - bc. The top-right entry is a(-b) + ba = 0. The bottom-left is cd + d(-c) = 0. The bottom-right is c(-b) + da = ad - bc. So the product is (ad - bc) times the identity, and dividing by ad - bc lands exactly on I. The formula is not a trick to memorize on faith; it is the unique matrix that makes the product collapse to the identity.
Worked example. Invert A = [4 7 ; 2 6].
- Compute the determinant:
ad - bc = 4*6 - 7*2 = 24 - 14 = 10. Nonzero, so the inverse exists. - Swap and negate:
[d -b ; -c a] = [6 -7 ; -2 4]. - Divide by 10:
A^(-1) = [0.6 -0.7 ; -0.2 0.4].
Check every entry of A * A^(-1). Top-left: 4*0.6 + 7*(-0.2) = 2.4 - 1.4 = 1. Top-right: 4*(-0.7) + 7*0.4 = -2.8 + 2.8 = 0. Bottom-left: 2*0.6 + 6*(-0.2) = 1.2 - 1.2 = 0. Bottom-right: 2*(-0.7) + 6*0.4 = -1.4 + 2.4 = 1. The product is [1 0 ; 0 1], as required.
Now a matrix with no inverse: B = [2 4 ; 1 2]. Its determinant is 2*2 - 4*1 = 0. Geometrically, both columns point along the same line (the second is twice the first), so the machine B flattens the whole plane onto that line. Two different inputs get squashed to the same output, and no machine can look at the output and recover which input it came from. That is what singular means in practice: information has been destroyed.
Key idea: the 2x2 inverse is swap, negate, divide by the determinant, and it exists exactly when ad - bc is nonzero.
Inverses by row reduction: the [A | I] method
The swap-and-negate shortcut is special to 2x2 matrices. The general method uses Gaussian elimination. Write the block matrix [A | I], with the identity glued to the right of A, and row-reduce until the left block becomes I. Whatever the right block has become is A^(-1). The logic: each row operation is itself an invertible action, and the sequence of actions that converts A to I is, in total, exactly multiplication by A^(-1). Applying that same sequence to I records the product for you.[1]
Worked example. Invert A = [1 2 ; 3 4] by row reduction, starting from [1 2 | 1 0 ; 3 4 | 0 1].
- Clear below the first pivot. Replace R2 with
R2 - 3*R1:3 - 3 = 0,4 - 6 = -2,0 - 3 = -3,1 - 0 = 1, giving[0 -2 | -3 1]. - Scale R2 by
-1/2to make its pivot 1:[0 1 | 1.5 -0.5]. - Clear above the second pivot. Replace R1 with
R1 - 2*R2:1 - 0 = 1,2 - 2 = 0,1 - 3 = -2,0 - (-1) = 1, giving[1 0 | -2 1].
The left block is now the identity, so A^(-1) = [-2 1 ; 1.5 -0.5]. Cross-check with the formula: det(A) = 1*4 - 2*3 = -2, and (1/-2)[4 -2 ; -3 1] = [-2 1 ; 1.5 -0.5]. The two methods agree, as they must. For a 3x3 or larger matrix, this elimination route is the standard one, and if the left block ever produces a zero row, stop: the matrix is singular and no inverse exists.
![For A=[2 1;0 1], A inverse=[1/2 -1/2;0 1]. Applying the inverse to the transformed square recovers the original square.](/assets/img/math-linalg-reviewed/inverse-square.png)
Solving Ax = b with the inverse
Any linear system can be written as a single matrix equation Ax = b, where A is the coefficient matrix, x is the column of unknowns, and b is the column of constants. If A is invertible, multiply both sides on the left by A^(-1):[1]
A^(-1) A x = A^(-1) b, so x = A^(-1) b.
For example, to solve 4x + 7y = 1, 2x + 6y = 3, use the inverse computed earlier and multiply: x = A^(-1) b = [0.6 -0.7 ; -0.2 0.4][1 ; 3]. The first entry is 0.6*1 + (-0.7)*3 = 0.6 - 2.1 = -1.5, and the second is -0.2*1 + 0.4*3 = -0.2 + 1.2 = 1. So x = -1.5, y = 1. Check in the first equation: 4(-1.5) + 7(1) = -6 + 7 = 1. It holds.
The real payoff appears when the same coefficients face many different right-hand sides, a daily situation in engineering: same structure, different loads. Solve 4x + 7y = 10, 2x + 6y = 8 with the same inverse: first entry 0.6*10 + (-0.7)*8 = 6 - 5.6 = 0.4, second entry -0.2*10 + 0.4*8 = -2 + 3.2 = 1.2. Two multiplications, no new elimination. One caution for later courses: for large systems, software solves Ax = b by elimination directly rather than forming A^(-1), which is often more expensive and can introduce additional rounding error at scale. The inverse is the right concept; elimination is the right computation.
Reuse elimination with LU factorization
Repeated right-hand sides can be solved by storing elimination factors rather than explicitly constructing an inverse. For A = [2 1 ; 4 3], subtract twice row 1 from row 2. The upper triangular result is U = [2 1 ; 0 1]. Record the multiplier in L = [1 0 ; 2 1]. Direct multiplication gives LU = A.[3]
To solve Ax = b with b = [5 ; 11], first solve Ly = b: y1 = 5 and 2y1 + y2 = 11, so y2 = 1. Then solve Ux = y: x2 = 1 and 2x1 + x2 = 5, so x1 = 2. Check A[2 ; 1] = [5 ; 11]. A new b requires two triangular solves with the same L and U.
When row exchanges are needed, a common convention is PA = LU, where P records the exchanges. Solve Ly = Pb before Ux = y. A nonzero pivot can still be numerically poor if it is tiny relative to other available entries; partial pivoting chooses a largest-magnitude available entry in that column. Exact invertibility and numerical sensitivity are different questions.
For A = [1 1 ; 1 1.001], b = [2 ; 2.001] gives x = [1 ; 1]. Change only the second entry of b to 2.002: subtracting the rows gives 0.001x2 = 0.002, so x = [0 ; 2]. A small change in the data produced a large change in the solution. A nonzero determinant is not a promise of reliable digits. We revisit this sensitivity using singular values.
![A=[2 1;4 3] factors as L=[1 0;2 1] times U=[2 1;0 1]. Solve Ly=b and then Ux=y.](/assets/img/math-linalg-reviewed/lu-factors.png)
Properties of inverses
- Double undo:
(A^(-1))^(-1) = A. Undoing the undo restores the original action.[1] - Products reverse order:
(AB)^(-1) = B^(-1) A^(-1). To undo "apply B, then A," you must undo A first, then B, the socks-and-shoes rule. Verify:(AB)(B^(-1) A^(-1)) = A (B B^(-1)) A^(-1) = A I A^(-1) = I. - Transpose commutes with inverse:
(A^T)^(-1) = (A^(-1))^T. - Scalars pull out reciprocally:
(kA)^(-1) = (1/k) A^(-1)for nonzerok, since doubling a machine's output is undone by halving.
A real use: encoding and decoding messages
A reversible coordinate mixer illustrates an inverse without making claims about cryptographic security. Let K = [2 1 ; 1 1]. It maps [8 ; 5] to [21 ; 13], and K-1 = [1 -1 ; -1 2] maps [21 ; 13] back to [8 ; 5]. Multiplication verifies both steps.
This calculation uses ordinary real arithmetic. A letter cipher with wraparound would instead use modular arithmetic, with different invertibility conditions, and this example is not a security method. The useful lesson here is that a two-sided inverse recovers every input exactly in exact arithmetic.
Common misconceptions
- Writing division of matrices. Expressions like
B/Aare ambiguous because order matters:A^(-1)BandB A^(-1)usually differ. Always write which side the inverse multiplies on.[2] - Treating 1/A as entrywise. The inverse is not the matrix of reciprocals. For
A = [1 2 ; 3 4], the entrywise guess[1 0.5 ; 1/3 0.25]fails the testA A^(-1) = I; the true inverse is[-2 1 ; 1.5 -0.5]. - Inverting a sum term by term.
(A + B)^(-1)is notA^(-1) + B^(-1). WithA = B = I: the left side is(2I)^(-1) = 0.5 I, while the right side is2I. - Forgetting the order reversal.
(AB)^(-1) = B^(-1) A^(-1), notA^(-1) B^(-1). Shoes off before socks. - Inverting a nonsquare matrix. A 2 x 3 matrix maps R^3 to R^2 and must merge inputs along the way; no two-sided inverse can exist.
- Skipping the determinant check. Applying swap-negate-divide to
[2 4 ; 1 2]divides by zero. Computead - bcfirst, every time.
Try it
Invert A = [3 5 ; 1 2], then use the inverse to solve 3x + 5y = 11, x + 2y = 4.
Worked answer. Determinant: 3*2 - 5*1 = 6 - 5 = 1. Swap and negate: A^(-1) = (1/1)[2 -5 ; -1 3] = [2 -5 ; -1 3]. Solve with b = [11 ; 4]: first entry 2*11 + (-5)*4 = 22 - 20 = 2, second entry -1*11 + 3*4 = -11 + 12 = 1. So x = 2, y = 1. Check: 3*2 + 5*1 = 11 and 2 + 2 = 4. Both hold.
Recap
- The inverse is the undo matrix:
A A^(-1) = A^(-1) A = I, and it is unique when it exists. - For 2x2: swap the diagonal, negate the off-diagonal, divide by
ad - bc; a zero determinant means singular. - In general, row-reduce
[A | I]until the left block isI; the right block is thenA^(-1). - The solution of
Ax = bisx = A^(-1) b, and(AB)^(-1) = B^(-1) A^(-1).
The number ad - bc kept deciding everything in this lesson. The next module gives that number its own theory: the determinant.
Retrieve, check, and revisit
Before looking back: Solve [3 1;0 2]x=[7;2] by back substitution, then check using the inverse.
Feedback after attempting
x2=1,x1=2. The inverse is [1/3 -1/6;0 1/2], and its product with b is [2;1].
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Solve a second right-hand side [4;2] without repeating a factorization. Explain why reusing factors helps. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), matrix inverses. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), invertible matrix thm. Read the source.
- MIT OpenCourseWare, Gilbert Strang. Linear Algebra (Fall 2011), factorization into a lu, lecture and summary. Read the source.
- Key terms
- Inverse matrix
- A matrix A^(-1) with A A^(-1) = A^(-1) A = I.
- Invertible (nonsingular)
- A square matrix that has an inverse.
- Singular matrix
- A square matrix with no inverse; its determinant is zero.
- Determinant of a 2x2
- The number ad - bc for the matrix [a b ; c d].
- Matrix equation Ax = b
- The compact form of a linear system with coefficient matrix A.
Module 3: Determinants
Compute determinants of 2x2 and 3x3 matrices and interpret what they measure.
Determinants of 2x2 and 3x3 Matrices
- Compute a 2x2 determinant and a 3x3 determinant by cofactor expansion.
- Use the shortcut diagonal method for a 3x3 determinant.
- State how row operations affect the determinant.
The determinant is a single number attached to a square matrix that captures crucial information: whether the matrix is invertible, and geometrically, how it scales area or volume. We write it det(A) or with vertical bars around the array. One number summarizing a whole grid sounds too good to be true, but the last lesson already showed it in action: the 2x2 inverse exists exactly when ad - bc is nonzero. This lesson learns to compute that number for 2x2 and 3x3 matrices, several ways, and to predict how it responds to row operations.
The 2x2 determinant
For A = [a b ; c d], the determinant is det(A) = ad - bc: the product of the main diagonal minus the product of the anti-diagonal. Read it aloud for [3 1 ; 5 2]: three times two, minus one times five. So det = 6 - 5 = 1. When the determinant is zero the matrix is singular; when it is nonzero the matrix is invertible.[1]
A zero is worth seeing once. For [2 4 ; 1 2], the determinant is 2*2 - 4*1 = 0. Look at the columns: [4 ; 2] is twice [2 ; 1]. The two columns point along one line, so the parallelogram they would normally span has collapsed flat, and zero area is exactly what det = 0 reports. The determinant is already doing geometry; the next lesson makes that official.
Two more quick reads build intuition. The identity has det(I) = 1*1 - 0*0 = 1: the do-nothing matrix scales nothing. A diagonal matrix multiplies along its diagonal: det[3 0 ; 0 2] = 3*2 - 0*0 = 6, the natural guess for a machine that stretches one axis by 3 and the other by 2. Keep these anchors in mind; every method below must agree with them.
Key idea: for 2x2, cross-multiply and subtract; zero means collapsed and singular.
![The columns [3;1] and [1;2] span a parallelogram of area 5; their positive determinant records its orientation.](/assets/img/math-linalg-reviewed/det-area.png)
The 3x3 determinant by cofactor expansion
For a 3 by 3 matrix, expansion along the first row uses each entry times a signed smaller determinant. Delete entry (i,j)'s row and column to obtain a submatrix. The determinant of that submatrix is the minor Mij, a number. The cofactor is Cij = (-1)i+jMij. For[2]
A = [a b c ; d e f ; g h i],
det(A) = a(ei - fh) - b(di - fg) + c(dh - eg).
The sign attached to each position comes from a simple rule: position (i, j) carries the sign of (-1)^(i+j). Row 1 gives plus, minus, plus. The full 3x3 checkerboard reads + - + ; - + - ; + - +. The middle minus in the first row is the one everyone forgets at least once, so say the pattern to yourself as you write: plus, minus, plus.
Worked example. Compute the determinant of
A = [2 1 0 ; 1 3 1 ; 0 2 1].
- First term: the entry 2, times the minor left after deleting row 1 and column 1. That submatrix is
[3 1 ; 2 1]with determinant3*1 - 1*2 = 1. Contribution:+2 * 1 = 2. - Second term: the entry 1, times the determinant of the submatrix
[1 1 ; 0 1], whose determinant is1*1 - 1*0 = 1. The checkerboard says minus: contribution-1 * 1 = -1. - Third term: the entry 0, times the determinant of the submatrix
[1 3 ; 0 2]. Whatever that minor is, zero times it is 0. - Add:
2 - 1 + 0 = 1.
So det(A) = 1. Because it is nonzero, this matrix is invertible.
Here is the useful secret: you may expand along any row or any column, keeping each entry's checkerboard sign, and the answer never changes.
Let us redo the same matrix down column 3, whose entries are 0, 1, 1 with signs plus, minus, plus. The 0 contributes nothing. The entry 1 in position (2, 3) takes minor [2 1 ; 0 2], determinant 4 - 0 = 4, with a minus sign: -4. The entry 1 in position (3, 3) takes minor [2 1 ; 1 3], determinant 6 - 1 = 5, with a plus sign: +5. Total: -4 + 5 = 1. Same answer, less work. Strategy: expand along the row or column with the most zeros.
Key idea: cofactor expansion is entry times minor times checkerboard sign, along any single row or column you like.
The diagonal shortcut for 3x3
A quick alternative (which works only for 3x3) sums the three full down-right diagonals and subtracts the three full down-left diagonals: det = aei + bfg + cdh - ceg - bdi - afh. Applying it to the same matrix: down-right gives 2*3*1 + 1*1*0 + 0*1*2 = 6 + 0 + 0 = 6; down-left gives 0*3*0 + 1*1*1 + 2*1*2 = 0 + 1 + 4 = 5; the determinant is 6 - 5 = 1, matching the cofactor result.[2]
Treat this rule (often called the rule of Sarrus) as a 3x3-only convenience. It does not extend to 4x4 or beyond: a 4x4 determinant has 24 signed terms, and the diagonal picture produces only 8 of them. For anything larger than 3x3, use cofactor expansion or the row-reduction method below.
How row operations change a determinant
- Swapping two rows multiplies the determinant by -1.[1]
- Scaling a row by
kmultiplies the determinant by k. - Adding a multiple of one row to another leaves the determinant unchanged.
Watch all three rules on A = [3 1 ; 5 2], whose determinant is 1. Swap the rows: [5 2 ; 3 1] has determinant 5*1 - 2*3 = -1. Multiplied by -1, as promised. Double the first row of A: [6 2 ; 5 2] has determinant 12 - 10 = 2. Doubled, as promised. Replace R2 with R2 - R1: [3 1 ; 2 1] has determinant 3 - 2 = 1. Unchanged, as promised. The third rule is the powerful one: a forward pass using only row replacements preserves the determinant. Row swaps change its sign, and scaling a row changes its magnitude by that factor; elimination may use either operation.

Determinants by triangular reduction
For a triangular matrix (all zeros below the diagonal), every cofactor expansion collapses and the determinant is the product of the diagonal entries. Combine that with the three rules and you get the method professionals use: row-reduce to triangular form, multiply the diagonal, and account for any swaps or scalings along the way.[1]
Worked example. Reduce A = [2 1 0 ; 1 3 1 ; 0 2 1]. Replace R2 with R2 - (1/2)*R1: 1 - 1 = 0, 3 - 0.5 = 2.5, 1 - 0 = 1, giving [0 2.5 1]. R3 already starts with 0.
Now clear column 2: the multiplier is 2/2.5 = 0.8, so replace R3 with R3 - 0.8*R2: 2 - 2 = 0 and 1 - 0.8 = 0.2, giving [0 0 0.2]. The triangular matrix has diagonal 2, 2.5, 0.2. Since we used only replacements (no swaps, no scalings), det(A) = 2 * 2.5 * 0.2 = 1. It agrees with both earlier computations, and for large matrices this route is dramatically faster than cofactors.
Key idea: replacements are free, swaps flip the sign, scalings must be paid back, and a triangular determinant is the product of its diagonal.
A real use: area from coordinates
Surveyors, game engines, and mapping software constantly need the area of a triangle whose corners are known coordinates. Determinants deliver it without any lengths or angles. For a triangle with vertices (1, 1), (4, 2), and (2, 5), build the two edge vectors leaving the first vertex: [4 - 1 ; 2 - 1] = [3 ; 1] and [2 - 1 ; 5 - 1] = [1 ; 4]. The parallelogram they span has area |det[3 1 ; 1 4]| = |3*4 - 1*1| = 11, and the triangle is half of it: 5.5 square units.[3]
The same computation is a collinearity detector. Points (0, 0), (1, 1), (3, 3) give edge vectors [1 ; 1] and [3 ; 3], and det[1 3 ; 1 3] = 3 - 3 = 0: zero area, so the three points sit on one line. Graphics code uses exactly this test to decide whether a corner turns left or right, with the sign of the determinant telling which.
Try reversing the order of the two edge vectors in the triangle example: det[1 3 ; 4 1] = 1 - 12 = -11. Same size, opposite sign. The magnitude is still the area; the sign records which way around the triangle you listed the corners, counterclockwise or clockwise. That orientation bit is free extra information, and the next lesson explains what it means for transformations.
Common misconceptions
- Dropping the middle minus. First-row expansion reads plus, minus, plus. Writing
a(ei - fh) + b(di - fg) + c(dh - eg)is the single most common determinant error. - Using the diagonal shortcut on a 4x4. Sarrus is 3x3-only; larger matrices need cofactors or reduction.
- Scaling the whole matrix like a single row. Doubling every entry of an n x n matrix multiplies the determinant by
2^n, once per row. Check:det[2 0 ; 0 2] = 4, which is2^2timesdet(I) = 1, not 2 times. - Adding determinants across a sum.
det(A + B)is generally notdet(A) + det(B): withA = B = I(2x2), the left side isdet(2I) = 4while the right side is1 + 1 = 2. - Forgetting the bookkeeping during reduction. Every swap flips the sign and every row scaling scales the determinant; log them as you go, or the final product silently drifts.
A swap and a scaling with an audit trail
Start with A = [0 2 ; 3 4]. Swap its rows to obtain B = [3 4 ; 0 2]. Then det(B) = 6 and det(A) = -6. If you additionally halve the second row to get C = [3 4 ; 0 1], then det(C) = 3. Undo both determinant effects: det(A) = -2 det(C) = -6.
More generally, if U is produced by s swaps and row scalings whose factors have product k, together with row replacements, then det(U) = (-1)sk det(A). Thus det(A) = (-1)sdet(U)/k when k is nonzero. Use the diagonal entries of the square triangular U, including any zeros. Multiplying only the nonzero pivots of a singular matrix would give the wrong result.
Try it
Compute det[1 2 0 ; 3 1 2 ; 0 4 1] by expanding along the first row, then confirm with the diagonal shortcut.
Worked answer. Expansion: first term +1 * det[1 2 ; 4 1] = 1*(1 - 8) = -7. Second term -2 * det[3 2 ; 0 1] = -2*(3 - 0) = -6. Third term +0 * (anything) = 0. Total: -7 - 6 = -13. Shortcut check: down-right diagonals give 1*1*1 + 2*2*0 + 0*3*4 = 1; down-left diagonals give 0*1*0 + 4*2*1 + 1*3*2 = 0 + 8 + 6 = 14; and 1 - 14 = -13. The two methods agree.
Recap
- 2x2:
ad - bc. 3x3: cofactor expansion with checkerboard signs, along any row or column, or the Sarrus shortcut. - Zeros are your friends: expand along the row or column that has the most of them.
- Row swaps flip the sign, row scalings scale the determinant, and replacements change nothing, so triangular reduction computes determinants fast.
- Nonzero determinant means invertible; zero means the matrix collapses space flat.
Next lesson: what the determinant means, its product rule, and why the absolute value measures area and volume.
Retrieve, check, and revisit
Before looking back: Find det[0 2;3 1] by the formula and by a row swap.
Feedback after attempting
The formula gives -6. Swapping rows produces triangular [3 1;0 2], determinant 6; one swap reverses its sign.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Build a 3 by 3 triangular example with one zero diagonal entry and explain the determinant. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), determinants definitions properties. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), determinants cofactors. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), determinants volumes. Read the source.
- Key terms
- Determinant
- A scalar attached to a square matrix that is nonzero exactly when the matrix is invertible.
- Minor
- The determinant of the submatrix left after deleting one row and one column.
- Cofactor expansion
- Computing a determinant as a signed sum of entries times their minors.
- Checkerboard signs
- The alternating + - + pattern used in cofactor expansion.
- Triangular determinant
- For a triangular matrix, the determinant is the product of the diagonal entries.
Properties and Uses of the Determinant
- Use the determinant to test invertibility.
- Apply the product rule det(AB) = det(A)det(B).
- Interpret the determinant as a scale factor for area and volume.
The determinant is more than a computation; it is a diagnostic that ties together nearly every idea in this course. You now know how to produce the number. This lesson is about what the number is telling you: whether a matrix can be undone, how determinants behave under multiplication, and why the absolute value is literally an area or a volume. Each property below gets a numerical test drive, so nothing rests on faith.
Invertibility test
The single most useful fact: a square matrix A is invertible if and only if det(A) is not zero. A zero determinant signals a singular matrix, a system that is either inconsistent or has infinitely many solutions, and columns that are linearly dependent (a connection you will meet in Module 5). So the determinant is a one-number test for a whole cluster of properties.[1]
Run the test on the matrices from earlier lessons. det[3 1 ; 5 2] = 6 - 5 = 1, nonzero, so [3 1 ; 5 2] is invertible and any system with these coefficients has exactly one solution, whatever the right-hand side. The 3x3 workhorse from last lesson, [2 1 0 ; 1 3 1 ; 0 2 1], had determinant 1: invertible as well.
Now det[2 4 ; 1 2] = 4 - 4 = 0, so that matrix is singular: the system 2x + 4y = b1, x + 2y = b2 either contradicts itself or repeats itself, depending on the constants. Which of the two happens depends on b, and that is worth remembering: a zero determinant does not by itself say "no solution." It says "not exactly one."
Key idea: nonzero determinant means invertible and a unique solution; zero determinant means the one-solution case is off the table.
The multiplicative property
Determinants respect multiplication: for square matrices of the same size,[1]
det(AB) = det(A) * det(B).
Watch it happen. Take A = [1 2 ; 3 4] with det(A) = 4 - 6 = -2, and B = [2 0 ; 1 3] with det(B) = 6 - 0 = 6. The product is AB = [1*2 + 2*1, 1*0 + 2*3 ; 3*2 + 4*1, 3*0 + 4*3] = [4 6 ; 10 12], and det(AB) = 4*12 - 6*10 = 48 - 60 = -12. Sure enough, (-2) * 6 = -12. If each machine scales area by its own factor, running them in sequence scales area by the product; that is the geometric heart of the rule.
Two consequences follow from multiplicativity, and a third property follows from the determinant definition. First, the inverse rule: since det(A) det(A^(-1)) = det(I) = 1, we get det(A^(-1)) = 1 / det(A); for the A above, det(A^(-1)) = -1/2. Second, powers: det(A^k) = det(A)^k, so det(A^3) = (-2)^3 = -8 with no matrix multiplication at all. Third, the transpose changes nothing: det(A^T) = det(A). Check: A^T = [1 3 ; 2 4] has determinant 4 - 6 = -2, the same as A. This last fact is why every row rule from the previous lesson is also a column rule.
Note what is not on the list: determinants do not add. In general det(A + B) is not det(A) + det(B). With A = B = I (2x2), the left side is det(2I) = 4 while the right side is 1 + 1 = 2. Multiplication is the operation determinants love; addition is not.
The product rule also lets geometry check itself. Apply the stretch B = [2 0 ; 0 3] (area factor 6) and then the shear S = [1 1 ; 0 1] (area factor 1). The combined machine is SB = [1*2 + 1*0, 1*0 + 1*3 ; 0*2 + 1*0, 0*0 + 1*3] = [2 3 ; 0 3], and det(SB) = 2*3 - 3*0 = 6. Exactly 1 * 6: the shear added slant but no area, and the product rule knew it in advance.
Key idea: det multiplies over products, inverts over inverses, survives transposes, and refuses to distribute over sums.
![The first map has determinant 2; the second has determinant 3. Their composition [2 1;0 3] has determinant 6.](/assets/img/math-linalg-reviewed/det-composition.png)
Reading the determinant off the pivots
The row-operation rules from last lesson have a tidy consequence: a forward pass using only row replacements preserves the determinant. Any swaps or scalings require separate adjustments. So after reducing A to triangular form, the determinant of A is the product of the diagonal entries of the resulting square triangular matrix, including any zeros, adjusted by a factor of -1 per row swap and by any row scalings you performed. In the reduction of [2 1 0 ; 1 3 1 ; 0 2 1], the pivots came out 2, 2.5, and 0.2, and their product is 2 * 2.5 * 0.2 = 1, the determinant.[1]
Mind the bookkeeping when swaps enter. If reaching triangular form required one row swap, negate the diagonal product; two swaps cancel. Divide by the product of any row-scaling factors. This pivot route is how software computes determinants of large matrices, since cofactor expansion grows explosively while elimination stays polite. It also explains a fact you will meet again in Module 5: a matrix is invertible exactly when elimination finds a full set of nonzero pivots, because that is precisely when the pivot product, the determinant, avoids zero.
Geometric meaning: area and volume
Place the two columns of a 2x2 matrix as arrows from the origin. They span a parallelogram, and the absolute value of the determinant is that parallelogram's area. For A = [3 0 ; 0 2], the columns are along the axes with lengths 3 and 2, spanning a 3-by-2 rectangle of area 6, and indeed det(A) = 6.[2]
A subtler example: the shear [1 1 ; 0 1] has determinant 1*1 - 1*0 = 1. It tilts the unit square into a slanted parallelogram, yet the area stays exactly 1: base 1, height 1, lean irrelevant. And for [3 1 ; 1 4], the determinant 12 - 1 = 11 matches the parallelogram area computed coordinate by coordinate in the last lesson. The determinant is the area scale factor of the machine: feed it any region of area S, and the output region has area |det| * S.
In three dimensions the absolute value of a 3x3 determinant gives the volume of the parallelepiped (a slanted box) spanned by its three columns. The box with edges [1 ; 0 ; 0], [0 ; 2 ; 0], [0 ; 0 ; 5] has volume det = 1*2*5 = 10, matching length times width times height.
A determinant of zero then means the shape has collapsed flat (zero area or volume), which is exactly why zero-determinant matrices are singular: they squash space into a lower dimension and cannot be undone. The sign of the determinant records orientation, whether the transformation flips space (negative) or preserves its handedness (positive).
Try the sign story on familiar machines. A rotation by 90 degrees has matrix [0 -1 ; 1 0] and determinant 0*0 - (-1)(1) = 1: area preserved, no flip, as a rotation should. A reflection across the x-axis, [1 0 ; 0 -1], has determinant -1: area preserved, but space is mirrored, and any text drawn in the plane would come out backwards. Graphics programmers check exactly this sign to catch accidentally mirrored textures.
Cramer's rule: solving small systems with determinants
Determinants can even solve systems directly. For a 2x2 system Ax = b with det(A) nonzero, Cramer's rule says: to find each unknown, replace that unknown's column of A with b, take the determinant, and divide by det(A).[3]
Worked example. Solve x + 2y = 5, 3x + 4y = 11. The coefficient determinant is D = det[1 2 ; 3 4] = 4 - 6 = -2. For x, replace column 1 with the constants: Dx = det[5 2 ; 11 4] = 20 - 22 = -2, so x = Dx / D = (-2)/(-2) = 1. For y, replace column 2: Dy = det[1 5 ; 3 11] = 11 - 15 = -4, so y = (-4)/(-2) = 2. Check: 1 + 2*2 = 5 and 3*1 + 4*2 = 11. Both hold.
Cramer's rule shines for small symbolic systems and for proving formulas, because it displays the answer as a ratio of determinants. For large numerical systems it is hopelessly slow compared with elimination, so treat it as a precision tool, not a workhorse.
A real use: how transformations scale a design
Imagine a design app scaling a logo with the matrix [2 0 ; 0 3]: twice as wide, three times as tall. Every region of the logo, however curvy, has its area multiplied by det = 6, so the app can update the reported square-footage of a floor plan, or the ink coverage of a print job, without remeasuring anything. A rotation (det = 1) changes no areas; a mirror (det = -1) changes no areas but flips orientation. In calculus, the same idea reappears as the Jacobian determinant, the local area scale factor used whenever you change variables in a double integral.
Common misconceptions
- Adding determinants.
det(A + B) = det(A) + det(B)fails even for identity matrices; only products factor. - Forgetting the row count in det(kA). Scaling an n x n matrix by k scales the determinant by
k^n. For 3x3,det(2A) = 8 det(A), not2 det(A). - Reading det = 0 as "no solution." It means "not exactly one": the system is inconsistent for some right-hand sides and has infinitely many solutions for others.
- Reporting a negative area. Area is
|det|; the sign is orientation information, not a negative quantity of space. - Asking for the determinant of a nonsquare matrix. A 2 x 3 matrix has no determinant; the concept is defined only for square arrays.
Equal determinants can hide different behavior
The identity I and A = [1000 0 ; 0 0.001] both have determinant 1. Yet A stretches horizontal lengths by 1000 and compresses vertical lengths by 1000. Equal area factors do not imply equal lengths, angles, eigenvalues, or numerical sensitivity. Likewise a negative determinant means reversed orientation, but not necessarily a rigid reflection.
A short proof explains the singular case. If two columns are dependent in a 2 by 2 matrix, the parallelogram has zero area. In any square size, elimination reaches a triangular matrix with a zero diagonal entry exactly when full rank fails. Reversible row operations change the determinant only by nonzero factors, so determinant zero is equivalent to singularity. The argument uses the elimination rules, not a handful of numerical examples.

Try it
Suppose A and B are 3x3 with det(A) = 3 and det(B) = -5. Find det(A^2 B), det(2A), and det(B^T).
Worked answer. Products factor: det(A^2 B) = det(A)^2 * det(B) = 9 * (-5) = -45. Scaling a 3x3 by 2 multiplies the determinant by 2^3 = 8: det(2A) = 8 * 3 = 24. Transposing changes nothing: det(B^T) = -5.
Recap
- Invertible exactly when the determinant is nonzero; zero rules out the unique-solution case.
det(AB) = det(A)det(B),det(A^(-1)) = 1/det(A),det(A^T) = det(A); sums do not cooperate.|det|is the area or volume scale factor of the transformation; the sign records whether space is flipped.- Cramer's rule solves small systems as ratios of determinants.
These properties recur constantly. When you later ask whether a transformation is reversible, whether a basis is valid, or whether eigenvalues make a matrix singular, the determinant is the number you reach for.
Retrieve, check, and revisit
Before looking back: A 3 by 3 matrix has determinant -2. Find det(3A), det(A^T), and det(A^(-1)).
Feedback after attempting
They are -54, -2, and -1/2. Scaling all three rows multiplies the determinant by 3^3.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Explain why a determinant of 1 does not imply a length-preserving transformation. Give a matrix. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), determinants definitions properties. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), determinants volumes. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), determinants cofactors. Read the source.
- Key terms
- Invertibility test
- A is invertible exactly when det(A) is nonzero.
- Product rule for determinants
- det(AB) = det(A) det(B).
- Inverse determinant rule
- det(A^(-1)) = 1 / det(A).
- Signed area
- For two ordered vectors in the plane, their column determinant is signed area; its absolute value is parallelogram area.
- Orientation
- The sign of the determinant, recording whether space is flipped.
Module 4: Vectors and Vector Spaces
Work with vectors in R^n and abstract the rules into the definition of a vector space and its subspaces.
Vectors in R^n
- Add and scale vectors and compute linear combinations.
- Compute the dot product, length, and angle between vectors.
- Describe the span of a set of vectors.
A vector in R^n (read: R n, the space of lists of n real numbers) is an ordered list of n real numbers, written as a column such as v = [2 ; 3] or w = [1 ; -1 ; 4]. There are two equally good mental pictures, and it pays to hold both. Algebraically, a vector is its coordinates, nothing more. Geometrically, it is an arrow from the origin to the point with those coordinates: [2 ; 3] points 2 right and 3 up.
The list picture is why vectors run modern computing. A weather station's noon report (temperature, humidity, wind speed) is a vector in R^3; your ratings of five movies form a vector in R^5; a grayscale photo is a vector with one entry per pixel. Any object described by several numbers at once is a vector, and linear algebra is the arithmetic of such objects. Vectors are the raw material of the whole subject.
Addition, scaling, and linear combinations
Vectors of the same length add entry by entry, and a scalar multiplies every entry, exactly like one-column matrices. Concretely: [2 ; 3] + [1 ; -1] = [2+1 ; 3+(-1)] = [3 ; 2], and 2[1 ; 2] = [2 ; 4], while -1[1 ; 2] = [-1 ; -2], the same arrow reversed. Geometrically, addition follows the tip-to-tail rule: slide the second arrow so it starts where the first ends, and the sum runs from the original start to the final tip. Scaling stretches or shrinks an arrow along its own line.[1]
Combining the two operations gives the central construction of linear algebra. A linear combination of vectors v1, ..., vk is any expression c1 v1 + c2 v2 + ... + ck vk with scalar weights ci. For example, 2[1 ; 0] + 3[0 ; 1] = [2 ; 3]: two steps east plus three steps north.
Another, with v = [1 ; 2] and w = [3 ; -1]: the combination 2v - w is [2 ; 4] - [3 ; -1] = [2 - 3 ; 4 + 1] = [-1 ; 5]. Matrix-vector products, spans, bases, everything ahead is built from weighted sums like these.
Key idea: add entry by entry, scale every entry, and call any weighted sum a linear combination.
The dot product, length, and angle
The dot product of two equal-length vectors multiplies matching entries and adds: v . w = v1 w1 + v2 w2 + ... + vn wn (read: v dot w), producing a single number. For v = [3 ; 4] and w = [2 ; 1], v . w = 3*2 + 4*1 = 6 + 4 = 10. The dot product measures both size and alignment:[3]
- The length (or norm) of
vis||v|| = sqrt(v . v). Forv = [3 ; 4],||v|| = sqrt(9 + 16) = sqrt(25) = 5. - The angle between two nonzero vectors satisfies
v . w = ||v|| ||w|| cos(theta). - Two vectors are orthogonal (perpendicular) exactly when
v . w = 0.
The length formula is the Pythagorean theorem wearing new clothes: the arrow [3 ; 4] is the hypotenuse of a right triangle with legs 3 and 4, so its length must be 5. Dividing a nonzero vector by its own length produces a unit vector, length exactly 1, pointing the same way: [3 ; 4] / 5 = [0.6 ; 0.8], and indeed sqrt(0.36 + 0.64) = sqrt(1) = 1. Unit vectors answer "which direction?" with no opinion about "how far?"
Length also measures distance between points: the distance from (1, 2) to (4, 6) is the length of the difference vector [4 - 1 ; 6 - 2] = [3 ; 4], which is 5. And the angle formula turns arithmetic into geometry. Take v = [1 ; 0] and w = [1 ; 1]: the dot product is 1, the lengths are 1 and sqrt(2), so cos(theta) = 1 / sqrt(2) = 0.707 approximately, giving theta = 45 degrees, exactly what a sketch shows for the diagonal of a square.
The sign of the dot product is a quick alignment gauge even without computing angles: positive means the vectors point broadly the same way (angle under 90 degrees), negative means broadly opposite (over 90 degrees), and zero means perpendicular. Test perpendicularity on [2 ; 1] and [-1 ; 2]: the dot product is 2*(-1) + 1*2 = -2 + 2 = 0, so they are orthogonal. For instance [1 ; 0] and [0 ; 1] have dot product 0, confirming the axes are perpendicular.
Two famous inequalities keep these quantities honest. The Cauchy-Schwarz inequality says |v . w| can never exceed ||v|| ||w||, which is why the cosine formula always produces a value between -1 and 1. And the triangle inequality says ||v + w|| <= ||v|| + ||w||: a detour is never shorter than the straight route. Check the second with v = [3 ; 0], w = [0 ; 4]: the sum [3 ; 4] has length 5, comfortably below 3 + 4 = 7.
Key idea: the dot product is one number scoring alignment; with itself it gives squared length, and zero means perpendicular.
![The nonzero vectors [2;1] and [-1;2] have dot product zero and form a right angle.](/assets/img/math-linalg-reviewed/dot-orthogonal.png)
Span
The span of a set of vectors is the collection of all their linear combinations, that is, every vector you can build from them by scaling and adding. The span of a single nonzero vector in R^2 is the line through the origin along that vector: all multiples t[1 ; 2], one point for each real t. Two vectors in R^2 span the plane exactly when neither is a scalar multiple of the other. Opposite-pointing vectors are still collinear and span only a line.[2]
Asking whether a particular vector lies in a given span is the same as asking whether a certain linear system is consistent, which is why Gaussian elimination from Module 1 quietly underlies this geometric language.
Worked example. Is [5 ; 1] in the span of v = [1 ; 2] and w = [1 ; -1]? We need weights with c1 v + c2 w = [5 ; 1]. Reading the two coordinates separately gives a system: top entries say c1 + c2 = 5, bottom entries say 2 c1 - c2 = 1. Add the equations: 3 c1 = 6, so c1 = 2, and then c2 = 3.
Confirm the recipe: 2[1 ; 2] + 3[1 ; -1] = [2 + 3 ; 4 - 3] = [5 ; 1]. Yes: the target is reachable, with weights 2 and 3. Because neither of these two spanning vectors is a scalar multiple of the other, every vector of R^2 is reachable the same way; their span is the whole plane.
Contrast that with [1 ; 2] and [2 ; 4]. The second is twice the first, so any combination c1[1 ; 2] + c2[2 ; 4] equals (c1 + 2 c2)[1 ; 2], a multiple of one direction. The span is only the line through [1 ; 2], described parametrically as all points (t, 2t).
A vector like [5 ; 1] is off that line, since a point on the line must have second coordinate double the first, and 1 is not 2*5. Two vectors do not automatically span a plane; they must contribute different directions. Span is how we describe, precisely, the reach of a set of vectors.
Key idea: span is everything buildable from the given vectors, and membership questions are systems of equations in the weights.
![All multiples of the nonzero vector [1;2] lie on a line through the origin, including negative multiples and zero.](/assets/img/math-linalg-reviewed/vector-span.png)
A real use: similarity scores from dot products
A simplified comparison uses ratings u = [5 ; 1 ; 4], v = [4 ; 1 ; 5], and w = [1 ; 5 ; 1]. The dot products are u dot v = 41 and u dot w = 14. Raw dot products depend on vector lengths as well as alignment, so these numbers alone should not be interpreted as calibrated preference or prediction scores.[3]
For nonzero vectors, cosine similarity is (u dot v)/(||u||||v||). Here ||u|| = ||v|| = sqrt(42), while ||w|| = sqrt(27), giving 41/42, about 0.976, and 14/sqrt(1134), about 0.416. Multiplying a vector by a positive constant leaves its cosine similarities unchanged.
Adding a constant to every rating is different from scaling and is not removed by cosine normalization. Centering ratings is a separate modeling choice. Missing ratings, feature units, and the meaning of zero all matter. A zero vector has no defined cosine similarity or direction. This example teaches vector arithmetic, not a complete recommendation system.
Common misconceptions
- Expecting the dot product to be a vector. It is a single number. If your "dot product" has brackets, entries were multiplied without the final adding.
- Adding lengths across a sum.
||v + w||is usually less than||v|| + ||w||: withv = [3 ; 0]andw = [0 ; 4], the sum[3 ; 4]has length 5, not 7. Walking a bent path is longer than the straight line. - Forgetting the square root.
v . vis the squared length. The length of[3 ; 4]is 5, not 25. - Thinking span needs positive weights. Weights may be any real numbers, negative and zero included; the span of
[1 ; 0]contains[-7 ; 0]. - Forgetting the origin. Every span contains the zero vector (take all weights 0), so a description of a span that misses the origin is wrong.
Zero vectors, units, and geometric claims
The zero vector is orthogonal to every vector by the dot-product definition, but it has no direction and no defined angle with a nonzero vector. Normalizing it would divide by zero. For nonzero u and v, cosine lies in [-1,1] by Cauchy-Schwarz. The dot product is positive for acute angles and negative for obtuse angles.[3]
A list of temperature, humidity, and wind speed can be stored as a vector, but its raw Euclidean length mixes incompatible units. Changing temperature units changes that length without changing the weather. Scaling features and selecting an inner product require a modeling reason. Algebraic representability does not itself make a geometric comparison meaningful.
Try it
Let u = [2 ; -1 ; 3] and v = [1 ; 4 ; 2]. Compute u . v and ||u||, and decide whether the vectors are orthogonal.
Worked answer. Dot product: u . v = 2*1 + (-1)*4 + 3*2 = 2 - 4 + 6 = 4. Length: ||u|| = sqrt(2^2 + (-1)^2 + 3^2) = sqrt(4 + 1 + 9) = sqrt(14), about 3.74. Since u . v = 4 is not zero, the vectors are not orthogonal; the positive sign says the angle between them is less than 90 degrees.
Recap
- A vector is a list of numbers and an arrow from the origin; both pictures are correct and useful.
- Addition is entrywise and tip-to-tail; scaling stretches; linear combinations are weighted sums.
v . wscores alignment;||v|| = sqrt(v . v); zero dot product means orthogonal.- The span of a set is everything its combinations can reach, and membership is a solvable system.
Next we ask what makes a collection of vectors, with these two operations, into a self-contained world: the vector space.
Retrieve, check, and revisit
Before looking back: For u=[1;2;-1] and v=[2;0;2], find u dot v and both squared lengths.
Feedback after attempting
The dot product is 0; the squared lengths are 6 and 8. The nonzero vectors are perpendicular.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Find a third vector in span{u,v} and verify its dot product with u from linearity. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), vectors. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), spans. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), dot product. Read the source.
- Key terms
- Vector
- An ordered list of n numbers, viewed as an arrow from the origin in R^n.
- Linear combination
- A weighted sum c1 v1 + ... + ck vk of vectors.
- Dot product
- v . w = v1 w1 + ... + vn wn, a single number measuring alignment.
- Norm (length)
- The length ||v|| = sqrt(v . v) of a vector.
- Orthogonal
- Two vectors are orthogonal (perpendicular) when their dot product is zero.
- Span
- The set of all linear combinations of a given collection of vectors.
Vector Spaces and Subspaces
- State the defining properties of a vector space.
- Test whether a subset is a subspace using the three closure conditions.
- Identify important subspaces such as lines and planes through the origin.
So far vectors have been columns of numbers. The power of linear algebra comes from noticing that many other objects, such as polynomials, functions, and matrices, obey the very same arithmetic rules: you can add them, you can scale them, and the familiar algebra of those operations goes through unchanged. Rather than proving every theorem separately for columns, for polynomials, and for matrices, mathematics captures the shared pattern once, with the abstract idea of a vector space. Any vector space satisfies the theorems whose stated hypotheses apply; results requiring finite dimension or an inner product need those additional structures.
What a vector space is
A vector space is a set V of objects called vectors, together with an addition and a scalar multiplication, that obey the familiar algebraic rules. Concretely, addition must be commutative and associative, there must be a zero vector that adds to leave things unchanged, every vector must have a negative, and scalar multiplication must distribute over addition in both ways, among a total of eight axioms. The point is not to memorize all eight but to recognize the pattern: the algebra of linear combinations follows the same rules. Calculus and geometric notions such as length require additional definitions. The space R^n itself is the model example.[3]
For reference, the eight axioms sort into two families:
- Addition rules:
u + v = v + u; grouping does not matter,(u + v) + w = u + (v + w); a zero vector exists withv + 0 = v; and everyvhas a negative withv + (-v) = 0. - Scaling rules:
c(u + v) = cu + cv; also(c + d)v = cv + dv; nested scalings multiply,c(dv) = (cd)v; and the scalar 1 changes nothing,1v = v.
It helps to see the club's other members. The set P2 of polynomials of degree at most 2 is a vector space: adding 1 + 2x and 3 - x + x^2 gives 4 + x + x^2, still degree at most 2; scaling 1 + 2x by 3 gives 3 + 6x; the zero polynomial plays the role of the zero vector. In fact a + bx + cx^2 behaves exactly like the column [a ; b ; c].
The set of all 2 by 2 real matrices is a vector space under entrywise addition and scaling. Real-valued functions on a fixed domain also form a vector space under pointwise operations. Fixed-length real sample arrays provide a mathematical model for signals; constraints such as clipping or amplitude limits generally do not define subspaces.
Non-members are equally instructive. The positive numbers with ordinary operations fail: scaling 5 by the scalar -1 gives -5, which has left the set. The first quadrant of R^2 (both coordinates nonnegative) is closed under addition, but scaling [1 ; 1] by -1 gives [-1 ; -1], outside the quadrant. A vector space must tolerate every scalar, negatives included.
Key idea: a vector space is any world where addition and scaling behave like they do in R^n; columns, polynomials, matrices, and signals all qualify.
Subspaces
Usually we care about a piece of a vector space that is itself a vector space. A subspace of V is a nonempty subset that is closed under the vector-space operations. To check that a subset W is a subspace, you only need three things:[1]
- The zero vector is in
W. Wis closed under addition: ifuandvare inW, so isu + v.Wis closed under scalar multiplication: ifvis inWandcis any scalar, thencvis inW.
If all three hold, W is automatically a vector space in its own right; if any fails, it is not a subspace. Why do three tests replace eight axioms? Because the arithmetic laws (commutativity, associativity, distribution) are inherited from the big space: they hold for all vectors of V, so in particular for the ones in W. The only genuine questions are whether the operations ever escape the subset, and whether the zero vector is present.
Note that condition 1 is really a convenience: if W is nonempty, taking c = 0 in condition 3 forces 0 into W. The empty set satisfies the two closure statements vacuously but is not a subspace. It is listed first because it is the fastest way to disqualify a candidate.

Worked example
Is the line W = { [t ; 2t] : t any real } a subspace of R^2?[1]
- Zero: setting
t = 0gives[0 ; 0], so the zero vector is inW. Good. - Addition:
[a ; 2a] + [b ; 2b] = [a+b ; 2(a+b)], again of the form[t ; 2t]. Closed. - Scaling:
c[a ; 2a] = [ca ; 2(ca)], still of the same form. Closed.
All three pass, so this line through the origin is a subspace. By contrast, the line { [t ; 2t + 1] } is not a subspace, because it misses the origin: no value of t gives [0 ; 0].
Two more candidates sharpen the eye. The set { [x ; y] : x + y = 0 } passes: the zero vector satisfies 0 + 0 = 0; if u = [x1 ; y1] and v = [x2 ; y2] each have coordinates summing to zero, the sum has (x1 + x2) + (y1 + y2) = 0 + 0 = 0; and scaling gives cx + cy = c(x + y) = 0. It is the line through the origin with slope -1.
The unit circle x^2 + y^2 = 1 fails immediately: it does not contain [0 ; 0], and it is not closed anyway, since [1 ; 0] + [0 ; 1] = [1 ; 1] has length sqrt(2), off the circle.
One subtle failure: the union of the two coordinate axes. It contains the origin, and any scalar multiple of an axis vector stays on its axis. But addition escapes: [1 ; 0] + [0 ; 1] = [1 ; 1] lies on neither axis. Closure under addition and closure under scaling are separate demands, and a subspace needs both.
Key idea: to certify a subspace, check zero, sums, and scalar multiples for arbitrary members; to refute one, exhibit a single escape.
The catalog for R^2 and R^3, and two builders
The subspaces of R^2 are exactly the zero vector alone, every line through the origin, and all of R^2; in R^3 they are the origin, lines through the origin, planes through the origin, and all of R^3. Passing through the origin is the non-negotiable requirement: any subspace must contain the zero vector. Nothing in between occurs: no curves, no half-planes, no shifted lines. Flat, through the origin, closed under the operations: that is the whole inventory.[1]
Two constructions manufacture subspaces automatically. First, the span of any set of vectors is always a subspace: sums of combinations are combinations, and scalar multiples of combinations are combinations, so closure is built in. Second, the solution set of a homogeneous system, { x : Ax = 0 }, is always a subspace, called the null space of A.
The check uses linearity of matrix multiplication: if Au = 0 and Av = 0, then A(u + v) = Au + Av = 0 + 0 = 0, and A(cu) = c(Au) = 0. These two builders, spans and null spaces, produce nearly every subspace you will meet in this course.
The same tests work far from R^n. Inside the space of 2x2 matrices, consider the symmetric ones, those with A^T = A. The zero matrix is symmetric. If A and B are symmetric, then (A + B)^T = A^T + B^T = A + B, so the sum is symmetric, and (cA)^T = c A^T = cA handles scaling. Three checks, and the symmetric matrices stand revealed as a subspace, no arrows in sight.
A real use: why superposition works
The equation Lf = 0, with a linear operator L on a specified vector space of functions, obeys superposition: L(af + bg) = aLf + bLg = 0 for any two solutions f and g and real scalars a,b. Compatible homogeneous linear boundary conditions are preserved too. This is the algebraic reason linear models can combine component solutions.[2]
The word linear is an assumption to verify in a physical model. Clipping, large-amplitude effects, and nonlinear components can break superposition. For a nonhomogeneous equation Ax = b with b nonzero, zero is not a solution. If a particular solution p exists, the complete solution set is p + Null(A): a translate of a subspace. If no p exists, the solution set is empty, not a shifted plane.
Common misconceptions
- Checking only the zero vector. Containing the origin is necessary, not sufficient. The unit disk contains
[0 ; 0], yet scaling[1 ; 0]by 10 escapes it. - Calling every line a subspace. Only lines through the origin qualify;
y = 2x + 1fails the zero test before anything else. - Testing with one convenient example. Closure must hold for all members and all scalars. The two-point set containing only
[0 ; 0]and[1 ; 1]contains zero, yet[1 ; 1] + [1 ; 1] = [2 ; 2]is outside. - Restricting scalars to positives. Subspace scaling includes negative and zero scalars; forgetting them is how the first quadrant sneaks past a careless check.
- Assuming vectors must be arrows. Polynomials, matrices, and signals form vector spaces too; the subspace test reads the same in every one of them.
![The union of the two coordinate axes contains zero and is closed under scalar multiplication, but [1;0]+[0;1]=[1;1] lies outside it.](/assets/img/math-linalg-reviewed/closure-counterexample.png)
Polynomial subspaces and a proof template
Work over the real scalars. In P2, including the zero polynomial, consider W = {p : p(1) = 0}. Zero is in W. If p(1) = q(1) = 0, then (p+q)(1) = 0. For every real c, (cp)(1) = c p(1) = 0. Hence W is a subspace.
Writing p(x) = a + bx + cx2, the condition is a + b + c = 0. Thus p(x) = b(x-1) + c(x2-1). This converts an abstract question into a homogeneous system in coefficients. In contrast, the set of polynomials of degree exactly 2 excludes the zero polynomial and fails closure when leading terms cancel.
When proving closure, use arbitrary members. Examples can illustrate a proof, but checking five specific pairs cannot establish a universal statement. A single counterexample can disprove one.
Try it
Is W = { [x ; y] : y = x^2 }, the parabola through the origin, a subspace of R^2?
Worked answer. The zero vector passes, since 0 = 0^2. Now test addition: [1 ; 1] and [2 ; 4] are both on the parabola, but their sum [3 ; 5] is not, because 3^2 = 9 and 5 is not 9. One escape settles it: W is not a subspace. Scaling fails too: 2[1 ; 1] = [2 ; 2], and 2^2 = 4, not 2. Curves bend; subspaces are flat.
Recap
- A vector space is any set with well-behaved addition and scaling; R^n, polynomials, matrices, and signals all qualify.
- A subspace is a subset passing three tests: contains zero, closed under addition, closed under scaling.
- Subspaces of R^2 and R^3 are flats through the origin; spans and null spaces are subspaces automatically.
- To refute a candidate, one concrete escape is enough.
Subspaces can be big or small. The next lesson builds the measuring tools: independence, basis, and dimension.
Retrieve, check, and revisit
Before looking back: Does W={(x,y):x+y=0} form a subspace? Repeat for x+y=1.
Feedback after attempting
The first is span{[1;-1]} and is closed under sums and scaling. The second excludes zero and fails the subspace test.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Test the set of polynomials p with p(1)=0 using the same proof structure. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), subspaces. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), solution sets. Read the source.
- MIT OpenCourseWare, Gilbert Strang. Linear Algebra (Fall 2011), matrix spaces rank 1 small world graphs, lecture and summary. Read the source.
- Key terms
- Vector space
- A set with addition and scalar multiplication obeying eight standard axioms.
- Zero vector
- The unique vector that leaves every vector unchanged when added.
- Subspace
- A subset that is itself a vector space under the same operations.
- Closed under addition
- The sum of any two members of the set stays in the set.
- Closed under scalar multiplication
- Any scalar multiple of a member stays in the set.
Module 5: Independence, Basis, and Dimension
Measure how efficiently a set of vectors describes a space with independence, basis, rank, and dimension.
Linear Independence and Basis
- Test a set of vectors for linear independence.
- Define a basis and explain why it must be independent and spanning.
- Recognize the standard basis of R^n.
Some vectors in a set carry new information; others are redundant, expressible from the rest. Imagine giving directions with three compass words, east, north, and northeast: the third adds nothing, because northeast is east plus north. Linear independence makes this notion of redundancy precise, and it leads to the single most important idea in the theory of vector spaces: the basis, a set of directions with no waste and no gaps.
Linear independence
Vectors v1, ..., vk are linearly independent if the only way to write the zero vector as a linear combination c1 v1 + ... + ck vk = 0 is with every weight zero (c1 = ... = ck = 0). If some nonzero weights also produce zero, the vectors are linearly dependent, meaning at least one is a combination of the others and adds nothing new.[1]
Why is a zero combination the right test? Because if, say, 2 v1 - v2 = 0, then v2 = 2 v1: a hidden zero combination is exactly a hidden recipe for one vector in terms of the rest.
Worked example. Are v1 = [1 ; 2] and v2 = [2 ; 4] independent? Notice v2 = 2 v1, so 2 v1 - v2 = 0 is a zero combination with nonzero weights. They are dependent. By contrast [1 ; 0] and [0 ; 1] are independent: c1[1 ; 0] + c2[0 ; 1] = [c1 ; c2] = [0 ; 0] forces c1 = c2 = 0.
A reliable test for any number of vectors: form a matrix with the vectors as columns and row-reduce. The vectors are independent exactly when every column has a pivot (no free variables). For square matrices, this is the same as a nonzero determinant: det[1 2 ; 1 3] = 3 - 2 = 1, so [1 ; 1] and [2 ; 3] are independent.
A full 3-vector run. Are v1 = [1 ; 0 ; 1], v2 = [0 ; 1 ; 1], v3 = [1 ; 1 ; 2] independent? Load them as columns: A = [1 0 1 ; 0 1 1 ; 1 1 2], and solve Ac = 0. Replace R3 with R3 - R1: [0 1 1]. Replace R3 with R3 - R2: [0 0 0]. The echelon form [1 0 1 ; 0 1 1 ; 0 0 0] has pivots in columns 1 and 2 only, so column 3 is free and the vectors are dependent.
Better yet, elimination hands us the recipe. With c3 = 1 free, row 2 says c2 + c3 = 0, so c2 = -1; row 1 says c1 + c3 = 0, so c1 = -1. Then -v1 - v2 + v3 = 0, in other words v3 = v1 + v2. Check: [1 ; 0 ; 1] + [0 ; 1 ; 1] = [1 ; 1 ; 2]. Confirmed: the third vector was the first two in disguise, and geometrically all three lie in one plane through the origin.
Three quick facts save time. Any set containing the zero vector is dependent, since 1 * 0 = 0 is already a nonzero-weight combination. Two vectors are dependent exactly when one is a scalar multiple of the other. And more than n vectors in R^n are always dependent: the matrix has more columns than rows, so pivots (at most one per row) cannot cover every column, and a free variable is guaranteed.
The geometry is worth carrying with you. One nonzero vector is always independent: a single direction. Two vectors are dependent exactly when they are collinear, squeezed onto one line. Three vectors in R^3 are dependent exactly when they are coplanar, as our worked trio was. Dependence always means the set lives in a smaller flat than its headcount suggests, and dimension, next lesson, will make "smaller flat" a number.
Key idea: independence means the only zero combination is the trivial one; pivots in every column certify it, and a free column exposes the dependency recipe.
![The pair [1;1],[2;2] is dependent. The pair [2;0],[1;2] is independent and is a basis of R2.](/assets/img/math-linalg-reviewed/basis-dependence.png)
Basis
A basis of a vector space (or subspace) is a set of vectors that is both[2]
- linearly independent (no redundancy), and
- spanning (their linear combinations produce the whole space).
A basis is thus a minimal, complete set of building blocks: enough to reach everything, with nothing wasted. Every vector in the space can be written as a linear combination of basis vectors in exactly one way, and those unique weights are the vector's coordinates in that basis.
Why exactly one way? Suppose a vector had two recipes in the same basis. Subtracting them gives a zero combination of the basis vectors whose weights are the differences of the two recipes. Independence forces every difference to be zero, so the recipes were identical after all. Spanning guarantees at least one recipe; independence guarantees at most one. A basis delivers both, which is what makes coordinates trustworthy.
Worked example. The vectors [1 ; 2] and [1 ; -1] form a basis of R^2: they are independent (neither is a multiple of the other; determinant 1*(-1) - 1*2 = -3, nonzero) and they span the plane. In the vectors lesson we found [5 ; 1] = 2[1 ; 2] + 3[1 ; -1], so the coordinates of [5 ; 1] in this basis are (2, 3). Same arrow, new address system.
The standard basis
The most familiar basis of R^n is the standard basis of unit vectors along the axes. In R^2 it is e1 = [1 ; 0] and e2 = [0 ; 1]; in R^3 it adds e3 = [0 ; 0 ; 1]. Any vector [a ; b] is a*e1 + b*e2, so its coordinates in the standard basis are exactly its ordinary entries: read [7 ; -3] and you have read its address, 7 steps of e1 and -3 steps of e2. That is what makes this basis "standard": the address system and the raw data coincide.[2]
But other bases exist too, and choosing one is like rotating your graph paper. Take [1 ; 1] and [1 ; -1], a basis since det[1 1 ; 1 -1] = -1 - 1 = -2 is nonzero.
To find the coordinates of [4 ; 2] here, solve c1[1 ; 1] + c2[1 ; -1] = [4 ; 2]: the top entries give c1 + c2 = 4, the bottom give c1 - c2 = 2. Adding, 2 c1 = 6, so c1 = 3 and c2 = 1. Check: 3[1 ; 1] + 1[1 ; -1] = [3 + 1 ; 3 - 1] = [4 ; 2]. The coordinates are (3, 1). Choosing a clever basis is often the key to simplifying a problem, a theme that returns powerfully with eigenvectors in Module 7.
A labor-saving fact for R^n: if you have exactly n vectors there, you do not need to check independence and spanning separately. Load them as the columns of an n x n matrix; a nonzero determinant certifies both at once, and a zero determinant sinks both at once. The two properties are a package deal for square counts, which is why the determinant keeps appearing as a basis detector.
Key idea: a basis is an address system for a space; independence makes addresses unique, spanning makes every point reachable.
A real use: one displacement, two coordinate descriptions
A sensor can report the same displacement in different coordinate systems. Suppose an instrument uses basis b1 = [1 ; 1] and b2 = [1 ; -1]. Its reading (3,1) describes 3b1 + b2 = [4 ; 2] in standard coordinates. The physical vector is unchanged; only its coordinate description differs.[3]
The order and scale of the basis matter. Reversing b1 and b2 changes the reading to (1,3), and doubling b1 changes its coefficient from 3 to 3/2. A coordinate list without its basis is incomplete information. The next coordinate lesson develops this systematically.
Screen and printer color workflows need additional device, transfer-function, and gamut models. They should not be treated as a simple change of basis in an introductory proof. The sensor example isolates exactly the linear operation being taught.
Common misconceptions
- Confusing independent with perpendicular.
[1 ; 0]and[1 ; 1]are independent (neither is a multiple of the other) yet not orthogonal, since their dot product is 1. Orthogonal nonzero vectors are always independent, but not the other way around.[1] - Testing dependence only in pairs.
[1 ; 0],[0 ; 1],[1 ; 1]has no parallel pair, yet the trio is dependent because the third is the sum of the first two. Dependence is a property of the whole set. - Letting the zero vector in. Any set containing
0is automatically dependent, however innocent the other members. - Expecting "the" basis. A space has many bases; all of them share only their size. The standard basis is convenient, not mandatory.
- Forgetting to check both requirements. Three vectors in
R^2may span but cannot be independent; one vector inR^2may be independent but cannot span. A basis must do both jobs at once.
Build a basis in a polynomial space
In P2, consider p1 = 1+x, p2 = x+x2, and p3 = 1+x2. Relative to the standard polynomial basis (1,x,x2), their coefficient columns form [1 0 1 ; 1 1 0 ; 0 1 1], whose determinant is 2. They therefore form a basis of P2.
To express 2+3x+x2, solve a+c = 2, a+b = 3, b+c = 1. Adding the first and third and subtracting the second gives 2c = 0, so c = 0, a = 2, and b = 1. Thus 2p1 + p2 gives the polynomial. Equality of polynomials requires equality of every coefficient; one matching function value would not be enough.
The zero subspace has the empty basis. The set containing the zero vector is dependent, so it is not a basis even for that subspace. This convention keeps the basis-size and dimension rules consistent.

Try it
Decide whether v1 = [1 ; 2 ; 0], v2 = [2 ; 1 ; 3], v3 = [3 ; 3 ; 3] are linearly independent; if not, find the dependency.
Worked answer. Columns into a matrix: [1 2 3 ; 2 1 3 ; 0 3 3]. Replace R2 with R2 - 2*R1: [0 -3 -3]. Replace R3 with R3 + R2 (the new R2): 3 + (-3) = 0 and 3 + (-3) = 0, giving [0 0 0]. Pivots sit in columns 1 and 2 only, so the set is dependent.
Now extract the recipe. Set c3 = 1: row 2 says -3 c2 - 3 = 0, so c2 = -1; row 1 says c1 + 2(-1) + 3 = 0, so c1 = -1. The relation is v3 = v1 + v2. Check: [1 ; 2 ; 0] + [2 ; 1 ; 3] = [3 ; 3 ; 3]. Confirmed.
Recap
- Independent means no vector is buildable from the rest; the only zero combination is all-zero weights.
- Row-reduce the columns: pivots everywhere means independent; a free column yields the dependency recipe.
- A basis is independent and spanning, giving every vector exactly one coordinate address.
- The standard basis reads coordinates directly; other bases trade familiarity for problem-solving power.
Bases raise a counting question: do all bases of a space have the same size? Yes, and that number, the dimension, is next.
Retrieve, check, and revisit
Before looking back: Determine whether [1;0;1], [0;1;1], [1;1;2] form a basis of R3.
Feedback after attempting
The third is the sum of the first two, so the list is dependent and spans only a plane.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Replace the third vector by [0;0;1], then prove spanning and independence separately. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), linear independence. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), dimension. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), bases as coord systems. Read the source.
- Key terms
- Linearly independent
- The only linear combination equal to zero uses all-zero weights.
- Linearly dependent
- Some nonzero weights give a zero combination; one vector is redundant.
- Basis
- An independent, spanning set; a minimal complete set of building blocks.
- Spanning set
- A set whose linear combinations produce the whole space.
- Coordinates
- The unique weights expressing a vector in a given basis.
- Standard basis
- The unit vectors e1, e2, ... along the axes of R^n.
Rank and Dimension
- Define the dimension of a vector space as the size of any basis.
- Compute the rank of a matrix from its pivots.
- Apply the rank-nullity theorem.
How big is a vector space? Not how many vectors it holds (usually infinitely many), but how many independent directions it has. That count is its dimension, and for matrices the closely related number is the rank. Between them they answer the practical questions of this module: how much room a subspace occupies, and how much genuine information a matrix carries.
Dimension
A remarkable theorem guarantees that every basis of a given vector space has the same number of vectors. Whatever building blocks you choose, the count comes out identical, so the count is a property of the space itself.[2]
That common number is the dimension of the space. So R^2 has dimension 2 (its bases have two vectors), R^3 has dimension 3, and R^n has dimension n. A line through the origin has dimension 1; a plane through the origin has dimension 2; the subspace containing only the zero vector has dimension 0, since its basis is the empty set. Dimension makes the intuitive notion of "how many degrees of freedom" exact.
Worked example. What is the dimension of the plane W = { [x ; y ; z] : x + y + z = 0 } inside R^3? Solve the single equation: x = -y - z, with y = s and z = t free. Every member is [-s - t ; s ; t] = s[-1 ; 1 ; 0] + t[-1 ; 0 ; 1]. The two vectors [-1 ; 1 ; 0] and [-1 ; 0 ; 1] span W, and neither is a multiple of the other, so they are independent: a basis of size 2.
The plane has dimension 2, matching the geometry: one linear condition spent one of the three degrees of freedom.
Dimension also works beyond columns. The polynomial space P2 of degree at most 2 has basis 1, x, x^2, hence dimension 3, which is why quadratics behave like R^3 in disguise.
Dimension is also a bookkeeping ally. In an n-dimensional space, any set of n independent vectors is automatically a basis, any spanning set has at least n members, and any independent set has at most n. Knowing the dimension in advance tells you when to stop hunting: two independent vectors in our plane W, and the search is over.
Key idea: dimension is the size of any basis, and each independent linear condition imposed on a space removes one dimension.
Rank
The rank of a matrix is the number of pivots in its row echelon form, equivalently the number of linearly independent rows, which always equals the number of linearly independent columns. It measures how much genuinely independent information the matrix carries.[1]
Worked example. Find the rank of
A = [1 2 1 ; 2 4 3 ; 1 2 2].
- Clear column 1. Replace R2 with
R2 - 2*R1:2 - 2 = 0,4 - 4 = 0,3 - 2 = 1, giving[0 0 1]. Replace R3 withR3 - R1:1 - 1 = 0,2 - 2 = 0,2 - 1 = 1, giving[0 0 1]. - The two new rows are identical, so replace R3 with
R3 - R2:[0 0 0]. The echelon form is[1 2 1 ; 0 0 1 ; 0 0 0]. - There are pivots in columns 1 and 3, so
rank(A) = 2.
The rank is 2, not 3, because the columns are dependent: the second column [2 ; 4 ; 2] is twice the first [1 ; 2 ; 1]. A 3x3 matrix of rank less than 3 is singular, with determinant zero, tying rank back to invertibility.
Rank has two subspace readings. The column space (the span of the columns, the range of the machine) has dimension equal to the rank, and a basis for it is the set of pivot columns of the original matrix: here, columns 1 and 3, namely [1 ; 2 ; 1] and [1 ; 3 ; 2]. The row space (the span of the rows) also has dimension equal to the rank, which is the quiet miracle of the subject: independent-row count and independent-column count agree for every matrix, however lopsided its shape.

The rank-nullity theorem
The columns without pivots correspond to free variables, and the space of solutions to Ax = 0 (the null space) has dimension equal to the number of free columns, called the nullity. These two counts must add up to the total number of columns:[1]
rank(A) + nullity(A) = number of columns of A.
Watch the theorem verify itself on the example. Solve Ax = 0 from the echelon form [1 2 1 ; 0 0 1 ; 0 0 0]. Row 2 says x3 = 0. Column 2 is pivot-free, so x2 = t is free. Row 1 says x1 + 2t + 0 = 0, so x1 = -2t. The null space is the line { t[-2 ; 1 ; 0] }, with basis [-2 ; 1 ; 0] and dimension 1.
Sanity check the basis vector: A[-2 ; 1 ; 0] has first entry -2 + 2 + 0 = 0, second -4 + 4 + 0 = 0, third -2 + 2 + 0 = 0. Indeed zero.
So rank = 2 and nullity = 1, and 2 + 1 = 3 columns. This rank-nullity theorem is a precise conservation law: every column is either a pivot column (contributing to rank) or a free column (contributing to nullity), never both and never neither. It links the size of a matrix's range to the size of the space it collapses to zero, and it will reappear as we study linear transformations next.
Key idea: columns split into pivot columns and free columns; rank counts the first, nullity the second, and the split is exhaustive.

Rank decides solvability
Rank also answers "does Ax = b have a solution?" with one comparison: the system is consistent exactly when rank(A) = rank([A | b]), where [A | b] is the augmented matrix. Appending b can only keep the rank or raise it by one, and a raise means b brought a direction the columns of A cannot build.[1]
Worked example. Let A = [1 2 ; 2 4], which reduces to [1 2 ; 0 0]: rank 1. Try b = [3 ; 6]: the augmented matrix [1 2 | 3 ; 2 4 | 6] reduces by R2 - 2*R1 to [1 2 | 3 ; 0 0 | 0], still rank 1, so the system is consistent (infinitely many solutions, one free variable).
Now try b = [3 ; 7]: reduction gives [1 2 | 3 ; 0 0 | 1], rank 2 against rank 1, and the bottom row reads 0 = 1. Inconsistent. Same coefficients, different verdicts, and the rank comparison saw it coming.
A real use: rank is information content
An m by n rank-one matrix can be written uvT with nonzero column vectors u and v. Storing their m+n entries can be cheaper than storing mn entries when both dimensions are large. For u = [1 ; 2 ; 3] and v = [2 ; -1], the product is [2 -1 ; 4 -2 ; 6 -3], and every column is a multiple of u.
Exact rank alone does not tell us how accurately a matrix can be approximated with fewer terms. A full-rank image matrix might or might not admit a visually useful low-rank approximation. The singular values introduced later quantify approximation error for chosen norms. A small storage model does not guarantee preservation of every meaningful feature.
For a linear sensor model, dependent measurement rows mean redundant linear information under the model. They do not identify two specific physical sensors as useless in every setting: redundancy can help with noise or equipment failure. Rank describes exact independence, not all engineering value.
Common misconceptions
- Counting nonzero entries or nonzero rows of the original matrix. Rank counts pivots after reduction. The matrix
[1 3 ; 2 6]has four nonzero entries and two nonzero rows, yet rank 1. - Taking column-space basis vectors from the echelon form. Row operations change the column space. Identify which columns hold pivots, then take those columns from the original matrix.
- Expecting rank to exceed the smaller side. Rank is at most the minimum of the row count and column count; a 2 x 5 matrix cannot have rank 3.
- Computing nullity from zero rows. Nullity counts free columns. A 3x3 of rank 2 has one free column and nullity 1, whether or not you notice its zero row.
- Confusing the dimension of a subspace with its home. The plane
x + y + z = 0lives insideR^3but has dimension 2; where a space sits and how big it is are different questions.
A row-space basis and a rectangular count
The nonzero rows of an echelon form are independent and span the original row space, because reversible row operations preserve row combinations. For [1 2 1 ; 2 4 3 ; 1 2 2], a row-space basis is [1 2 1] and [0 0 1]. Its column-space basis still comes from columns 1 and 3 of the original matrix. Row and column spaces have equal dimensions but need not be the same subspace.[3]
For a 2 by 5 matrix of rank 2, the column space is all of R2, but the null space lies in R5 and has dimension 5-2 = 3. There need not be any zero rows in an echelon form. This is why nullity cannot be obtained by counting zero rows. For finite-dimensional linear maps generally, rank plus nullity equals the dimension of the domain.
Try it
Find the rank and nullity of A = [1 1 2 ; 1 2 3 ; 2 3 5], and give a basis for its null space.
Worked answer. Replace R2 with R2 - R1: [0 1 1]. Replace R3 with R3 - 2*R1: [0 1 1]. Replace R3 with R3 - R2: [0 0 0]. Echelon form: [1 1 2 ; 0 1 1 ; 0 0 0], pivots in columns 1 and 2, so rank = 2 and nullity = 3 - 2 = 1.
For the null space, set x3 = t: row 2 gives x2 = -t, and row 1 gives x1 = -x2 - 2 x3 = t - 2t = -t. Basis: [-1 ; -1 ; 1]. Check: each row of A dotted with it gives -1 - 1 + 2 = 0, -1 - 2 + 3 = 0, -2 - 3 + 5 = 0. All zero, as required.
Recap
- Dimension is the size of any basis; every independent constraint costs one dimension.
- Rank is the pivot count, equal to the dimensions of both the column space and the row space.
- Rank + nullity = number of columns: pivot columns power the range, free columns power the null space.
- Consistency of
Ax = bis the comparisonrank(A) = rank([A | b]), and low rank permits a factorized representation; practical approximation quality needs further analysis.
Next, matrices stop being tables and become verbs: linear transformations, with rank and nullity describing what they preserve and what they crush.
Retrieve, check, and revisit
Before looking back: A 4 by 6 matrix has rank 3. State its nullity and whether it is onto R4 or one-to-one on R6.
Feedback after attempting
Nullity is 6-3=3. It is neither onto nor one-to-one.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Compare a 6 by 4 matrix of rank 4, keeping the domain and codomain separate. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), rank thm. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), dimension. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), orthogonal complements. Read the source.
- Key terms
- Dimension
- The number of vectors in any basis of a space; its count of independent directions.
- Rank
- The number of pivots (independent rows or columns) of a matrix.
- Null space
- The set of all solutions x to Ax = 0.
- Nullity
- The dimension of the null space, equal to the number of free columns.
- Rank-nullity theorem
- rank(A) + nullity(A) equals the number of columns of A.
Coordinates and Change of Basis
- Convert coordinate vectors between ordered bases and verify by reconstruction.
- Find the matrix of a linear map in specified input and output bases.
- Distinguish similarity from row equivalence and state what similarity preserves.
Same vector, different coordinates
The vector v = [5;1] has coordinates [5;1] in the standard basis, but [2;3] in the ordered basis B = ([1;2],[1;-1]). These are not two different physical vectors. The second list records how many copies of each B-vector build the first: 2[1;2] + 3[1;-1] = [5;1]. Keeping the vector separate from its coordinate list is the central task of this lesson.
A basis gives every vector a unique representation. When we write [v]B, the bracket and subscript identify that representation. The order matters: reversing the two basis vectors reverses the two coordinates. Coordinates are meaningful only after the ordered basis is specified.[1]
Key idea: changing coordinates changes the description of a vector, while applying a transformation usually changes the vector itself.
Build the basis matrix
For an ordered basis B = (b1,...,bn) of Rn, put its vectors into the columns of the square matrix PB. The defining relationship is v = PB[v]B. Its columns are independent, so PB is invertible and [v]B = PB-1v. In computation, solve the system PBc = v rather than automatically constructing an inverse.[1]
In the opening example, PB = [1 1 ; 2 -1]. Solve c1+c2 = 5 and 2c1-c2 = 1. Adding gives 3c1 = 6, so c1 = 2 and c2 = 3. The inverse is [1/3 1/3 ; 2/3 -1/3], and multiplying it by [5;1] confirms the same result.
The matrix PB maps B-coordinate lists to standard-coordinate lists. Its inverse goes in the opposite direction. Writing an arrow beside each matrix before multiplying is often more useful than memorizing a formula with an unexplained inverse.
![With B=([2;0],[1;1]), the vector [7;3] has coordinate vector [2;3]. Reconstructing verifies the coefficients.](/assets/img/math-linalg-reviewed/basis-coordinates.png)
Convert between two nonstandard bases
Let C = (c1,...,cn) be another ordered basis. Both expressions describe the same vector: PB[v]B = v = PC[v]C. Multiplying on the left by PC-1 gives [v]C = PC-1PB[v]B. The transition matrix from B coordinates to C coordinates is therefore PC-1PB.[1]
Take B = ([1;1],[1;-1]) and C = ([1;0],[1;1]). Here PC = [1 1 ; 0 1] and its inverse is [1 -1 ; 0 1]. Multiply by PB = [1 1 ; 1 -1] to obtain the transition matrix [0 2 ; 1 -1].
For [v]B = [3;1], this gives [v]C = [2;2]. Check both reconstructions: 3[1;1]+[1;-1] = [4;2], and 2[1;0]+2[1;1] = [4;2]. The answer passes a check independent of the transition formula. The transition matrix's jth column is also [bj]C, which gives a second way to build it.
Changing a map's coordinate description
Suppose T:Rn to Rm is linear and has standard matrix A. Choose an ordered basis B of the domain and C of the codomain. Start with B coordinates, reconstruct the input, apply A, and express the output in C coordinates. The resulting matrix is [T]C<-B = PC-1A PB. Its shape is m by n. The left and right basis matrices have different jobs.[2]
Alternatively, apply T to every domain basis vector. Column j of [T]C<-B is [T(bj)]C. This method is especially useful for polynomials or other spaces where an ordinary geometric picture is unavailable. A matrix always needs its input and output bases to identify the represented map unambiguously.
For T(x,y) = (2x,y), let B = ([1;1],[1;-1]) and use standard output coordinates. Its matrix on B-coordinate inputs is A PB = [2 2 ; 1 -1]. Applied to [3;1], it gives [8;2], agreeing with applying T to the actual vector [4;2]. The basis conversion and the transformation are distinct steps.
Similarity uses one basis for both sides
For a map from Rn to itself, using the same basis B for input and output gives AB = PB-1A PB. Matrices related this way are similar. They represent the same linear operator in different coordinates. Similarity preserves the characteristic polynomial, eigenvalues with multiplicities, determinant, trace, and rank.[2]
With A = [2 0 ; 0 1] and P = [1 1 ; 1 -1], P-1 = (1/2)[1 1 ; 1 -1]. First compute AP = [2 2 ; 1 -1], then multiply on the left to get AB = [3/2 1/2 ; 1/2 3/2]. The diagonal matrix became nondiagonal, yet trace 3 and determinant 2 stayed the same.
Verify the action on coordinates: AB[3;1] = [5;3], and P[5;3] = [8;2], the transformed vector found above. The entries of AB are new because the coordinate axes are new, not because T changed. In general, similar matrices do not have equal column spaces as subsets written in standard coordinates.
Why similarity preserves eigenvalues
If Av = lambda v with v nonzero, set w = P-1v. The invertibility of P makes w nonzero. Then (P-1AP)w = P-1Av = lambda P-1v = lambda w. Thus the eigenvector coordinates change with the basis but the eigenvalue does not. Reversing the argument gives the converse.[2]
The characteristic-polynomial proof is also instructive: AB-lambda I = P-1(A-lambda I)P. Taking determinants cancels det(P-1)det(P)=1, leaving det(AB-lambda I)=det(A-lambda I). This proves preservation of multiplicities, which the existence of a single eigenvector alone does not establish.
Do not confuse similarity with row equivalence. Row operations multiply on the left and preserve solution information when applied to a whole augmented system. They do not generally preserve eigenvalues. For example, scaling a row of I2 can produce diag(2,1), whose eigenvalues differ from those of I2.
A polynomial operator in two bases
In P1, let T(p)(x)=p(x+1). Substitution respects linear combinations, so T is linear. In the standard polynomial basis E=(1,x), T(1)=1 and T(x)=1+x, giving AE=[1 1 ; 0 1]. Now choose B=(1,1+x). Its coordinate matrix relative to E is P=[1 1 ; 0 1].
Compute the columns directly in B: T(1)=1 has coordinates [1;0], while T(1+x)=2+x = 1+(1+x) has coordinates [1;1]. Thus AB=[1 1 ; 0 1] as well. A coordinate change can sometimes leave a matrix unchanged; different bases do not force different numerical entries.
For p=3+2x, its B coordinates are [1;2]. Applying AB gives [3;2], which reconstructs 3+2(1+x)=5+2x. Direct substitution p(x+1)=3+2(x+1) confirms it. Treating polynomials through their coefficient vectors makes every step checkable.
What a general basis does to geometry
A basis need not be perpendicular or have unit-length vectors. If v=Pc, then ||v||2 = cTPTPc. The ordinary sum of squares of the new coordinates equals the original squared length only when P is orthogonal. The matrix PTP records dot products of the basis vectors.
For B=([1;1],[1;-1]), PTP=2I. The coordinate vector [3;1] has squared coordinate length 10, while the actual vector [4;2] has squared length 20. Coordinates are not measurements along unit axes unless the basis says so. Later orthonormal bases make this geometry simpler.
![The coordinate vector [1;0] has ordinary squared length 1, but represents [2;0] with squared length 4. The Gram matrix P^T P supplies the physical metric.](/assets/img/math-linalg-reviewed/coordinate-metric.png)
Check your understanding
Let B=([2;0],[1;1]) and v=[7;3]. Solve 2c1+c2=7 and c2=3, giving [v]B=[2;3]. If a classmate reports [7;3], they have copied standard coordinates without solving the basis equation. Reconstructing their answer would give [17;3], exposing the error.
For any proposed transition matrix, check one column by converting the corresponding old basis vector. For any matrix of a map, check one nontrivial input both by ordinary transformation and by the coordinate route. Then confirm the general formula with its input and output labels.
Recap
Use v=PB[v]B to reconstruct a vector. Convert B to C with PC-1PB. Represent a map using PC-1APB. When the domain and target use the same basis, the result is similarity. Similarity preserves eigenvalues; row reduction serves a different purpose.
Remember: label the coordinate spaces before multiplying, and verify the reconstructed vector after multiplying.
Common misconceptions
Coordinates are coefficients in an ordered basis, not an intrinsic label on a vector. A nonorthogonal basis does not preserve the usual coordinate dot product. Row reduction changes a system; similarity changes a map's coordinate description.
Retrieve, check, and revisit
Before looking back: For B=([1;1],[0;2]) and v=[3;7], recover [v]_B and reconstruct v.
Feedback after attempting
The coordinates are [3;2], since 3[1;1]+2[0;2]=[3;7].
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Find the B-coordinate matrix of the map (x,y) to (x,2y) using input reconstruction and output conversion. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), bases as coord systems. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), similarity. Read the source.
- Key terms
- Ordered basis
- A basis with a specified order that fixes the meaning of each coordinate.
- Basis matrix
- The invertible matrix whose columns are the chosen basis vectors in standard coordinates.
- Coordinate vector
- The unique ordered coefficients representing a vector in a specified basis.
- Transition matrix
- The matrix converting one coordinate system to another.
- Similar matrices
- Matrices related by B=P^(-1)AP for an invertible P.
- Gram matrix
- P^T P, whose entries are dot products of the columns of P.
Module 6: Linear Transformations
See matrices as functions that move vectors, and study their kernel, range, and matrix representation.
Linear Transformations and Their Matrices
- Define a linear transformation by its two defining properties.
- Find the standard matrix of a transformation from the images of the basis vectors.
- Interpret common 2D transformations geometrically.
A matrix is not only a static array; it is a machine that transforms vectors. Multiplying a vector x by a matrix A produces a new vector Ax, so the matrix defines a function from one space to another: vectors in, vectors out. Feed [1 ; 0] into [0 -1 ; 1 0] and out comes [0 ; 1]; the machine turned east into north. The functions that arise this way are exactly the linear transformations, and this lesson is about reading a matrix as an action: rotations, reflections, stretches, shears, and projections, plus the algebra that combines them.
The definition
A function T from R^n to R^m is a linear transformation if it respects the two vector-space operations, for all vectors u, v and every scalar c:[2]
- Additivity:
T(u + v) = T(u) + T(v). - Homogeneity:
T(c v) = c T(v).
Together these say T preserves linear combinations: T(a u + b v) = a T(u) + b T(v). A consequence is that T must send the zero vector to the zero vector: set c = 0 in homogeneity and T(0) = 0 falls out. Multiplication by a matrix always satisfies both rules, and conversely every linear transformation between coordinate spaces is multiplication by some matrix.
Let us test drive the definition. Is T(x, y) = (x + y, 2x) linear? Try additivity on two general inputs: T((x1, y1) + (x2, y2)) = T(x1 + x2, y1 + y2) = (x1 + x2 + y1 + y2, 2x1 + 2x2), which regroups into (x1 + y1, 2x1) + (x2 + y2, 2x2) = T(x1, y1) + T(x2, y2). Scaling checks the same way. Linear. In practice the two rules are often checked as the single combined condition T(au + bv) = a T(u) + b T(v): one identity, both requirements.
Now T(x, y) = (x + 1, y), a shift right by one. It fails before any algebra: T(0, 0) = (1, 0), not the zero vector, and linear maps must fix the origin. And T(x, y) = (xy, x)? Test homogeneity with numbers: T(2 * (1, 1)) = T(2, 2) = (4, 2), but 2 * T(1, 1) = 2(1, 1) = (2, 2). The mismatch convicts it: products of coordinates break linearity, exactly as products of variables broke linear equations in Module 1.
Key idea: linear means combinations pass through the function untouched, and the origin stays put.
The standard matrix
Because a linear transformation preserves combinations, it is completely determined by what it does to the standard basis vectors. Every input is a combination of them, [x ; y] = x e1 + y e2, so T([x ; y]) = x T(e1) + y T(e2): knowing the two images means knowing everything. The standard matrix of T is the matrix whose columns are the images T(e1), T(e2), ..., T(en). Then T(x) = Ax for every x.[1]
Worked example. Let T rotate the plane 90 degrees counterclockwise. It sends e1 = [1 ; 0] to [0 ; 1] and e2 = [0 ; 1] to [-1 ; 0]. Placing these images as columns gives the standard matrix
A = [0 -1 ; 1 0].
Check on [3 ; 0]: A[3 ; 0] = [0*3 + (-1)*0 ; 1*3 + 0*0] = [0 ; 3], correctly rotating the arrow a quarter turn. For an arbitrary angle theta, the same recipe gives the general rotation matrix: e1 lands at [cos(theta) ; sin(theta)] and e2 at [-sin(theta) ; cos(theta)], so the matrix is [cos(theta) -sin(theta) ; sin(theta) cos(theta)]. Set theta = 90 degrees and the entries collapse to the matrix above.
A second build. Suppose a linear transformation sends e1 to [2 ; 1] and e2 to [0 ; 3]. Its standard matrix is A = [2 0 ; 1 3]. The image of [1 ; 2] is then 1[2 ; 1] + 2[0 ; 3] = [2 ; 7], and the matrix product agrees: A[1 ; 2] = [2*1 + 0*2 ; 1*1 + 3*2] = [2 ; 7]. Columns are destinations: that is the whole trick.
![A linear transformation with T(e1)=[2;1] and T(e2)=[1;2] has matrix [2 1;1 2]. Its action on all vectors follows by linearity.](/assets/img/math-linalg-reviewed/transformation-columns.png)
A gallery of 2D transformations
| Transformation | Standard matrix |
| Scale by factor k | [k 0 ; 0 k] |
| Reflect across the x-axis | [1 0 ; 0 -1] |
| Rotate 90 degrees counterclockwise | [0 -1 ; 1 0] |
| Horizontal shear by k | [1 k ; 0 1] |
| Project onto the x-axis | [1 0 ; 0 0] |
Each row of the gallery is the column recipe in action. The reflection fixes e1 and flips e2 to [0 ; -1]. The shear leaves e1 alone and tilts e2 to [k ; 1], so vertical lines lean while horizontal ones slide. The projection keeps e1 and crushes e2 to zero, flattening the plane onto the x-axis.[1]
The gallery extends easily. A diagonal matrix with different entries, such as [2 0 ; 0 3], stretches the x-direction by 2 and the y-direction by 3, turning squares into rectangles. A vertical shear [1 0 ; k 1] tilts e1 instead of e2. Reading any unfamiliar 2x2 matrix is the same two-step routine: where did the columns send e1 and e2?
Watch the shear [1 1 ; 0 1] move the unit square with corners (0,0), (1,0), (1,1), (0,1). The corners map to (0,0), (1,0), (1*1 + 1*1, 0 + 1) = (2,1), and (1,1): the square leans into a parallelogram. Its base and height are unchanged, so the area is still 1, matching det = 1*1 - 1*0 = 1 from Module 3. The absolute determinant of a real 2 by 2 transformation matrix is its area scale factor, and the projection's determinant of 0 announces the collapse.
Composition is matrix multiplication
Composing two transformations corresponds to multiplying their matrices: doing S after T is the matrix product (matrix of S)(matrix of T), with the first action written on the right, nearest the input. This is the deep reason matrix multiplication is defined by the row-by-column rule, and why its order matters: applying transformations in a different order generally gives a different result.[3]
Worked example. Let R = [0 -1 ; 1 0] (rotate 90 degrees counterclockwise) and F = [1 0 ; 0 -1] (reflect across the x-axis). Rotate first, then reflect: FR = [1 0 ; 0 -1][0 -1 ; 1 0]. Entry by entry: top row 1*0 + 0*1 = 0 and 1*(-1) + 0*0 = -1; bottom row 0*0 + (-1)*1 = -1 and 0*(-1) + (-1)*0 = 0. So FR = [0 -1 ; -1 0].
Reflect first, then rotate: RF = [0 -1 ; 1 0][1 0 ; 0 -1] = [0 1 ; 1 0], computed the same way. The two answers differ.
Follow e1 to feel why. Rotate-then-reflect: e1 goes to [0 ; 1], then reflects to [0 ; -1]. Reflect-then-rotate: e1 is fixed by the reflection, then rotates to [0 ; 1]. Different journeys, different destinations, and the matrices knew it first.
Composition with itself is worth one look. Rotating 90 degrees twice should be a half turn, and the algebra agrees: R^2 = [0 -1 ; 1 0][0 -1 ; 1 0] = [-1 0 ; 0 -1], the matrix that negates every vector, which is exactly a 180-degree rotation. When a geometric fact and a matrix product confirm each other like this, both are probably right.
A real use: the graphics pipeline
Matrix multiplication lets us combine linear coordinate operations before applying them to many points. Let S = [2 0 ; 0 1] and R = [0 -1 ; 1 0]. Scaling first then rotating gives RS = [0 -1 ; 2 0], so e1 maps to [0 ; 2]. Reversing the operations gives SR = [0 -2 ; 1 0], so e1 maps to [0 ; 1]. This is an exact example of order affecting geometry.
A translation is affine, not linear in ordinary coordinates. To encode (x,y) to (x+a,y+b), use homogeneous coordinates [x;y;1] and matrix [1 0 a ; 0 1 b ; 0 0 1]. The matrix operation is linear in three coordinates, while its restriction to points with last coordinate 1 represents an affine operation on the plane. That set of points is not a subspace.
Perspective imaging introduces a division by a depth coordinate, so its full map from ordinary 3D positions to image coordinates is not linear. Homogeneous matrices are a computational representation, not a reason to ignore that division or its domain restrictions.
![Translation by [1;1] is not linear on R2 because it sends the zero vector to [1;1]. Homogeneous coordinates can represent it in a larger space.](/assets/img/math-linalg-reviewed/affine-origin.png)
Common misconceptions
- Calling translation linear.
T(x) = x + [1 ; 0]moves the origin, andT(0)is not0. Linear maps pivot around a fixed origin.[2] - Writing composition in reading order. "Do T, then S" is
(matrix of S)(matrix of T); the matrix nearest the vector acts first. Reversing the product usually changes the transformation. - Building the matrix from rows. The images of
e1, e2are the columns. Row-stacking them transposes the matrix and wrecks every computation after. - Verifying linearity with one friendly example. A single input pair working proves nothing; the two rules must hold for all inputs. One failing example, however, refutes.
- Assuming every matrix is reversible motion. The projection
[1 0 ; 0 0]destroys the y-coordinate permanently; determinant zero warns you no inverse exists.
A linear map on polynomials
Differentiation T:P2 to P1 is linear because T(ap+bq) = aT(p)+bT(q). Use ordered domain basis (1,x,x2) and target basis (1,x). Their images have coordinate columns [0;0], [1;0], and [0;2]. The matrix is [0 1 0 ; 0 0 2]. Applied to coefficients [3;-1;4], it gives [-1;8], representing the derivative -1+8x.
This rectangular matrix links two different spaces. The zero output for a constant polynomial is a kernel direction, while every polynomial a+bx in P1 is reached by ax+(b/2)x2. Basis choice makes an abstract linear operation computable.
Try it
Find the standard matrix of "rotate 90 degrees counterclockwise, then project onto the x-axis," and compute the image of [2 ; 1].
Worked answer. The parts are R = [0 -1 ; 1 0] and P = [1 0 ; 0 0], and rotation acts first, so the composite is PR = [1 0 ; 0 0][0 -1 ; 1 0] = [0 -1 ; 0 0]. Then PR[2 ; 1] = [0*2 + (-1)*1 ; 0] = [-1 ; 0]. Check in two steps: R[2 ; 1] = [-1 ; 2], and projecting kills the second coordinate, leaving [-1 ; 0]. The answers match.
Recap
- Linear transformations preserve sums and scalings, and every one between coordinate spaces is multiplication by a matrix.
- The standard matrix stores the images of the basis vectors as its columns.
- Scales, reflections, rotations, shears, and projections are all matrices, and the determinant reports their area effect.
- Composition multiplies matrices right to left, and order genuinely matters.
A transformation also raises two subspace questions: what does it crush to zero, and what can it reach? Those are the kernel and the range, next.
Retrieve, check, and revisit
Before looking back: Is T(x,y)=(x+1,2y) linear? Is S(x,y)=(x,2y) linear?
Feedback after attempting
T(0,0)=(1,0), so T fails. S has matrix diag(1,2), and direct substitution verifies additivity and homogeneity.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Find S after a quarter-turn and a quarter-turn after S. Compare the matrices. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), matrix transformations. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), linear transformations. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), matrix multiplication. Read the source.
- Key terms
- Linear transformation
- A function preserving addition and scalar multiplication: T(au + bv) = aT(u) + bT(v).
- Additivity
- T(u + v) = T(u) + T(v).
- Homogeneity
- T(cv) = c T(v).
- Standard matrix
- The matrix whose columns are the images of the standard basis vectors.
- Composition of transformations
- Applying one transformation after another, realized by multiplying their matrices.
Kernel and Range
- Define the kernel and range of a linear transformation.
- Connect kernel and range to the null space and column space of the matrix.
- Use kernel and range to decide if a transformation is one-to-one or onto.
The kernel and range answer precise questions about a linear transformation T(x) = Ax: which differences between inputs are invisible, and which outputs are reachable. They determine injectivity and surjectivity, but not the entire transformation. The identity I and 2I have the same kernel and range and act differently on every nonzero vector.
The kernel
The kernel (or null space) of T is the set of all inputs that T crushes to the zero vector: ker(T) = { x : Ax = 0 }. It is a subspace of the input space, and finding it means solving the homogeneous system Ax = 0. Its dimension is the nullity from last lesson: kernel and null space are two names for one object. The kernel measures how much information the transformation destroys: whenever two inputs differ by a kernel vector, the machine maps them to the same output, so their difference is invisible on the far side.[3]
Worked example. For A = [1 2 ; 2 4], solve Ax = 0. Row-reduce: replace R2 with R2 - 2*R1 to get [0 0], leaving the single equation x1 + 2 x2 = 0, so x1 = -2 x2. Setting x2 = t, the kernel is { t[-2 ; 1] : t real }, a line through the origin. Because the kernel contains nonzero vectors, this transformation is not reversible; different inputs collapse to the same output. Concretely, [0 ; 0] and [-2 ; 1] both map to [0 ; 0], and no one downstream can tell them apart.
A wider machine. Let B = [1 2 1 ; 0 1 1], mapping R^3 to R^2. The system Bx = 0 reads x1 + 2 x2 + x3 = 0 and x2 + x3 = 0. The second equation gives x2 = -x3; set x3 = t, so x2 = -t. Substitute into the first: x1 - 2t + t = 0, so x1 = t.
The kernel is the line { t[1 ; -1 ; 1] } in R^3. Check the basis vector: row 1 gives 1 - 2 + 1 = 0, row 2 gives -1 + 1 = 0. A machine from a bigger space to a smaller one must crush something; rank-nullity will say exactly how much.
At the other extreme, the rotation matrix [0 -1 ; 1 0] has kernel containing only the zero vector: rotating an arrow never flattens it, so Ax = 0 forces x = 0. A trivial kernel is the signature of a lossless machine.
Key idea: the kernel is the machine's blind spot, computed by solving Ax = 0; only the zero vector there means nothing is lost.
The range
The range (or column space) of T is the set of all outputs it can actually produce: range(T) = { Ax : x in R^n }. Since Ax is a linear combination of the columns of A with weights from x, the range is exactly the span of the columns of A. Its dimension is the rank of A. For the matrix above, both columns are multiples of [1 ; 2], so the range is the single line spanned by [1 ; 2], and the rank is 1.[1]
The range answers solvability instantly: Ax = b has a solution exactly when b lies in the range. For A = [1 2 ; 2 4], the target b = [3 ; 6] sits on the line through [1 ; 2] (it is 3 times it), so the system is consistent; the target b = [3 ; 7] is off the line, so no input reaches it, matching the rank test of the last lesson.
For the wide matrix B = [1 2 1 ; 0 1 1], reduce to find pivots: the echelon form is already [1 2 1 ; 0 1 1], with pivots in columns 1 and 2. A basis for the range is the corresponding original columns, [1 ; 0] and [2 ; 1], which are independent and span all of R^2. So this machine reaches every target in its codomain: rank 2, range everything.
Key idea: the range is the span of the columns; a target is reachable exactly when it lies in that span.

One-to-one and onto
The kernel and range answer the two basic questions about any function.[1]
Tis one-to-one (injective, distinct inputs give distinct outputs) exactly when its kernel is only the zero vector. Any larger kernel means collisions.Tis onto (surjective, it reaches every vector in the target space) exactly when its range is the whole target space, that is, when the rank equals the dimension of the codomain.
Why does the kernel control one-to-one? If Au = Av for different inputs, then A(u - v) = 0 with u - v nonzero, a nonzero kernel vector. Conversely a nonzero kernel vector k collides with 0. So collisions and kernel vectors are the same phenomenon, and checking one-to-one for a linear map costs only one homogeneous solve.
Classify the cast so far. A = [1 2 ; 2 4]: kernel is a line (not one-to-one), range is a line inside R^2 (not onto). Neither. The rotation: kernel trivial, range all of R^2: both, hence invertible. The projection [1 0 ; 0 0]: kernel is the y-axis, range is the x-axis: neither.
The wide matrix B: onto but not one-to-one. And the tall matrix C = [1 0 ; 0 1 ; 0 0], mapping R^2 into R^3: its columns are independent, so the kernel is trivial and it is one-to-one, but its range is only the plane of vectors with third coordinate zero: not onto. These examples exhibit all four combinations of injectivity and surjectivity across different matrix shapes.
Dimension restricts which combinations a fixed shape allows. For the singular square matrix A = [1 2 ; 2 4], the audit reads rank + nullity = 1 + 1 = 2 columns, and for the wide matrix B it reads 2 + 1 = 3; in every case, growing the range shrinks the kernel and vice versa. A map from R^3 to R^2 can never be one-to-one (nullity is at least 1), and a map from R^2 to R^3 can never be onto (rank is at most 2). For a square matrix, the ledger balances exactly: one-to-one and onto happen together.
The invertible matrix theorem, a first tour
For an n x n matrix A, the following statements are all equivalent: each one true makes all true, each one false makes all false.[2]
Ais invertible;det(A)is nonzero;rank(A) = n, with a pivot in every column;- the kernel is only the zero vector, and the columns are independent;
T(x) = Axis one-to-one, and it is onto;Ax = bhas exactly one solution for everyb.
This is the grand unifying statement of the first half of the course: determinants, rank, kernels, and solvability are one story told in four vocabularies. When you need to certify invertibility, you are free to check whichever condition is cheapest, and in practice that is usually the pivot count.
Use it as a switchboard. For [1 2 ; 2 4], one glance at det = 0 flips every switch off at once: not invertible, rank below 2, a nonzero kernel vector waiting, columns dependent, neither one-to-one nor onto, and right-hand sides that fail. One cheap computation, six conclusions.
A real use: why one photo cannot recover depth
Start with the exact orthographic model T(x,y,z) = (x,y), represented by [1 0 0 ; 0 1 0]. Its kernel is the z-axis, so (2,3,1) and (2,3,8) produce the same output (2,3). The whole preimage of that output is (2,3,0) + t(0,0,1), t real. Depth is unconstrained in this model.
A second ideal linear measurement S(x,y,z) = (y,z) can recover the missing coordinate. Stacking T and S gives a 4 by 3 matrix with rank 3. The two kernels intersect only at zero, so the combined linear measurement is injective.
A perspective camera instead uses coordinates such as (fx/z,fy/z), with z nonzero. That operation is nonlinear in ordinary coordinates and cannot be assigned one global linear kernel. Real multi-view reconstruction also needs calibrated geometry and matching observations. Our two linear projections illustrate the kernel principle without pretending to describe all camera behavior.
Common misconceptions
- Housing the kernel and range in the same space. For a 2 x 3 matrix, kernel vectors live in
R^3(inputs) and range vectors inR^2(outputs). Keep the addresses straight. - Saying "the kernel is empty." It never is:
A0 = 0always. The lossless case is a trivial kernel, containing exactly the zero vector. - Confusing range with codomain. The codomain is where outputs are allowed to land; the range is where they actually land. Onto means the two coincide.
- Taking range basis vectors from the echelon form. Row operations change column spans. Find pivot positions in the reduced matrix, then harvest those columns from the original.
- Expecting shape to be overridable. Wide matrices (more columns than rows) are never one-to-one; tall ones are never onto. Rank-nullity is a law, not a tendency.
The complete fiber above an output
If Ap = b, then every solution of Ax = b is p+z with z in Null(A). For one direction, A(p+z) = Ap+Az = b. Conversely, if Ax = b, then A(x-p) = 0, so x-p lies in the kernel. Both implications are required to prove that the list is complete.[3]
For A = [1 2 ; 2 4] and b = [3;6], take p = [3;0]. The entire fiber is [3;0] + t[-2;1]. A different particular solution, such as [1;1], describes the same affine line. The solution set itself is not a subspace because b is nonzero.
![The preimage of 3 under T(x,y)=x+y is [3;0]+span{[-1;1]}, a particular solution plus the kernel.](/assets/img/math-linalg-reviewed/kernel-fiber.png)
Try it
For A = [1 0 -1 ; 2 1 0], find a basis for the kernel, and decide whether the map is onto and whether it is one-to-one.
Worked answer. Solve Ax = 0: the equations are x1 - x3 = 0 and 2 x1 + x2 = 0. From the first, x1 = x3; set x3 = t, so x1 = t, and the second gives x2 = -2t. Kernel basis: [1 ; -2 ; 1].
Check: row 1 gives 1 - 1 = 0; row 2 gives 2 - 2 + 0 = 0. The two columns [1 ; 2] and [0 ; 1] are already independent, so the rank is 2, equal to the dimension of R^2: the map is onto. The kernel is a line, so it is not one-to-one, and rank-nullity confirms the audit: 2 + 1 = 3 columns.
Recap
- Kernel: solutions of
Ax = 0, a subspace of the input space; it collects everything the machine cannot distinguish from zero. - Range: the span of the columns, a subspace of the output space; reachable targets and nothing more.
- One-to-one means trivial kernel; onto means range equals codomain; square matrices get both or neither.
- The invertible matrix theorem ties determinant, rank, kernel, and solvability into one switch.
Next, we hunt for the directions a matrix does not turn at all: eigenvectors, and the stretch factors that come with them.
Retrieve, check, and revisit
Before looking back: For A=[1 2 0;0 0 1], find bases of its kernel and range.
Feedback after attempting
The kernel is span{[-2;1;0]}. The range is R2 with basis [1;0],[0;1].
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Find all preimages of [3;4], then relate your answer to a particular solution plus the kernel. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), one to one onto. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), invertible matrix thm. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), solution sets. Read the source.
- Key terms
- Kernel (null space)
- The set of inputs x with T(x) = Ax = 0.
- Range (column space)
- The set of all outputs Ax, equal to the span of the columns of A.
- One-to-one (injective)
- Distinct inputs give distinct outputs; equivalent to a kernel of just the zero vector.
- Onto (surjective)
- The transformation reaches every vector in the target space; the range is the whole codomain.
- Column space
- The span of a matrix's columns, another name for the range.
Module 7: Eigenvalues and Eigenvectors
Find the special directions a matrix merely stretches, and use them to diagonalize it.
Finding Eigenvalues and Eigenvectors
- State the eigenvalue equation and its meaning.
- Find eigenvalues from the characteristic equation det(A - lambda I) = 0.
- Find an eigenvector for each eigenvalue.
Most vectors change direction when a matrix acts on them. A precious few do not: they are only stretched or shrunk, keeping their line. These special directions are the eigenvectors, and the stretch factors are the eigenvalues. They expose the deepest structure of a matrix, and this lesson builds the complete recipe for finding them: set up the characteristic equation, solve for the eigenvalues, then recover an eigenvector for each.
The eigenvalue equation
A nonzero vector v is an eigenvector of a square matrix A, with eigenvalue lambda (the Greek letter, read: LAM-duh), if[1]
A v = lambda v.
In words, multiplying by A has the same effect on v as scaling it by the number lambda, nothing more. For a real eigenvalue, the vector stays on its line: a positive eigenvalue keeps its direction, a negative one reverses it, and zero collapses it to zero. We require v to be nonzero, since A * 0 = 0 always holds trivially and would tell us nothing.
See the phenomenon before the machinery. Let A = [2 1 ; 1 2]. Feed it [1 ; 0]: out comes [2 ; 1], a genuinely different direction; this input turned. Now feed it [1 ; 1]: out comes [2 + 1 ; 1 + 2] = [3 ; 3], which is exactly 3[1 ; 1]. The diagonal direction did not turn at all; it was stretched by 3. So [1 ; 1] is an eigenvector of this matrix with eigenvalue 3, and the question becomes: how do we find such directions systematically instead of by lucky guessing?
![For A=[2 1;1 2], [1;1] is an eigenvector with eigenvalue 3 and [1;-1] is an eigenvector with eigenvalue 1.](/assets/img/math-linalg-reviewed/eigen-directions.png)
The characteristic equation
Rewrite A v = lambda v as A v - lambda v = 0, or (A - lambda I) v = 0. Subtracting lambda I subtracts lambda from each diagonal entry only; the identity keeps the bookkeeping honest. For a nonzero v to solve this homogeneous system, the matrix A - lambda I must have a nontrivial kernel, which by the invertible matrix theorem means it is singular, which means its determinant is zero. That gives the characteristic equation:[2]
det(A - lambda I) = 0.
Its solutions are the eigenvalues. For a 2x2 matrix this is a quadratic in lambda, so there are at most two eigenvalues. A convenient 2x2 shortcut: the quadratic always takes the form lambda^2 - (trace) lambda + det = 0, where the trace is the sum of the diagonal entries. Counting the two roots over the complex numbers with algebraic multiplicity, they add to the trace and multiply to the determinant, a free error check we will use constantly.
Key idea: eigenvalues are exactly the numbers lambda that make A - lambda I singular; the eigenvectors are the nonzero kernel vectors that appear at those special values.
Worked example
Find the eigenvalues and eigenvectors of A = [2 1 ; 1 2].
- Form
A - lambda I = [2 - lambda, 1 ; 1, 2 - lambda]. - Its determinant is
(2 - lambda)^2 - (1)(1) = lambda^2 - 4 lambda + 4 - 1 = lambda^2 - 4 lambda + 3. - Set it to zero and factor:
lambda^2 - 4 lambda + 3 = (lambda - 1)(lambda - 3) = 0. Solambda = 1andlambda = 3.
Before hunting eigenvectors, audit: the trace is 2 + 2 = 4, and 1 + 3 = 4. The determinant is 4 - 1 = 3, and 1 * 3 = 3. Both books balance. Now find an eigenvector for each eigenvalue.
- For lambda = 3: solve
(A - 3I)v = 0, that is[-1 1 ; 1 -1] v = 0. The equation is-v1 + v2 = 0, sov1 = v2. An eigenvector is[1 ; 1]. Check:A[1 ; 1] = [2*1 + 1*1 ; 1*1 + 2*1] = [3 ; 3] = 3[1 ; 1]. Correct. - For lambda = 1: solve
(A - I)v = 0, that is[1 1 ; 1 1] v = 0. The equation isv1 + v2 = 0, sov1 = -v2. An eigenvector is[1 ; -1]. Check:A[1 ; -1] = [2 - 1 ; 1 - 2] = [1 ; -1] = 1[1 ; -1]. Correct.
Each eigenvector spans a line that the matrix leaves in place, stretching it by its eigenvalue. Every nonzero scalar multiple of an eigenvector is again an eigenvector for the same eigenvalue, so any nonzero multiple of [1 ; 1] is also an eigenvector for lambda = 3; the set of all of them, plus the zero vector, is the eigenspace for that eigenvalue. Notice too that the rows of A - 3I became dependent, one the negative of the other. They had to: we chose lambda precisely to make the matrix singular, so a free variable is expected, not alarming.
A second example, start to finish
Find the eigen-data of A = [4 1 ; 2 3].
A - lambda I = [4 - lambda, 1 ; 2, 3 - lambda], so the determinant is(4 - lambda)(3 - lambda) - (1)(2).- Expand:
12 - 4 lambda - 3 lambda + lambda^2 - 2 = lambda^2 - 7 lambda + 10. - Factor:
lambda^2 - 7 lambda + 10 = (lambda - 2)(lambda - 5) = 0, solambda = 2andlambda = 5. Audit: trace4 + 3 = 7 = 2 + 5; determinant12 - 2 = 10 = 2 * 5. - lambda = 2:
(A - 2I)v = [2 1 ; 2 1]v = 0says2 v1 + v2 = 0, sov2 = -2 v1: take[1 ; -2]. Check:A[1 ; -2] = [4 - 2 ; 2 - 6] = [2 ; -4] = 2[1 ; -2]. - lambda = 5:
(A - 5I)v = [-1 1 ; 2 -2]v = 0saysv1 = v2: take[1 ; 1]. Check:A[1 ; 1] = [4 + 1 ; 2 + 3] = [5 ; 5] = 5[1 ; 1].
The full procedure fits in five lines, and two of them are checks. Different matrix, same rhythm.
Special cases worth knowing
Triangular matrices hand you the answer. For [3 5 ; 0 7], the characteristic determinant is (3 - lambda)(7 - lambda) - 0, so the eigenvalues are the diagonal entries 3 and 7. This covers diagonal matrices too.[2]
A repeated eigenvalue can run short of directions. The shear [1 1 ; 0 1] has characteristic polynomial (1 - lambda)^2, so lambda = 1 twice. But (A - I)v = [0 1 ; 0 0]v = 0 forces only v2 = 0: the eigenvectors form a single line, spanned by [1 ; 0]. A double eigenvalue with only one independent direction will block diagonalization next lesson.
Some real matrices have no real eigenvalues. The rotation [0 -1 ; 1 0] gives lambda^2 + 1 = 0, with no real solutions, which matches the geometry: a quarter-turn leaves no direction unturned. (Allowing complex numbers, the roots exist and are imaginary; the complex-eigenvalue lesson in this course develops that case.)
Eigenvalue zero means singular. If lambda = 0 solves the characteristic equation, then det(A) = 0, and the eigenvectors for 0 are exactly the nonzero kernel vectors: the directions the matrix flattens.
Eigenspaces can have more than one direction
For A = 2I in R2, every nonzero vector satisfies Av = 2v. The eigenspace for 2 is the whole plane, not one line. One representative eigenvector does not describe an eigenspace of dimension greater than one. Solve (A-lambda I)v = 0 and report a basis for its null space when asked for all eigenvectors.[2]
The algebraic multiplicity of an eigenvalue is its multiplicity as a root of the characteristic polynomial. Its geometric multiplicity is the dimension of its eigenspace. The latter is at least 1 and at most the former. For [1 1 ; 0 1], those counts are 2 and 1; for I in R2, they are 2 and 2.
A real use: ranking pages by importance
Early web search faced a circular definition: a page is important if important pages link to it. Linear algebra breaks the circle. Put the link structure in a matrix M whose entry (i, j) is the fraction of page j's endorsement flowing to page i, and seek an importance vector v that reproduces itself under the flow: M v = v. That is an eigenvector equation with lambda = 1.[3]
Tiny worked web. Two pages. Page A sends all its weight to B; page B splits its weight evenly between A and itself. Then M = [0 0.5 ; 1 0.5]. Solve Mv = v, that is (M - I)v = 0: the first row says -v1 + 0.5 v2 = 0, so v2 = 2 v1. Take v = [1 ; 2] and check: Mv = [0*1 + 0.5*2 ; 1*1 + 0.5*2] = [1 ; 2].
Normalize the vector to probabilities: v = [1/3 ; 2/3]. It has nonnegative entries, sums to 1, and satisfies Mv = v. This is a stationary distribution for the stated toy transition matrix. Repeated multiplication converges here because the other eigenvalue is -1/2. A general stochastic matrix need not have a unique stationary distribution or converge from every start.
Stationarity does not imply convergence
The column-stochastic matrix S = [0 1 ; 1 0] has stationary distribution [1/2;1/2], but starting at [1;0] alternates forever between [1;0] and [0;1]. Its eigenvalues are 1 and -1. In contrast, a finite column-stochastic matrix with all entries strictly positive has a unique stationary probability vector and converges to it from every probability-vector start. Positivity is a sufficient condition, not a necessary one.[3]
Real web-ranking models use additional choices to handle pages with no outgoing links and to mix link-following with a teleportation distribution. Those choices help establish conditions for a unique stable ranking. The two-page calculation is an eigenvector model, not a complete description of a current search engine.
![The swap matrix has stationary distribution [1/2;1/2], but starting at [1;0] alternates forever, driven by eigenvalue -1.](/assets/img/math-linalg-reviewed/markov-periodic.png)
Common misconceptions
- Subtracting lambda from every entry.
A - lambda Itouches only the diagonal. Off-diagonal entries keep their values. - Losing the cross term. The 2x2 determinant is
(a - lambda)(d - lambda) - bc; forgetting the-bcchanges every root. The trace and determinant audit catches this immediately. - Accepting v = 0. The zero vector solves
(A - lambda I)v = 0for every lambda and certifies nothing. Eigenvectors are the nonzero solutions. - Expecting a unique eigenvector. Any nonzero scalar multiple works; report a clean representative and remember it stands for a whole line.
- Getting a unique solution from (A - lambda I)v = 0. If elimination leaves no free variable, the lambda you used is not an eigenvalue; recheck the characteristic equation before recomputing.
Try it
Find the eigenvalues and an eigenvector for each, for A = [3 2 ; 1 2].
Worked answer. The characteristic polynomial is (3 - lambda)(2 - lambda) - 2 = lambda^2 - 5 lambda + 6 - 2 = lambda^2 - 5 lambda + 4 = (lambda - 1)(lambda - 4), so lambda = 1 and lambda = 4. Audit: trace 5 = 1 + 4; determinant 6 - 2 = 4 = 1*4.
For lambda = 1: [2 2 ; 1 1]v = 0 gives v1 = -v2, eigenvector [1 ; -1]; check A[1 ; -1] = [3 - 2 ; 1 - 2] = [1 ; -1]. For lambda = 4: [-1 2 ; 1 -2]v = 0 gives v1 = 2 v2, eigenvector [2 ; 1]; check A[2 ; 1] = [6 + 2 ; 2 + 2] = [8 ; 4] = 4[2 ; 1]. Both verified.
Recap
- An eigenvector keeps its line under the matrix; the eigenvalue is the stretch factor:
Av = lambda v,vnonzero. - Eigenvalues solve
det(A - lambda I) = 0; for 2x2 that islambda^2 - (trace)lambda + det = 0. - For each eigenvalue, the eigenspace is the kernel of
A - lambda I; eigenvectors are its nonzero members, found by elimination, and free variables are guaranteed. - Triangular matrices show eigenvalues on the diagonal; rotations may have no real ones; zero as an eigenvalue means singular.
Eigenvectors were found one at a time here. Next lesson assembles them into a basis and rebuilds the whole matrix around them: diagonalization.
Retrieve, check, and revisit
Before looking back: Find eigenvalues and eigenspaces of [4 1;0 2]. Check by multiplication.
Feedback after attempting
The eigenvalues are 4 and 2. Their eigenspaces are span{[1;0]} and span{[1;-2]}, respectively.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Change the diagonal entries to 4,4. Explain what happens to the dimension of the eigenspace. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), eigenvectors. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), characteristic polynomial. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), stochastic matrices. Read the source.
- Key terms
- Eigenvector
- A nonzero vector v satisfying Av = lambda v for a square matrix A; a real eigenvalue can preserve, reverse, or collapse its direction.
- Eigenvalue
- The scalar lambda by which A stretches its eigenvector.
- Eigenvalue equation
- The relation Av = lambda v defining eigenpairs.
- Characteristic equation
- det(A - lambda I) = 0, whose roots are the eigenvalues.
- Eigenspace
- The set of all eigenvectors for a given eigenvalue, together with the zero vector, forming a subspace.
Diagonalization and Its Uses
- Explain what it means to diagonalize a matrix.
- Assemble the matrices P and D from eigenvectors and eigenvalues.
- Use diagonalization to compute matrix powers efficiently.
Eigenvectors are useful because, in the basis they provide, a complicated matrix becomes a simple diagonal one. This process, diagonalization, turns hard matrix computations into easy scalar ones. The last lesson found the special directions one at a time; this lesson assembles them into a coordinate system in which the matrix does nothing but stretch the axes.
What diagonalization means
A square matrix A is diagonalizable if it can be written as[1]
A = P D P^(-1),
where D is a diagonal matrix and P is invertible. The recipe is built directly from eigen-data: the columns of P are eigenvectors of A, and D is the diagonal matrix of the corresponding eigenvalues in the same order. An n x n matrix is diagonalizable exactly when it has n linearly independent eigenvectors, enough to form a basis; independence is what makes P invertible.
Read the formula as a three-step journey, right to left. Multiplying by P^(-1) translates a vector into eigenvector coordinates: how much of each special direction it contains. Multiplying by D then scales each coordinate by its eigenvalue, the only thing the matrix ever does in this basis. Finally P translates back to standard coordinates. Same transformation, better coordinate system: that is the whole idea, and it is the payoff promised in the basis lesson.
One theorem does most of the eligibility checking: eigenvectors belonging to distinct eigenvalues are automatically independent. An n by n matrix with n distinct eigenvalues in the chosen scalar field is diagonalizable over that field. A real matrix with nonreal eigenvalues may diagonalize over the complex numbers but not over the reals. Repeated eigenvalues are the only risky case.
Key idea: diagonalization rewrites A in its eigenvector basis, where it is purely a per-axis stretch.
Worked example
Diagonalize A = [2 1 ; 1 2], using the eigen-data from the previous lesson: eigenvalue 3 with eigenvector [1 ; 1], and eigenvalue 1 with eigenvector [1 ; -1].[2]
- Put the eigenvectors as columns of
P:P = [1 1 ; 1 -1]. - Put the matching eigenvalues on the diagonal of
Din the same order:D = [3 0 ; 0 1]. - Then
A = P D P^(-1). Heredet(P) = 1*(-1) - 1*1 = -2, soP^(-1) = (1/-2)[-1 -1 ; -1 1] = [0.5 0.5 ; 0.5 -0.5].
Claims deserve verification, so multiply the three factors. First P D = [1 1 ; 1 -1][3 0 ; 0 1]: row by column gives [3 1 ; 3 -1] (each column of P picked up its eigenvalue). Then (P D) P^(-1) = [3 1 ; 3 -1][0.5 0.5 ; 0.5 -0.5]. Top-left: 3*0.5 + 1*0.5 = 2. Top-right: 3*0.5 + 1*(-0.5) = 1. Bottom-left: 3*0.5 + (-1)*0.5 = 1. Bottom-right: 3*0.5 + (-1)*(-0.5) = 2. The product is [2 1 ; 1 2] = A, exactly as claimed.
The two independent eigenvectors guarantee this works. In the eigenvector basis, A does nothing except scale one axis by 3 and the other by 1, which is exactly what D encodes.
The factorization also puts the matrix's vital statistics on display. The determinant is the product down D's diagonal, 3 * 1 = 3, matching det(A) = 4 - 1 = 3, and the trace is its sum, 3 + 1 = 4, matching 2 + 2. Once a matrix is diagonalized, its determinant, trace, powers, and long-run behavior are all readable at a glance.
Why it matters: matrix powers
Diagonalization makes powers effortless. Because the inner P^(-1) P factors cancel,[1]
A^k = P D^k P^(-1),
and raising a diagonal matrix to a power raises each diagonal entry to that power, nothing else: D^k = [3^k 0 ; 0 1^k]. So instead of multiplying A by itself k times, you compute 3^k and 1^k and reassemble.
Worked check. Compute A^3 both ways. Via the formula: D^3 = [27 0 ; 0 1], so P D^3 = [27 1 ; 27 -1], and multiplying by P^(-1): top-left 27*0.5 + 1*0.5 = 14, top-right 27*0.5 - 0.5 = 13, bottom-left 27*0.5 - 0.5 = 13, bottom-right 27*0.5 + 0.5 = 14. So A^3 = [14 13 ; 13 14].
The long way: A^2 = [2*2 + 1*1, 2*1 + 1*2 ; 1*2 + 2*1, 1*1 + 2*2] = [5 4 ; 4 5], and A^3 = A^2 A = [5*2 + 4*1, 5*1 + 4*2 ; 4*2 + 5*1, 4*1 + 5*2] = [14 13 ; 13 14]. The two routes agree, and for k = 100 only one of them is humane: A^100 = P [3^100 0 ; 0 1] P^(-1), two scalar powers and two small multiplications.
For a diagonalizable matrix, decompose x0 into its eigenbasis: x0 = sum cjvj. Then Akx0 = sum cjlambdajkvj. A single leading eigendirection describes the dominant term only when there is a strictly largest eigenvalue magnitude and its initial coefficient is nonzero. Negative or nonreal eigenvalues may cause sign changes or rotations, and tied magnitudes can prevent convergence to one direction.
Three counterexamples to an unchecked forecast
For A = diag(3,1) and x0 = [0;1], the largest eigenvalue is 3, but Akx0 = [0;1] forever because the coefficient in the first eigendirection is zero. For B = diag(1,-1), the second coordinate alternates, so a general state has no limit. For J = [1 1 ; 0 1], direct multiplication or induction gives Jk = [1 k ; 0 1]. Despite both eigenvalues being 1, a nonzero second coordinate causes linear growth.
For a diagonalizable A, all eigenvalues of magnitude below 1 imply Akx0 tends to zero for every start. The same stability result holds for general square matrices, but its full proof requires handling the polynomial factors associated with defective blocks. Here we use diagonalization where its hypotheses hold.
![The defective matrix [1 1;0 1] has both eigenvalues 1 but produces linear growth from [0;1]. Eigenvalues alone do not justify a convergence claim.](/assets/img/math-linalg-reviewed/defective-growth.png)
When diagonalization fails
Not every matrix cooperates. The shear [1 1 ; 0 1] has eigenvalue 1 twice but, as the last lesson showed, only one independent eigen-direction, the line through [1 ; 0]. Building P requires two independent eigenvector columns, and there is no second one to use; any attempted P is singular. Such matrices are called defective, and they are the price of repeated eigenvalues gone wrong. (A repeated eigenvalue is not always fatal: the identity matrix has eigenvalue 1 twice and is already diagonal.)[1]
One glowing special case: real symmetric matrices, those with A^T = A, are always diagonalizable, never defective, and their eigenvectors for different eigenvalues come out perpendicular. Our worked example is symmetric, and sure enough its eigenvectors satisfy [1 ; 1] . [1 ; -1] = 1 - 1 = 0. The spectral-theorem lesson later in this course develops this result; it is why symmetric matrices are the best-behaved citizens of linear algebra.
A real use: will it rain in the long run?
A simple weather model: if today is sunny, tomorrow is sunny with probability 0.9; if today is rainy, tomorrow is sunny with probability 0.5. Stack the state as a vector [sunny ; rainy] and the transition matrix is M = [0.9 0.5 ; 0.1 0.5], each column summing to 1. Tomorrow's outlook is M times today's, so a forecast k days out is M^k times today's: a matrix power problem, and eigenvalues are the right tool.[3]
The characteristic polynomial is lambda^2 - 1.4 lambda + (0.45 - 0.05) = lambda^2 - 1.4 lambda + 0.4 = (lambda - 1)(lambda - 0.4), so the eigenvalues are 1 and 0.4. The steady state is the eigenvector for 1: solve (M - I)v = 0, that is [-0.1 0.5 ; 0.1 -0.5]v = 0, giving 0.1 v1 = 0.5 v2, so v1 = 5 v2: proportions [5 ; 1], meaning 5/6 of days sunny in the long run, about 83 percent, regardless of today.
The second eigenvalue 0.4 is the forgetting rate: the influence of today's weather shrinks by a factor 0.4 each day, since 0.4^k collapses toward zero: after five days, 0.4^5 = 0.01 approximately, one percent influence left.
From a certainly-sunny start, one step gives [0.9;0.1] and two steps give [0.86;0.14]. The exact sunny probability is 5/6 + (1/6)(0.4)k, so its difference from equilibrium is multiplied by 0.4 each step. All entries of M are positive, ensuring the stated convergence. These fixed probabilities define an illustrative model, not an empirical weather forecast. General stochastic matrices can have periodic behavior or several stationary distributions.

Common misconceptions
- Mismatching the order. Column j of
Pmust pair with entry j ofD. Swapping the eigenvalues without swapping the eigenvector columns builds a different, wrong matrix. - Reversing the sandwich. With eigenvectors in
P, the formula isA = P D P^(-1), notP^(-1) D P. Verify by multiplying once; the check costs a minute. - Powering entries directly. Entrywise powering is not matrix powering:
[1 1 ; 0 1]^2 = [1 2 ; 0 1], not[1 1 ; 0 1]. Only diagonal matrices power entry by entry, which is the entire point of D. - Assuming diagonalizability. Defective matrices like the shear have too few eigenvectors. Count independent eigenvectors before writing
P. - Using a singular P. If your eigenvector columns are dependent, you double-collected from one eigenspace. Different eigenvalues never cause this; repeated ones can.
Try it
Diagonalize A = [1 2 ; 2 1], and use the factorization to compute A^2.
Worked answer. Characteristic polynomial: lambda^2 - 2 lambda + (1 - 4) = lambda^2 - 2 lambda - 3 = (lambda - 3)(lambda + 1), so the eigenvalues are 3 and -1. For lambda = 3: [-2 2 ; 2 -2]v = 0 gives v1 = v2, eigenvector [1 ; 1]. For lambda = -1: [2 2 ; 2 2]v = 0 gives v1 = -v2, eigenvector [1 ; -1]. So P = [1 1 ; 1 -1], D = [3 0 ; 0 -1], and P^(-1) = [0.5 0.5 ; 0.5 -0.5] as before.
Then D^2 = [9 0 ; 0 1], so P D^2 = [9 1 ; 9 -1], and multiplying by P^(-1): top-left 4.5 + 0.5 = 5, top-right 4.5 - 0.5 = 4, bottom-left 4.5 - 0.5 = 4, bottom-right 4.5 + 0.5 = 5: A^2 = [5 4 ; 4 5]. Direct check: A^2 = [1 + 4, 2 + 2 ; 2 + 2, 4 + 1] = [5 4 ; 4 5]. Agreement, and note the negative eigenvalue: the machine flips its second eigen-direction, but squaring turns the flip into (-1)^2 = 1.
Recap
A = P D P^(-1): eigenvectors in the columns of P, matching eigenvalues on the diagonal of D.- The factorization is a change of coordinates in which A only stretches axes; verify it by multiplying out once.
- Powers collapse to
A^k = P D^k P^(-1), powering only the diagonal, which unlocks long-run predictions. - Diagonalization needs n independent eigenvectors: distinct eigenvalues guarantee it, symmetric matrices always have it, defective matrices never do.
Eigenvalues thus predict long-term behavior that would be invisible in the raw matrix, which is why they matter far beyond pure mathematics. the orthogonality module adds the last geometric tool, perpendicularity, and puts the whole course to work.
Retrieve, check, and revisit
Before looking back: For A=diag(2,-1) and x0=[0;1], compute A^k x0. Does its largest eigenvalue force growth?
Feedback after attempting
A^k x0=[0;(-1)^k]. The coefficient of the growing eigendirection is zero.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Choose an initial vector with both coordinates nonzero and compare the two terms as k grows. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), diagonalization. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), similarity. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), stochastic matrices. Read the source.
- Key terms
- Diagonalizable
- A matrix that can be written A = P D P^(-1) with D diagonal.
- Diagonal matrix D
- Holds the eigenvalues of A on its diagonal, zeros elsewhere.
- Eigenvector matrix P
- Its columns are linearly independent eigenvectors of A.
- Matrix power formula
- A^k = P D^k P^(-1), computed by raising each diagonal entry of D to the k.
- Dominant eigenvalue
- An eigenvalue of maximum absolute value; the effect on a given initial state also depends on multiplicity, other eigenvalues, and initial coefficients.
Complex Eigenvalues and Real Motion
- Compute complex eigenpairs of a real 2 by 2 matrix.
- Explain conjugate pairing and derive a real invariant-plane representation.
- Connect eigenvalue modulus with rotation and scaling under stated assumptions.
A rotation with no real eigenvector
The real matrix R=[0 -1 ; 1 0] turns every nonzero vector through 90 degrees. No real line through the origin is preserved, so there are no real eigenvectors. Its characteristic equation is lambda2+1=0. Rather than claiming the matrix has no eigenvalues at all, we must specify the number system. Over the complex numbers its eigenvalues are i and -i.[1]
This lesson extends the familiar eigenvector equation to complex scalars and explains what those eigenvalues tell us about real motion. Complex coordinates are an algebraic tool; a real trajectory can still be described entirely by real points.
Key idea: a real matrix can have complex eigenvalues, and conjugate pairs encode real two-dimensional rotation and scaling.
![Successive quarter-turns send [1;0] to [0;1], [-1;0], [0;-1], then back. No nonzero real vector stays on its line after one step.](/assets/img/math-linalg-reviewed/quarter-turn.png)
The complex arithmetic needed here
A complex number is z=a+bi, where a,b are real and i2=-1. Add real and imaginary parts separately. Multiply by distribution and replace i2 with -1. For example, (1+2i)(3-i)=3-i+6i-2i2=5+5i. Equality of complex numbers requires equality of both real and imaginary parts.
The conjugate is z-bar=a-bi, and z times z-bar equals a2+b2. Its modulus is |z|=sqrt(a2+b2). For nonzero z, the reciprocal is z-bar/|z|2. Thus 1/(1+i)=(1-i)/2. The denominator is positive because a and b cannot both be zero.[2]
Write a complex vector as p+iq with real vectors p and q. Matrix multiplication uses the same row-by-column rule. A real A satisfies A(p+iq)=Ap+iAq. This separation will let us interpret a complex eigenpair using two real vectors.
Compute the quarter-turn eigenvectors
For lambda=i, solve (R-iI)v=0. The first row is -iv1-v2=0, so v2=-iv1. Choose v1=1 and obtain v=[1;-i]. Check directly: R[1;-i]=[i;1], while i[1;-i]=[i;1]. The nonzero vector passes the defining test.
For lambda=-i, the corresponding vector is [1;i]. Its image is [-i;1], which equals -i[1;i]. Put these eigenvectors into P=[1 1 ; -i i] and let D=diag(i,-i). The determinant of P is 2i, which is nonzero. Therefore R=PDP-1 over the complex numbers.[1]
Over the reals, the same factorization cannot exist with a real diagonal D, because its diagonal entries would have to be real eigenvalues. There is no contradiction: diagonalizability is always relative to a scalar field. Complex diagonalization does not turn the real quarter-turn into a real stretching along two lines.
Why nonreal roots come in pairs
If A is real and Av=lambda v, conjugate each side. Real entries of A remain unchanged, so A conjugate(v)=conjugate(lambda) conjugate(v). Thus every nonreal eigenpair has a conjugate eigenpair. The characteristic polynomial has real coefficients, which gives the same pairing of roots with multiplicity.[1]
This conclusion depends on A being real. It need not hold for an arbitrary complex matrix. For example, the 1 by 1 matrix [i] has just the eigenvalue i. A real 3 by 3 matrix must have at least one real eigenvalue because an odd-degree real characteristic polynomial has a real root, while any remaining nonreal roots pair up.
A root is an eigenvalue even when its eigenspace has dimension greater than one. As before, obtain the full eigenspace by solving the homogeneous system. Distinct complex eigenvalues provide independent complex eigenvectors, but repeated roots can still leave a defective matrix.
Extract a real invariant plane
Let lambda=a+bi with b nonzero and v=p+iq be an eigenvector of a real matrix. Expand both sides: Ap+iAq=(a+bi)(p+iq)=(ap-bq)+i(bp+aq). Equating real and imaginary parts gives Ap=ap-bq and Aq=bp+aq.[1]
The real vectors p and q are independent. If they were collinear, v would be a nonzero complex scalar times a real vector w, forcing Aw=lambda w. But Aw is real and b is nonzero, which is impossible for nonzero real w. Their span is therefore a real two-dimensional invariant subspace: A sends every combination of p and q back into that plane.
Relative to the ordered basis (p,q), the matrix on this plane is [a b ; -b a]. Relative to (p,-q), it is [a -b ; b a]. The sign difference is caused by the basis orientation, not a disagreement in the algebra. State which basis is used before deciding a rotation direction.
Rotation and scaling in standard coordinates
For the standard matrix A=[a -b ; b a], write rho=sqrt(a2+b2). If rho is positive, choose theta with cos(theta)=a/rho and sin(theta)=b/rho. Then A is rho times the standard rotation matrix. It rotates through theta and scales lengths by rho. Its eigenvalues are a+bi and a-bi, both of modulus rho.[1]
Consider A=[0.6 -0.8 ; 0.8 0.6]. The eigenvalues are 0.6 plus or minus 0.8i, each of modulus 1. Since ATA=I, lengths are preserved. Applying A to [1;0] gives [0.6;0.8], while applying it again gives [-0.28;0.96]. Both have squared length 1.
Now halve every entry: B=[0.3 -0.4 ; 0.4 0.3]. Its eigenvalues have modulus 0.5. Every application rotates by the same angle and halves length. After k steps, a starting length L becomes (0.5)kL. The trajectory approaches zero while turning.
A general real matrix with nonreal eigenvalues can be similar to a rotation-scaling block through a nonorthogonal basis. Then the standard-coordinate lengths need not scale uniformly at each step, and the circular picture becomes distorted. The simple length formula above is justified for the displayed standard rotation-scaling form.
Powers, oscillation, and limits
For R, the quarter-turn matrix, R2=-I, R3=-R, and R4=I. Consequently Rk[1;0] cycles through four points and has no limit. The eigenvalues' modulus 1 signals no decay, but modulus alone does not determine the full trajectory.
For a diagonalizable complex matrix, Akx0=sum cjlambdajkvj. If all eigenvalue moduli are below 1, every term tends to zero. If one magnitude exceeds 1, initial components in its eigendirections can grow. An initial coefficient of zero suppresses that mode. Tied magnitudes and defective blocks require care.[3]
When A and x0 are real, conjugate contributions pair into a real result. One can calculate through complex numbers and then combine conjugate terms, or instead iterate A on real vectors. Both routes describe the same real motion and provide useful cross-checks.
![For the standard rotation-scaling block [0.6 -0.4;0.4 0.6], successive points spiral toward zero, with each norm multiplied by sqrt(0.52).](/assets/img/math-linalg-reviewed/complex-decay.png)
Complex lengths require conjugation
For complex vectors, the real dot-product formula vTv is not a squared norm. With v=[1;i], it gives 1+i2=0 even though v is nonzero. Use the conjugate transpose v*, giving v*v=|1|2+|i|2=2. The complex Euclidean norm is sqrt(sum |vj|2).[4]
This is why the complex counterpart of a real orthogonal matrix is a unitary matrix satisfying Q*Q=I. Likewise the relevant counterpart of a real symmetric matrix is Hermitian, A*=A. We use real symmetric matrices in the later spectral lesson and do not silently transfer its conclusions to every complex symmetric matrix.
Work a new case
For A=[1 -2 ; 2 1], the characteristic polynomial is (1-lambda)2+4, so lambda=1 plus or minus 2i. For lambda=1+2i, the first row of A-lambda I gives -2iv1-2v2=0, so an eigenvector is [1;-i]. Direct multiplication yields [1+2i;2-i]=(1+2i)[1;-i].
The modulus is sqrt(5). In the standard plane, A rotates by an angle whose cosine is 1/sqrt(5) and sine is 2/sqrt(5), then expands every length by sqrt(5). Its determinant is 5, the area factor, and its trace is 2, the sum of its conjugate eigenvalues. Length, area, trace, and eigenvalues give mutually consistent checks.
What to carry forward
Specify the field before saying a matrix has no eigenvalues or is not diagonalizable. For real A, conjugate eigenpairs provide a real invariant plane. The eigenvalue modulus controls scaling in the rotation-scaling model; the argument controls turning. Conjugate transpose, rather than ordinary transpose, defines complex lengths.
Remember: verify Av=lambda v, including the factors of i, then translate the result back into the real behavior the model describes.
Common misconceptions
A real matrix can have nonreal eigenvalues. Conjugate pairing requires real matrix entries. A real invariant plane is not a real eigenline, and a complex squared norm uses conjugation.
Retrieve, check, and revisit
Before looking back: Find the eigenvalues and Euclidean scaling factor of [0 -2;2 0].
Feedback after attempting
The eigenvalues are 2i,-2i. Each application rotates by a quarter-turn and scales lengths by 2.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Divide the matrix by 4 and describe the norm after k applications. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), complex eigenvalues. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), complex numbers. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), diagonalization. Read the source.
- MIT OpenCourseWare, Gilbert Strang. Linear Algebra (Fall 2011), symmetric matrices and positive definiteness, lecture and summary. Read the source.
- Key terms
- Complex number
- A number a+bi with real a,b and i^2=-1.
- Conjugate
- The number a-bi corresponding to a+bi.
- Modulus
- The nonnegative length sqrt(a^2+b^2) of a+bi.
- Invariant subspace
- A subspace that a linear map sends into itself.
- Conjugate transpose
- Transpose followed by entrywise complex conjugation, written A*.
- Diagonalizable over a field
- Having a basis of eigenvectors with coordinates and eigenvalues in the stated field.
Module 8: Orthogonality, Projections, and Applications
Use perpendicularity to build projections, solve least-squares problems, and see linear algebra at work.
Orthogonality and Projections
- Recognize orthogonal and orthonormal sets of vectors.
- Project one vector onto another using the projection formula.
- Explain the geometric meaning of a projection.
Orthogonality, the linear-algebra word for perpendicularity, brings geometry into full force. It makes bases easy to use, it splits vectors into independent parts, and it underlies the most important application of the whole subject, least-squares fitting. The tools are modest: the dot product from Module 4 and one new formula. The consequences run from audio compression to satellite navigation.
Orthogonal and orthonormal sets
Recall that two vectors are orthogonal when their dot product is zero. A set of vectors is an orthogonal set if every pair of distinct vectors is orthogonal. We require the vectors in an orthogonal set used as a basis to be nonzero. If, in addition, every vector has length 1, the set is orthonormal. The standard basis {[1 ; 0], [0 ; 1]} is orthonormal: the two vectors are perpendicular and each has length 1. The set {[1 ; 1], [1 ; -1]} is orthogonal, since 1*1 + 1*(-1) = 0, but not orthonormal, because each vector has length sqrt(2). Dividing each by its length repairs that: {[1/sqrt(2) ; 1/sqrt(2)], [1/sqrt(2) ; -1/sqrt(2)]} is orthonormal.[3]
Why prize such bases? Because coordinates in them come from dot products, with no system to solve. If {u1, u2} is orthogonal, the weight of a vector b along u1 is (u1 . b)/(u1 . u1), and likewise for u2.
Express b = [4 ; 2] in the basis {[1 ; 1], [1 ; -1]}: the first weight is ([1 ; 1] . [4 ; 2]) / ([1 ; 1] . [1 ; 1]) = (4 + 2)/(1 + 1) = 3, and the second is (4 - 2)/2 = 1. So b = 3[1 ; 1] + 1[1 ; -1], the same coordinates (3, 1) that Module 5 found by solving a system, now produced by two dot products.
In an orthogonal basis, every direction can be measured independently, because no basis vector overlaps any other. That is the working meaning of zero dot product: what happens along one basis direction is invisible to the rest, so each coordinate can be computed, stored, or discarded on its own.
Key idea: orthogonal means no overlap; in an orthogonal basis, each coordinate is a private dot-product measurement.
Projecting one vector onto another
Given a vector b and a nonzero direction a, the projection of b onto a is the shadow b casts along the line through a. It is the point on that line closest to b, and the formula is[2]
proj_a(b) = ( (a . b) / (a . a) ) a.
Where does the formula come from? The shadow is some multiple c a of the direction, chosen so that the leftover b - c a is perpendicular to a. Write that requirement with dot products: (b - c a) . a = 0, so a . b - c (a . a) = 0, and solving for the scalar gives c = (a . b)/(a . a). The formula is the perpendicularity condition, solved.
Worked example. Project b = [3 ; 4] onto a = [1 ; 0].
- Numerator:
a . b = 1*3 + 0*4 = 3. - Denominator:
a . a = 1*1 + 0*0 = 1. - Projection:
(3/1)[1 ; 0] = [3 ; 0].
The shadow of [3 ; 4] onto the x-axis is [3 ; 0], exactly as geometry predicts. The leftover piece, b - proj_a(b) = [0 ; 4], is perpendicular to a; every vector splits uniquely into a part along a and a part orthogonal to it.
A tilted example. Project b = [3 ; 4] onto a = [1 ; 1]. Numerator: a . b = 3 + 4 = 7. Denominator: a . a = 1 + 1 = 2. Projection: (7/2)[1 ; 1] = [3.5 ; 3.5]. Residual: b - [3.5 ; 3.5] = [-0.5 ; 0.5], and its dot with a is -0.5 + 0.5 = 0: perpendicular, as designed. The residual's length, sqrt(0.25 + 0.25) = sqrt(0.5), about 0.71, is the distance from the point (3, 4) to the line y = x: projection is also a distance-measuring tool.
Because the two pieces are perpendicular, Pythagoras must hold, and it does: ||proj||^2 = 3.5^2 + 3.5^2 = 24.5, the residual contributes 0.25 + 0.25 = 0.5, and the total is 24.5 + 0.5 = 25 = ||b||^2. This split of any vector into a part along a chosen direction and a part perpendicular to it is called the orthogonal decomposition, and it is unique: no other pair of along-and-across pieces rebuilds b.
![The orthogonal projection of [3;1] onto the line spanned by [1;1] is [2;2]. The residual [1;-1] is perpendicular to the line.](/assets/img/math-linalg-reviewed/projection-residual.png)
Why projections matter
Projection answers the question "what is the closest vector in a subspace to a given target?" The gap between the target and its projection is as small as possible and is orthogonal to the subspace. That optimality is the key to fitting models to imperfect data, the subject of the next lesson. Physics has used the same split forever: gravity pulling on a cart sitting on a ramp decomposes into a component along the ramp, which makes the cart roll, and a component perpendicular to it, which the ramp itself resists. Computing either component is one projection formula.[3]
A related procedure, Gram-Schmidt, uses repeated projections to convert any basis into an orthonormal one by subtracting off overlaps, turning a tilted coordinate system into a clean perpendicular one. Watch it once, in full. Start with the basis v1 = [1 ; 1], v2 = [1 ; 0], which is not orthogonal since v1 . v2 = 1.
- Keep the first vector:
u1 = v1 = [1 ; 1]. - Remove from
v2its shadow alongu1: the coefficient is(u1 . v2)/(u1 . u1) = 1/2, sou2 = v2 - (1/2)u1 = [1 - 0.5 ; 0 - 0.5] = [0.5 ; -0.5]. - Check:
u1 . u2 = 0.5 - 0.5 = 0. Orthogonal. - Normalize both:
||u1|| = sqrt(2)givesq1 = [1/sqrt(2) ; 1/sqrt(2)], and||u2|| = sqrt(0.5)givesq2 = [1/sqrt(2) ; -1/sqrt(2)].
The result spans the original plane. For additional independent vectors, subtract projections onto every previously obtained orthonormal direction and normalize the nonzero remainder. This gives one construction of a QR factorization. QR can also be computed by Householder reflections or Givens rotations; it is not the name of a single stabilized Gram-Schmidt algorithm. The dedicated QR lesson works through the factors and their numerical use.
Orthogonal matrices: rigid motions in matrix form
Pack an orthonormal basis of Rn as the columns of a square n by n matrix Q and something clean happens: Q^T Q = I, because each dot product of columns lands a 1 on the diagonal (unit lengths) and 0 elsewhere (perpendicularity). Such a Q is called an orthogonal matrix, and its inverse is free of charge: Q^(-1) = Q^T. Rotations and reflections are the prime examples; check the rotation [0.6 -0.8 ; 0.8 0.6]: column lengths sqrt(0.36 + 0.64) = 1 each, and their dot product 0.6*(-0.8) + 0.8*0.6 = 0.[1]
See the preservation concretely: apply Q = [0.6 -0.8 ; 0.8 0.6] to [3 ; 4]. The output is [0.6*3 - 0.8*4 ; 0.8*3 + 0.6*4] = [-1.4 ; 4.8], whose squared length is 1.96 + 23.04 = 25: still length 5. The arrow turned; nothing stretched.
For a real square orthogonal Q, (Qu) dot (Qv) = uTQTQv = u dot v. Thus lengths and angles between nonzero vectors are preserved, and Q-1 = QT. A rectangular matrix with orthonormal columns still has QTQ = I, but QQT generally differs from I and Q has no two-sided inverse. It instead maps coordinates isometrically into its column space.
A real use: compression by projection
Consider the orthonormal vectors q1 = [1;1]/sqrt(2) and q2 = [1;-1]/sqrt(2). A two-sample signal b = [4;2] has coefficients 3sqrt(2) and sqrt(2). Keeping only q1 reconstructs [3;3], leaving residual [1;-1] with squared norm 2. Orthogonality makes the discarded squared coefficient equal to that squared error.
This is a mathematical example of approximation by retaining selected coordinates. Whether a discarded component is unimportant depends on the application, not merely on its frequency or size. Real image and audio formats also involve quantization, coding, and perceptual choices. Projection alone is not a complete codec.
Common misconceptions
- Dividing by the length instead of the squared length. The denominator is
a . a, which is||a||^2. Writing(a . b)/||a||gives a scalar with the wrong size. - Treating projection as symmetric. Projecting
[3 ; 4]onto[1 ; 0]gives[3 ; 0]; projecting[1 ; 0]onto[3 ; 4]gives(3/25)[3 ; 4] = [0.36 ; 0.48]. Order matters: one vector supplies the direction, the other casts the shadow. - Reporting the scalar as the projection. The coefficient
(a . b)/(a . a)is a number; the projection is that number timesa, a vector. - Claiming independent vectors must be orthogonal.
[1 ; 0]and[1 ; 1]are independent yet not perpendicular. The true implication runs the other way: orthogonal nonzero vectors are always independent. - Calling a set orthonormal after checking only angles. Orthonormal requires unit lengths too;
{[1 ; 1], [1 ; -1]}is orthogonal but not orthonormal.
Why the perpendicular foot is closest
Let p be the projection of b onto a line W and r = b-p, with r perpendicular to W. Any competing point w in W gives b-w = r+(p-w). The two terms are perpendicular, so ||b-w||2 = ||r||2 + ||p-w||2, which is at least ||r||2. Equality holds only when w=p. This proves both optimality and uniqueness, rather than relying only on a sketch.[2]
For nonzero a, the projection matrix is P = aaT/(aTa). It satisfies PT = P and P2 = P. For a = [1;1], P = (1/2)[1 1 ; 1 1]. Applying P twice changes nothing after the first projection. Projection onto the zero subspace is defined separately as the zero map.
![Squared distance from [3;1] to [s;s] is 2(s-2)^2+2, uniquely minimized at s=2, the projection.](/assets/img/math-linalg-reviewed/closest-point.png)
Try it
Project b = [5 ; 1] onto a = [2 ; 1], find the residual, and verify the residual is orthogonal to a.
Worked answer. Numerator: a . b = 2*5 + 1*1 = 11. Denominator: a . a = 4 + 1 = 5. Projection: (11/5)[2 ; 1] = [4.4 ; 2.2]. Residual: b - [4.4 ; 2.2] = [0.6 ; -1.2]. Orthogonality check: [0.6 ; -1.2] . [2 ; 1] = 1.2 - 1.2 = 0. The shadow along a plus a perpendicular leftover rebuilds b exactly.
Recap
- Orthogonal sets have pairwise zero dot products; orthonormal adds unit lengths, and coordinates become dot products.
proj_a(b) = ((a . b)/(a . a)) ais the closest point on the line through a, and the residual is perpendicular.- Gram-Schmidt subtracts shadows to orthonormalize any basis; orthogonal matrices satisfy
Q^(-1) = Q^Tand preserve shape. - Projection is the mathematics of best approximation, and compression is projection with small parts discarded.
the least-squares lesson points this machinery at data: when no exact solution exists, project onto what is reachable and take the closest thing, the method of least squares.
Retrieve, check, and revisit
Before looking back: Project [3;1] onto span{[1;1]}; show the residual is perpendicular.
Feedback after attempting
The projection is [2;2] and residual [1;-1], whose dot product with [1;1] is zero.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Compare distances to the projection and to [0;0] using the Pythagorean identity. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), dot product. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), projections. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), orthogonal sets. Read the source.
- Key terms
- Orthogonal set
- A set of vectors in which every pair has dot product zero.
- Orthonormal set
- An orthogonal set in which every vector also has length 1.
- Projection
- For nonzero a, the vector ((a dot b)/(a dot a))a is the closest point to b in span{a}.
- Orthogonal complement piece
- The leftover b - proj_a(b), which is perpendicular to a.
- Gram-Schmidt process
- A procedure that turns any basis into an orthonormal one using projections.
Least Squares and Applications of Linear Algebra
- Explain how projection solves an inconsistent system in the least-squares sense.
- Set up the normal equations for a best-fit line.
- Recognize where linear algebra is applied across science and technology.
A linear model may impose more observations than it can match exactly. Least squares chooses parameter vectors minimizing ||Ax-b||2. The problem is meaningful for both consistent and inconsistent systems. The fitted output A x-hat is unique, while x-hat itself is unique only when the columns of A are independent.
The least-squares idea
If Ax = b has no solution, then b lies outside the column space of A: the machine cannot manufacture it. The best we can do is replace b by its projection onto the column space, the closest reachable vector, and solve exactly for that. The resulting x-hat (read: x hat, the hat marking an estimate) minimizes the length of the error ||Ax - b||, which is the same as minimizing the sum of squared errors, hence the name.[1]
The last lesson showed that closest means perpendicular residual. Here that principle becomes an equation. The residual b - A x-hat must be orthogonal to every column of A, and dotting a vector with every column of A at once is exactly multiplication by A^T, the transpose (rows and columns swapped). So orthogonality says A^T (b - A x-hat) = 0. Distribute and rearrange:
A^T A x-hat = A^T b.
These are the normal equations (normal is the geometry word for perpendicular). They always have a solution, and it is the least-squares answer. Notice the sizes: if A is n x 2, then A^T A is a tiny 2 x 2, however large n grows. With two parameters the normal matrix is 2 by 2, but forming it still requires processing the observations. It is useful for derivation and small hand calculations; QR or SVD is often preferable for numerical computation.
Key idea: unable to reach b, aim for its shadow on the column space; the normal equations are the perpendicularity condition written in matrix form.
Worked example: fitting a line
Suppose we want the best-fit line y = m x + c through the three points (0, 1), (1, 2), and (2, 2). Each point demands c + m x = y, giving an overdetermined system with[3]
A = [1 0 ; 1 1 ; 1 2], unknowns [c ; m], and b = [1 ; 2 ; 2].
The three rows say: the line should pass through all three points. It cannot (the points are not collinear), so we build the normal equations.
First the transpose, concretely: flipping A across its diagonal turns its three rows into three columns, so the 3 x 2 matrix becomes the 2 x 3 matrix A^T = [1 1 1 ; 0 1 2]. Multiply out A^T A entry by entry: top-left 1 + 1 + 1 = 3; top-right 0 + 1 + 2 = 3; bottom-left the same 3 by symmetry; bottom-right 0 + 1 + 4 = 5.
Next the right-hand side, A^T b: first entry 1 + 2 + 2 = 5, second entry 0*1 + 1*2 + 2*2 = 6. In sums language, the matrix collected the count, sum x, and sum x^2, while the right side collected sum y and sum xy. That pattern holds for any number of points, which is why calculators and spreadsheets can fit lines from five running sums without ever storing the raw data twice.
Solve [3 3 ; 3 5][c ; m] = [5 ; 6]. Replace R2 with R2 - R1: [0 2 | 1], so 2m = 1 and m = 0.5. Back-substitute: 3c + 3(0.5) = 5, so 3c = 3.5 and c = 7/6. The best-fit line is y = 0.5 x + 7/6.
Audit the fit. Predictions: at x = 0, y = 7/6, missing the data value 1 by -1/6; at x = 1, y = 10/6 = 5/3, missing 2 by +1/3; at x = 2, y = 13/6, missing 2 by -1/6. The squared misses total 1/36 + 4/36 + 1/36 = 6/36 = 1/6, and no line does better.
Orthogonality is visible too: the residual vector is r = [-1/6 ; 1/3 ; -1/6], and A^T r has entries -1/6 + 1/3 - 1/6 = 0 and 0(-1/6) + 1(1/3) + 2(-1/6) = 0. The error really is perpendicular to both columns, and the fitted formula evaluates outside the observed interval as follows: at x = 3, the fitted value is y = 0.5(3) + 7/6 = 8/3, about 2.67. This extrapolation is a model output, not evidence of an accurate future measurement.
Key idea: build A from the model, form A^T A and A^T b, solve the small system, then read predictions off the fitted formula.

When do the normal equations pin down one answer?
The matrix A^T A is always square and symmetric, and it is invertible exactly when the columns of A are linearly independent. In the line-fitting example the columns were [1 ; 1 ; 1] and [0 ; 1 ; 2], not multiples of each other, so the solution (c, m) was unique. Dependence happens in degenerate designs, for instance fitting a line when every data point has the same x-value: a vertical stack of points cannot decide a slope, and the algebra signals it honestly with a singular A^T A.[1]
Even then the projection of b is unique; only its description in parameters is not. Statisticians call this collinearity, and the cure is a better set of columns, meaning genuinely different measurements.
One boundary case rounds out the picture. If the system happens to be consistent after all, the projection of b is b itself, every least-squares minimizer is an exact solution with zero residual; there may be more than one parameter vector. Least squares is a strict generalization of solving: it agrees with elimination whenever elimination has an answer, and it keeps working when elimination gives up.
Applications across fields
A linear fit describes dependence within a chosen model. For instance, using a constant column plus size and age columns gives a model y-hat = beta0 + beta1 size + beta2 age. A fitted coefficient describes the modeled change holding the other included variables fixed. It does not by itself establish a causal effect.[3]
The algebra requires no probability distribution. Statistical uncertainty estimates require further assumptions about observations and errors. Check units, residual patterns, influential observations, and whether the application justifies extrapolation. Squaring residuals makes large deviations influential, so an outlier can substantially change a fit.
A model can be linear in its parameters even when it is curved in its input: c0 + c1 t + c2 t2 is linear in c0,c1,c2. Its design matrix has columns 1,t,t2. In contrast, a model with unknown frequency in sin(omega t) is nonlinear in omega and is not solved by one ordinary linear least-squares system.
Nonlinear models sometimes use a sequence of linearized least-squares subproblems, but their prediction sets are not generally vector subspaces, and a global orthogonal-projection interpretation need not hold. This distinction prevents carrying linear guarantees into problems that do not satisfy them.
Rank deficiency and a unique fitted output
Let A = [1 1 ; 1 1] and b = [1;3]. Any fitted vector has the form [s;s], where s=x1+x2. The objective is (s-1)2+(s-3)2 = 2(s-2)2+2. Its minimum occurs at s=2, giving the unique fitted output [2;2] and residual [-1;1]. Infinitely many coefficient pairs, [t;2-t], attain it.[2]
For any real A, xTATAx = ||Ax||2. Therefore Null(ATA) = Null(A), proving that the normal matrix is invertible exactly when the columns are independent. With full column rank, its 2-norm condition number is the square of A's; forming it can worsen sensitivity to rounding. QR avoids explicitly forming the normal matrix, while SVD also supports rank-deficient problems.[4]
The orthogonality of the residual concerns vectors in observation space Rm. For line fitting, each individual residual is still a vertical difference in the plotted (t,y) plane. These are distinct geometric statements and are fully compatible.
![All coefficient pairs on x1+x2=2 give the same best fitted output [2;2]. The pair [1;1] has the smallest coefficient norm.](/assets/img/math-linalg-reviewed/nonunique-fit.png)
Common misconceptions
- Reaching for A^(-1). A 3 x 2 matrix has no inverse, so
x = A^(-1) bis meaningless for overdetermined systems. The matrix A^T A is invertible only when A has independent columns. - Transposing one side only. The normal equations apply
A^Tto both sides:A^T A x-hat = A^T b. WritingA^T A x-hat = bmismatches sizes and answers. - Expecting the line to hit the points. The fit minimizes total squared vertical miss; usually no residual is zero. A perfect hit happens only when the system was consistent, in which case least squares quietly returns the exact solution.
- Reading the errors as perpendicular distances. Standard least squares measures vertical gaps (in y), not shortest distances to the line; fitting perpendicular offsets is a different, harder problem.
- Forgetting the independence check. If the columns of A are dependent,
A^T Ais singular and parameters are not unique; the model needs better-chosen columns.
Try it
Find the least-squares line y = m x + c through (0, 0), (1, 1), and (2, 3).
Worked answer. Here A = [1 0 ; 1 1 ; 1 2] and b = [0 ; 1 ; 3]. Then A^T A = [3 3 ; 3 5] as before, and A^T b = [0 + 1 + 3 ; 0*0 + 1*1 + 2*3] = [4 ; 7]. Solve [3 3 ; 3 5][c ; m] = [4 ; 7]: replace R2 with R2 - R1 to get [0 2 | 3], so m = 1.5; then 3c + 3(1.5) = 4 gives 3c = -0.5, so c = -1/6. The line is y = 1.5 x - 1/6.
Residuals: 0 - (-1/6) = 1/6, then 1 - 4/3 = -1/3, then 3 - 17/6 = 1/6; they sum to zero and their x-weighted sum 0(1/6) + 1(-1/3) + 2(1/6) = 0, confirming perpendicularity to both columns.
Recap
- Inconsistent systems get closest-fit solutions: project b onto the column space and solve for the projection.
- The normal equations
A^T A x-hat = A^T bencode the perpendicular-residual condition and stay small even for big data. - Fitting a line is the flagship case: A holds a column of 1s and a column of x-values, and the solve is 2 x 2.
- Unique parameters require independent columns. Applications must also check the model assumptions and distinguish linear fitting from nonlinear estimation.
Every one of these applications rests on the same handful of ideas you have now learned: systems and elimination, matrices and determinants, vector spaces and bases, eigenvalues, and orthogonality. Linear algebra is the quiet engine beneath modern computation, and now you have seen how it runs.
Retrieve, check, and revisit
Before looking back: Fit a constant to observations 2,4,9. Show that the residuals sum to zero.
Feedback after attempting
The best constant is 5. Residuals are -3,-1,4; their sum is 0 and squared sum is 26.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Fit the same observations at t=0,1,2 with an intercept and slope, then compare residual norms. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), least squares. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), projections. Read the source.
- Stephen Boyd and Lieven Vandenberghe. Introduction to Applied Linear Algebra (2018), Chapter 12: Least squares. Read the source.
- MIT OpenCourseWare. Introduction to Numerical Methods (Spring 2019), Week 4, Lectures 9 and 10. Read the source.
- Key terms
- Least squares
- Finding parameter vectors minimizing ||Ax-b||^2, whether or not Ax=b is consistent.
- Normal equations
- A^T A x-hat = A^T b, whose solution is the least-squares answer.
- Transpose
- The matrix A^T formed by swapping the rows and columns of A.
- Best-fit line
- The line minimizing the total squared vertical distance to a set of data points.
- Overdetermined system
- A system with more equations than unknowns, usually inconsistent.
Orthogonal Complements and the Four Fundamental Subspaces
- Compute bases and dimensions for all four fundamental subspaces.
- Prove the two orthogonal-complement relationships and locate their ambient spaces.
- Use the left null space to test consistency and interpret least-squares residuals.
Two spaces on each side of a matrix
An m by n matrix A maps input vectors in Rn to output vectors in Rm. Its column space and null space are familiar, but they live on different sides of that map. Adding the row space and the left null space completes the picture. The four spaces organize which input components matter, which outputs are reachable, and which residuals cannot be removed.[1]
For a matrix with two rows and three columns, never draw all four spaces as if they occupied the same plane. The input-side spaces are subspaces of R3; the output-side spaces are subspaces of R2. Their dimensions are related even when their ambient spaces differ.
Key idea: each input splits into a row-space component and a null-space component, while each output target splits into a column-space component and a left-null-space component.
What an orthogonal complement contains
For a subspace W of Rn, its orthogonal complement W-perp is the set of vectors perpendicular to every vector in W. It is enough to check perpendicularity to a basis of W, since dot products distribute over linear combinations. The complement is a subspace, and dim(W)+dim(W-perp)=n.[1]
If W=span{[1;2]} in R2, then [x;y] lies in W-perp exactly when x+2y=0. Thus W-perp=span{[-2;1]}. In R3, the orthogonal complement of the line spanned by [1;2;0] is the plane x+2y=0, with basis [-2;1;0],[0;0;1]. The same line direction has different complements in different ambient spaces.
Every v in Rn has a unique decomposition v=w+z with w in W and z in W-perp. If two decompositions existed, their difference would belong to both spaces. A vector in W and W-perp is perpendicular to itself, so its squared length is zero and it must be zero. Existence follows by taking an orthonormal basis of W and subtracting its projection from v.[2]
Name and locate the four spaces
Let rank(A)=r. The row space Row(A)=Col(AT) is in Rn and has dimension r. The null space Null(A) is also in Rn and has dimension n-r. The column space Col(A) is in Rm and has dimension r. The left null space Null(AT) is in Rm and has dimension m-r.[1]
Why is Null(A) the orthogonal complement of Row(A)? Each entry of Ax is one row of A dotted with x. Thus Ax=0 exactly when x is perpendicular to every row, equivalently to their span. Replacing A by AT gives Null(AT)=Col(A)-perp. These are equality statements, not just claims that some particular vectors happen to have zero dot products.
The two orthogonal decompositions are Rn=Row(A) plus Null(A), and Rm=Col(A) plus Null(AT). The word plus here means a unique sum with perpendicular components. It does not mean union: most vectors lie in neither component alone.

Compute all four spaces for one matrix
Use A=[1 2 0 ; 2 4 0]. Subtract twice row 1 from row 2 to obtain [1 2 0 ; 0 0 0], so the rank is 1. A row-space basis is [1;2;0], viewed as a coordinate vector in R3. A column-space basis is the first original column [1;2], in R2.
The null equation is x1+2x2=0, with x2=s and x3=t free. Hence x=[-2s;s;t], giving null-space basis [-2;1;0] and [0;0;1]. The dimensions on the input side are 1 and 2, adding to 3.
For the left null space, ATy=0 reduces to y1+2y2=0, so a basis is [-2;1]. The dimensions on the output side are 1 and 1, adding to 2. Notice that the left null basis has two entries, while the ordinary null basis vectors have three.
Check the perpendicular pairs directly: [1;2;0] dot [-2;1;0]=0 and [1;2;0] dot [0;0;1]=0. On the output side, [1;2] dot [-2;1]=0. Check each null-space basis by matrix multiplication as well. Arithmetic checks complement the proof that these bases describe the whole spaces.
Separate an input into visible and invisible parts
For x=[3;1;4], project onto Row(A)=span{u} with u=[1;2;0]. The coefficient is (u dot x)/(u dot u)=(3+2)/5=1, giving x-row=[1;2;0]. The remainder x-null=[2;-1;4] is in Null(A), because 2+2(-1)=0.
The output is Ax=[5;10]. Also A x-row=[5;10], while A x-null=0. The matrix responds only to the row-space component. Changing the invisible component creates a different input with the same output. This is an exact description of nonuniqueness, not a metaphor about data compression.
Restricted to Row(A), the map A is one-to-one: a vector there that also maps to zero belongs to Row(A) intersect Null(A), so it is zero. Its image is all of Col(A). Consequently A pairs these two r-dimensional spaces bijectively, even if A itself is rectangular or singular.[1]
A certificate that a system is inconsistent
If Ax=b is solvable, every y in Null(AT) satisfies yTb=yTAx=0. Conversely, if b is perpendicular to the entire left null space, then b lies in its orthogonal complement Col(A), so the system is solvable. Thus the left null space can certify inconsistency.[1]
For the example A, choose y=[-2;1]. If b=[3;6], then y dot b=-6+6=0 and the system is consistent. If b=[3;7], then y dot b=-6+7=1, proving inconsistency without solving for x. This y encodes the equation combination minus twice row 1 plus row 2: its coefficients cancel but its constants do not.
Checking just one left-null vector is enough to disprove consistency when its dot product is nonzero. To prove consistency by this method, check a basis of the entire left null space. One zero dot product alone is insufficient when that space has more than one independent direction.
Least-squares residuals belong to the left null space
For any target b, its projection p onto Col(A) is the unique closest reachable output. The residual r=b-p lies in Null(AT), so ATr=0. This is exactly the normal-equation condition. The geometry remains valid when A has dependent columns and coefficients are not unique.[2][3][3]
For A above and b=[3;7], the projection onto [1;2] has coefficient (3+14)/5=17/5. Therefore p=[17/5;34/5] and r=[-2/5;1/5]=(1/5)[-2;1]. Its squared norm is 1/5. The normal equations choose the reachable vector p, but any x satisfying x1+2x2=17/5 has that same fit.
Among all those coefficient vectors, the unique smallest-norm one lies in Row(A). Set x-min=c[1;2;0]. The condition becomes 5c=17/5, so c=17/25 and x-min=[17/25;34/25;0]. Adding any nonzero null-space vector increases its squared length by the squared length of that perpendicular addition. This anticipates the pseudoinverse.
![For b=[3;7] and column space span{[1;2]}, the fit is [17/5;34/5]. The nonzero residual [-2/5;1/5] is perpendicular to the column space.](/assets/img/math-linalg-reviewed/left-null-residual.png)
Row operations preserve some spaces, not all
Reversible row operations preserve Row(A) and Null(A), because they preserve row combinations and the homogeneous system. They do not generally preserve Col(A) as a subset of Rm. In the example, the reduced matrix's column space is span{[1;0]}, whereas the original's is span{[1;2]}.
Use pivot positions from an echelon form to select original columns for a column-space basis. Nonzero echelon rows themselves can serve as a row-space basis. To find the left null space, solve ATy=0 or explicitly track row operations. Counting zero rows gives its dimension m-r, not its actual vectors.
There is no determinant test for a general rectangular matrix. Rank, bases, and the two null spaces are the tools that apply without a square-shape assumption. State dimensions and ambient spaces in every answer.
A small independent check
For B=[1 0 1 ; 0 1 1], rank is 2. Its column space is R2 and its left null space is {0}. Its null space is span{[-1;-1;1]}. The row space is spanned by [1;0;1] and [0;1;1], both perpendicular to that null vector.
Every target in R2 is reachable, but none has a unique input because a one-dimensional kernel can be added to any solution. This example separates surjectivity from injectivity and shows why the two sides of the four-space diagram must remain distinct.
Recap
Input side: Row(A) and Null(A), dimensions r and n-r. Output side: Col(A) and Null(AT), dimensions r and m-r. The pairs are orthogonal complements. A discards the input null component; least squares discards the target's left-null component.
Remember: write the ambient space before computing a basis, and check that each pair of dimensions adds to the correct side of the matrix.
Common misconceptions
Row(A) lies in the domain, while Col(A) lies in the codomain. Row operations preserve the row space and null space, but generally change the column space as a set. A nonzero least-squares residual belongs to Null(A^T), not generally Null(A).
Retrieve, check, and revisit
Before looking back: For A=[1 0;0 0;0 0], give the dimensions of all four fundamental subspaces.
Feedback after attempting
Row and column spaces have dimension 1. Null(A) has dimension 1 in R2; Null(A^T) has dimension 2 in R3.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Choose b outside the column space and find a left-null vector y with y^T b nonzero. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), orthogonal complements. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), projections. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), least squares. Read the source.
- Key terms
- Orthogonal complement
- Vectors perpendicular to every vector in a given subspace of a specified ambient Euclidean space.
- Row space
- The span of the rows of A, contained in the input space Rn.
- Left null space
- Null(A^T), contained in the output space Rm.
- Orthogonal decomposition
- A unique split into components in a subspace and its orthogonal complement.
- Consistency certificate
- A left-null vector with nonzero dot product with b proves Ax=b is inconsistent.
- Minimum-norm solution
- The solution of smallest Euclidean length among all solutions or least-squares minimizers.
Gram-Schmidt, QR, and Stable Least Squares
- Construct a reduced QR factorization from independent columns.
- Solve least squares by triangular back-substitution and verify the residual.
- Distinguish exact orthogonality, numerical stability, and problem conditioning.
Turn a tilted basis into perpendicular directions
The independent vectors a1=[1;1;0] and a2=[1;0;1] span a plane in R3, but their dot product is 1, so they are not perpendicular. We will build an orthonormal basis for the same plane, record the conversion as A=QR, and use it to solve a least-squares problem. The factorization preserves the column space while changing its basis.[1]
Throughout the main construction, A is a real m by n matrix with independent columns and m at least n. The reduced Q has shape m by n and orthonormal columns. R has shape n by n and is upper triangular with positive diagonal entries. These dimensions matter: Q need not be square.
Key idea: subtract components already explained, normalize the new direction, and record every coefficient so that the original columns can be reconstructed.
One Gram-Schmidt step at a time
Start with u1=a1 and q1=u1/||u1||. For column aj, subtract its projections onto q1 through q(j-1): uj=aj-sum (qi dot aj)qi. If uj is nonzero, set qj=uj/||uj||. The new qj is perpendicular to all earlier q vectors and has unit length.[1][2]
The independence assumption ensures a nonzero remainder in exact arithmetic. If uj=0, then aj is already in the span of earlier columns, so normalizing would divide by zero. One can skip dependent columns when finding a basis for a span, but the full-column-rank QR formula taught here then needs modification.
Why do spans agree? The first j original columns generate the first j q vectors because the procedure uses only their linear combinations. Conversely, each aj is its subtracted projections plus uj, so it lies in the span of q1 through qj. Both containments establish equality of spans at every stage.
![Subtracting the projection of a2=[1;2] onto a1=[2;0] leaves [0;2], perpendicular to a1. Normalize both directions to obtain Q.](/assets/img/math-linalg-reviewed/gram-schmidt.png)
Complete the two-column example
For a1=[1;1;0], the length is sqrt(2), so q1=[1;1;0]/sqrt(2). Compute q1 dot a2=1/sqrt(2). The projected part is (1/2)[1;1;0]. Subtract it from a2 to get u2=[1/2;-1/2;1].
Its squared length is 1/4+1/4+1=3/2, so ||u2||=sqrt(6)/2. Therefore q2=[1;-1;2]/sqrt(6). Verify q1 dot q2=(1-1+0)/sqrt(12)=0 and q2 dot q2=(1+1+4)/6=1. We now have an orthonormal basis for the original plane.
The matrix Q has those two columns. Define R=[sqrt(2) 1/sqrt(2) ; 0 sqrt(6)/2]. Column 1 of QR is sqrt(2)q1=a1. Column 2 is (1/sqrt(2))q1+(sqrt(6)/2)q2=[1;0;1]=a2. Thus A=QR has been verified column by column, with every coefficient tied to a projection or norm.
Why the factor is triangular
Define rij=qi dot aj when i is less than j, and rjj=||uj||. Entries below the diagonal are zero because aj belongs to the span of the first j q vectors and is perpendicular to later ones. The reconstruction aj=sum from i=1 to j of rij qi is the jth column of A=QR.[2][4]
Multiplying A=QR on the left by QT gives R=QTA because QTQ=I. This is a useful verification formula, not a substitute for constructing Q. An arbitrary orthonormal Q with a different column space will not give A=Q(QTA).
With full column rank and positive diagonal entries in R, the reduced QR factorization is unique. If signs on the diagonal are unrestricted, one can flip a Q column and the matching R row without changing their product. A different valid sign convention is not an arithmetic error.
Least squares becomes a triangular solve
For A=QR with independent columns, the projection of b onto Col(A) is QQTb. Thus the minimizing coefficients solve QR x-hat=QQTb. Multiplying by QT yields R x-hat=QTb. R is invertible and triangular, so back-substitution gives a unique answer.[2]
Continue with the example and b=[1;2;2]. Then QTb=[3/sqrt(2);3/sqrt(6)]. The last row gives (sqrt(6)/2)x2=3/sqrt(6), so x2=1. The first row gives sqrt(2)x1+1/sqrt(2)=3/sqrt(2), so x1=1.
The fitted output is A[1;1]=[2;1;1], and the residual is r=[-1;1;1]. It is perpendicular to a1 and a2: -1+1=0 for each corresponding dot product. Its squared norm is 3. These checks verify the fit independently of the triangular equations.
For any other coefficients x, write b-Ax=r+A(x-hat-x). The two terms are perpendicular, so their squared lengths add. The value 3 is therefore the minimum squared error, and full column rank makes the coefficient vector unique.
Rectangular Q is not an invertible square matrix
Here Q has three rows and two columns. It satisfies QTQ=I2, but QQT is a 3 by 3 projection matrix with rank 2. It is not I3. A vector perpendicular to the plane maps to zero under QQT, while vectors in the plane remain unchanged.
For this plane, n=[1;-1;-1]/sqrt(3) is a unit normal. The projector is I3-nnT, or (1/3)[2 1 1 ; 1 2 -1 ; 1 -1 2]. Multiplying it by b=[1;2;2] gives [2;1;1], the fitted output. This is a separate geometric check on the QR result.
A full QR factorization can extend Q to a square orthogonal matrix by adding an orthonormal basis of the perpendicular complement. The accompanying R then has additional zero rows. Always state whether the reduced or full convention is being used.[2]
Exact algebra and finite-precision computation
In exact arithmetic, classical Gram-Schmidt subtracts projections computed from the original aj. Modified Gram-Schmidt updates the remainder after each subtraction and computes the next coefficient from that remainder. They produce the same mathematical result in exact arithmetic, but can behave differently with rounded numbers.[4]
Nearly dependent columns make the remainder small. Subtracting nearly equal quantities can lose significant digits, and a computed Q may fail to be accurately orthogonal. Modified Gram-Schmidt, reorthogonalization, and QR algorithms based on Householder reflections address numerical concerns in different ways. QR is a factorization; Gram-Schmidt is one route to it.[3]
For columns [1;1] and [1;1+epsilon], the second remainder becomes tiny as epsilon approaches zero. If epsilon is exactly zero, the columns are dependent. With measured or rounded inputs, deciding whether a tiny remainder counts as zero requires a tolerance tied to scale and uncertainty. Do not infer exact rank from a single arbitrary decimal cutoff.
Why avoid forming the normal matrix?
For independent columns, the equations ATA x-hat=ATb are mathematically correct. However, the 2-norm condition number of ATA is the square of that of A. A nearly dependent design can therefore become more sensitive when the normal matrix is explicitly formed. QR solves the least-squares problem without forming that product.[3]
This does not mean QR removes uncertainty in the data or makes an ill-conditioned problem well-conditioned. It helps avoid an additional numerical difficulty. Good practice reports the residual, considers data scale, and distinguishes algorithmic rounding from the underlying problem's sensitivity.
As a basic implementation check, compute norms of A-QR and QTQ-I relative to the scale of A. Small values support a correct factorization but do not prove that the original physical model is valid. Verify the least-squares residual separately through ATr.

Try a second factorization
For a1=[1;0;1] and a2=[0;1;0], the columns already are perpendicular. Normalize them to q1=[1;0;1]/sqrt(2), q2=[0;1;0]. Then R=diag(sqrt(2),1). For b=[2;3;0], QTb=[sqrt(2);3], so the least-squares coefficients are [1;3].
The fitted vector is [1;3;1] and the residual [1;0;-1], perpendicular to both columns. The squared residual is 2. In this case the zero off-diagonal entry of R records that the second column had no overlap with the first. Orthogonality makes the algebra shorter, but the same checks still apply.
Recap
Gram-Schmidt creates orthonormal directions by removing projections and normalizing nonzero remainders. Recording the coefficients gives A=QR. For independent columns, least squares becomes R x-hat=QTb. Rectangular Q has orthonormal columns but no two-sided inverse. Floating-point calculations need scale-aware checks.
Remember: verify A=QR, verify QTQ=I, and verify the fitted residual. Each check answers a different question.
Common misconceptions
Reduced rectangular Q need not have QQ^T=I. An exactly zero Gram-Schmidt remainder signals dependence; a very small computed remainder also requires a numerical tolerance decision. QR is a factorization, not the name of one unique algorithm.
Retrieve, check, and revisit
Before looking back: For A=[1 1;1 -1], produce Q with orthonormal columns and R with positive diagonal.
Feedback after attempting
Q=A/sqrt(2) and R=sqrt(2)I. Verify Q^T Q=I and QR=A.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Use these factors to solve Ax=[3;1] and check the answer without an inverse. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), orthogonal sets. Read the source.
- MIT OpenCourseWare, Gilbert Strang. Linear Algebra (Fall 2011), orthogonal matrices and gram schmidt, lecture and summary. Read the source.
- MIT OpenCourseWare. Introduction to Numerical Methods (Spring 2019), Week 4, Lectures 9 and 10. Read the source.
- Nicholas J. Higham. What Is a QR Factorization? (2020). Read the source.
- Key terms
- Gram-Schmidt
- Orthogonalization by subtracting projections onto previously built directions.
- Reduced QR
- A=QR with m by n Q having orthonormal columns and n by n upper triangular R for full column rank.
- Orthogonality residual
- A measure of how far Q^T Q differs from the identity.
- Full column rank
- Independent columns, allowing a unique least-squares coefficient vector.
- Conditioning
- Sensitivity of a mathematical answer to perturbations of its inputs.
- Round-off error
- Error introduced by finite-precision representation and arithmetic.
Module 9: Spectral Geometry and Approximation
Use symmetric matrices, quadratic forms, and the SVD to understand geometry, approximation, and sensitivity.
Symmetric Matrices, the Spectral Theorem, and Quadratic Forms
- Orthogonally diagonalize a real symmetric matrix and interpret its quadratic form.
- Classify definite, semidefinite, and indefinite forms using justified criteria.
- Use a completed quadratic identity to prove a unique minimum.
A quadratic expression hiding a matrix
The expression 2x2+2xy+2y2 can be written as vTAv with v=[x;y] and A=[2 1 ; 1 2]. Its mixed term makes the geometry look tilted. An orthonormal eigenbasis removes that term and reveals the principal axes. This connection is the reason quadratic forms belong in a college linear algebra course.
We work with real symmetric matrices: AT=A. Their eigenvalues are real, and there is an orthonormal basis of eigenvectors. Consequently A=Q D QT with Q orthogonal and D real diagonal. This is the real spectral theorem.[1]
Key idea: a real symmetric matrix separates into perpendicular eigendirections, and its quadratic form is a weighted sum of squared coordinates in those directions.
Why different eigenspaces are perpendicular
Suppose Au=lambda u and Av=mu v with u,v real eigenvectors. Then uTAv=mu uTv. Symmetry also gives uTAv=(Au)Tv=lambda uTv. Subtracting gives (lambda-mu)uTv=0. If lambda differs from mu, the dot product must be zero.[1]
This argument does not say that any two eigenvectors for the same eigenvalue are perpendicular. For A=I, every nonzero vector is an eigenvector, and [1;0] and [1;1] are not perpendicular. Within a repeated eigenspace, choose an orthonormal basis using Gram-Schmidt. Linear combinations within that eigenspace remain eigenvectors for the same eigenvalue.
For complex candidate eigenvectors, the conjugate-transpose identity v*Av=conjugate(v*Av) for real symmetric A shows the scalar v*Av is real. If Av=lambda v, then lambda=(v*Av)/(v*v), with positive real denominator. Thus lambda is real. Ordinary transpose alone would not justify this conclusion for a complex vector.
Why enough eigenvectors exist
A proof outline explains the existence part, which perpendicularity alone does not prove. The continuous function f(v)=vTAv attains a maximum on the unit sphere. Let q be a maximizer. For any unit w perpendicular to q, the curve v(t)=q cos(t)+w sin(t) remains on the sphere. Its derivative at t=0 gives 2wTAq=0.
Therefore Aq is perpendicular to every vector perpendicular to q, so Aq is a multiple of q: q is an eigenvector. Symmetry makes q-perp invariant, since qTAw=(Aq)Tw=0 for w in q-perp. Apply the same argument to the smaller-dimensional restriction and continue by induction. The result is an orthonormal eigenbasis.[1]
This outline uses compactness of the finite-dimensional unit sphere and elementary differentiation along a curve. Students may use the spectral theorem as a stated theorem before mastering those proof tools, while still distinguishing its existence claim from the shorter orthogonality argument.
Orthogonally diagonalize a concrete matrix
For A=[2 1 ; 1 2], eigenvalues are 3 and 1. Normalize [1;1] and [1;-1] to q1=[1;1]/sqrt(2), q2=[1;-1]/sqrt(2). Set Q=[q1 q2] and D=diag(3,1). We have QTQ=I and AQ=QD, so multiplying on the right by QT gives A=QDQT.
For v=[x;y], define z=QTv. Then z1=(x+y)/sqrt(2) and z2=(x-y)/sqrt(2). Substitution gives vTAv=3z12+z22. Expanding the right side recovers 2x2+2xy+2y2, which checks the coefficients, including the factor 2 on the mixed term.
The level curve vTAv=1 is an ellipse. Its semiaxis lengths are 1/sqrt(3) along q1 and 1 along q2. Larger positive eigenvalues give shorter axes for this level set. Do not confuse these reciprocal square roots with the stretch factors of the transformation v to Av.
![The form with matrix [2 1;1 2] has eigenvalues 3 and 1. Its level-one ellipse has semiaxes 1/sqrt(3) and 1 along perpendicular eigenvectors.](/assets/img/math-linalg-reviewed/quadratic-ellipse.png)
Positive, negative, and indefinite forms
A real symmetric A is positive definite if vTAv is positive for every nonzero real v. It is positive semidefinite if the value is nonnegative for every v. Reversing the inequalities defines negative definite and negative semidefinite. A form is indefinite if it takes both positive and negative values.[2]
In eigenvector coordinates, the form is sum lambdajzj2. It is positive definite exactly when all eigenvalues are positive, and positive semidefinite exactly when all are nonnegative. If one eigenvalue is positive and another negative, choosing their respective eigenvectors gives values of opposite signs, proving indefiniteness.
Examples separate the cases: diag(2,1) is positive definite; diag(2,0) is positive semidefinite but not definite; diag(-2,-1) is negative definite; diag(2,-1) is indefinite. The zero matrix is both positive and negative semidefinite, but neither definite. A positive determinant alone does not imply positive definiteness: diag(-2,-1) has determinant 2.

A complete test in two dimensions
For A=[a b ; b c], the form is ax2+2bxy+cy2. If a is positive, completing the square gives a(x+(b/a)y)2+((ac-b2)/a)y2. Thus positive definiteness is equivalent to a>0 and ac-b2>0.[2]
For A=[2 1 ; 1 3], a=2 and determinant 5, so it is positive definite. The completed form is 2(x+y/2)2+(5/2)y2, positive whenever (x,y) is nonzero. For [1 2 ; 2 1], determinant -3 signals opposite-sign eigenvalues, and the form is indefinite: it is 6 at [1;1] and -2 at [1;-1].
For a symmetric n by n matrix, Sylvester's criterion says positive definiteness is equivalent to positivity of every leading principal minor, the determinants of the upper-left k by k blocks for k=1,...,n. Do not extend that criterion to semidefiniteness by merely changing positive to nonnegative. For example, diag(0,-1) has nonnegative leading minors 0 and 0 but is not positive semidefinite.[1][2]
The least-squares connection
For any real matrix B, vTBTBv=||Bv||2, so BTB is symmetric positive semidefinite. It is positive definite exactly when B has independent columns. This proves why a least-squares normal matrix is invertible precisely when the coefficients are identifiable.[3]
Take B=[1 0 ; 1 1 ; 1 2]. Then BTB=[3 3 ; 3 5]. The leading principal minors are 3 and 6, both positive. Its quadratic form is the squared length of Bv, which cannot vanish for a nonzero v because the columns are independent.
Positive definiteness does not guarantee good conditioning. The matrix diag(1,0.000001) is positive definite but strongly compresses one direction. Numerical accuracy depends on the ratio of its extreme scales as well as on the signs of its eigenvalues.
Minimize a quadratic without guessing
For symmetric positive definite A, consider f(x)=(1/2)xTAx-bTx. Let x-star solve Ax-star=b. Expanding around that vector gives f(x)=f(x-star)+(1/2)(x-x-star)TA(x-x-star). The second term is positive unless x=x-star, proving a unique global minimum.[2]
For A=[2 1 ; 1 2] and b=[3;0], solving gives x-star=[2;-1]. Indeed A[2;-1]=[3;0]. The minimum value is -3, since (1/2)[2,-1][3;0]-[3,0][2;-1]=3-6=-3. Every other x has a strictly larger value by the completed-square identity.
For a general twice continuously differentiable function, a positive definite Hessian at a stationary point is a sufficient condition for a strict local minimum. The stationary-point and smoothness assumptions matter. This lesson's quadratic identity is stronger because it proves a global result for the stated positive definite quadratic.
Spectral expansion as weighted projections
Writing out QDQT gives A=sum lambdajqj qjT. Each qj qjT projects onto one unit eigenvector direction. For the 2 by 2 example, A=3q1q1T+q2q2T. Applying A means measuring each orthogonal component, weighting it, and adding the results.[1]
This expansion explains matrix powers: Ak=sum lambdajkqj qjT for positive integers k. It also explains why repeated eigenvalues do not create defective real symmetric matrices. An orthonormal basis can always be chosen inside each eigenspace.
Recap
The real spectral theorem requires real symmetry. Positive definiteness concerns every nonzero vector, not only positive coordinate vectors or positive matrix entries. The cross-term coefficient in a symmetric quadratic form is twice the off-diagonal entry. Positive determinant by itself is insufficient, and nonnegative leading minors are insufficient for semidefiniteness.
Remember: diagonalize in an orthonormal basis, inspect the eigenvalue signs, and verify the quadratic expression by expansion.
Common misconceptions
Real symmetry guarantees an orthonormal eigenbasis, but does not guarantee positive eigenvalues. Positive diagonal entries alone do not establish positive definiteness. Nonnegative leading principal minors do not by themselves establish positive semidefiniteness.
Retrieve, check, and revisit
Before looking back: Classify the quadratic forms with matrices diag(2,0), diag(2,-1), and diag(-2,-1).
Feedback after attempting
They are positive semidefinite, indefinite, and negative definite, respectively.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: For each, sketch level curves and identify directions on which the form is positive, zero, or negative. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- MIT OpenCourseWare, Gilbert Strang. Linear Algebra (Fall 2011), symmetric matrices and positive definiteness, lecture and summary. Read the source.
- MIT OpenCourseWare, Gilbert Strang. Linear Algebra (Fall 2011), positive definite matrices and minima, lecture and summary. Read the source.
- Dan Margalit and Joseph Rabinoff. Interactive Linear Algebra (2019), least squares. Read the source.
- Key terms
- Real spectral theorem
- Every real symmetric matrix has an orthonormal eigenbasis and real eigenvalues.
- Quadratic form
- The scalar expression x^T A x, represented by a symmetric matrix over the reals.
- Positive definite
- x^T A x>0 for every nonzero real x, for symmetric A.
- Positive semidefinite
- x^T A x>=0 for every real x, for symmetric A.
- Indefinite
- A quadratic form taking both positive and negative values.
- Leading principal minor
- The determinant of an upper-left k by k block.
Singular Value Decomposition, Pseudoinverses, and Sensitivity
- Construct and verify an SVD for a small real rectangular matrix.
- Interpret rank, the four subspaces, and low-rank approximation errors from singular values.
- Use the pseudoinverse for minimum-norm least squares and interpret conditioning.
A factorization that also works for rectangular matrices
Eigenvalue diagonalization concerns square matrices and can fail when there are too few independent eigenvectors. The singular value decomposition, or SVD, exists for every real m by n matrix A. In its full form, A=U Sigma VT, where U is m by m orthogonal, V is n by n orthogonal, and Sigma is m by n with nonnegative diagonal entries and zeros elsewhere.[1]
The singular values are those diagonal entries, usually ordered sigma1 at least sigma2 and so on, down to zero. There are min(m,n) of them under this full convention. The number of positive singular values is rank(A). Rectangular Sigma is called diagonal in the sense that only positions (j,j) may be nonzero.
Key idea: the SVD chooses perpendicular input and output coordinates so that A acts by nonnegative scaling between corresponding directions.
How the spectral theorem produces the SVD
The matrix ATA is real symmetric positive semidefinite, because xTATAx=||Ax||2. Choose an orthonormal eigenbasis v1,...,vn for it. Its eigenvalues are nonnegative. For a positive eigenvalue lambdaj, set sigmaj=sqrt(lambdaj) and uj=Avj/sigmaj.[1]
These uj are orthonormal: ui dot uj=(viTATAvj)/(sigmai sigmaj), which is zero for distinct orthonormal vi,vj and 1 when i=j. Complete them to an orthonormal basis of Rm. V contains the v vectors and U contains the u vectors. The equations Avj=sigmaj uj give AV=U Sigma, hence A=U Sigma VT.
For a zero singular value, do not divide by zero to obtain uj. The corresponding v lies in Null(A), and the remaining U vectors can be chosen as an orthonormal basis of Null(AT). The proof uses ATA, but robust numerical SVD algorithms need not explicitly form that product.
Compute a full rectangular example
Let A=[2 2 ; 1 -1 ; 0 0], a 3 by 2 matrix. Multiplication gives ATA=[5 3 ; 3 5]. Its unit eigenvectors are v1=[1;1]/sqrt(2) with eigenvalue 8, and v2=[1;-1]/sqrt(2) with eigenvalue 2. Therefore sigma1=2sqrt(2) and sigma2=sqrt(2).
Compute Av1=[2sqrt(2);0;0], so u1=e1. Compute Av2=[0;sqrt(2);0], so u2=e2. Choose u3=e3 to complete an orthonormal basis. Then U=I3, V=(1/sqrt(2))[1 1 ; 1 -1], and Sigma=[2sqrt(2) 0 ; 0 sqrt(2) ; 0 0].
Multiply the factors: Sigma VT gives [2 2 ; 1 -1 ; 0 0], exactly A. All shapes fit: (3 by 3)(3 by 2)(2 by 2) gives 3 by 2. The singular vectors' signs are not unique: changing the sign of both uj and vj leaves their contribution unchanged.
![For A=[2 2;1 -1;0 0], the unit circle maps into the output plane as an ellipse with semiaxes 2sqrt(2) and sqrt(2). The third output coordinate is zero.](/assets/img/math-linalg-reviewed/svd-ellipse.png)
Read the four fundamental subspaces
If rank(A)=r, the first r columns of V span Row(A), and the remaining n-r span Null(A). The first r columns of U span Col(A), and the remaining m-r span Null(AT). Keep input vectors V in Rn and output vectors U in Rm.[1]
In the example, rank is 2. Row(A)=R2 and Null(A)={0}. Col(A) is the xy-plane in R3, and the left null space is the z-axis. This matches the zero third output row and confirms the dimension counts before any geometric drawing.
The image of the unit circle in R2 is an ellipse in that output plane, with semiaxis lengths 2sqrt(2) and sqrt(2) along u1 and u2. A zero singular value would collapse one input direction. Singular values are always nonnegative, even when a square matrix has negative or complex eigenvalues.
Rank-one pieces and low-rank approximation
The compact expansion is A=sum from j=1 to r of sigmaj uj vjT. Each term has rank 1. Keeping the first k terms gives Ak, of rank at most k. The truncated SVD is a best approximation among matrices of rank at most k in both the Frobenius norm and the matrix 2-norm.[3]
The Frobenius norm squares and adds every entry. The matrix 2-norm measures the largest output length produced by a unit input. The squared Frobenius error of truncation is the sum of the discarded squared singular values. The 2-norm error is the next singular value sigma(k+1), or zero after all positive terms are retained.
For our A, retaining only the first term yields A1=[2 2 ; 0 0 ; 0 0]. The error matrix has second row [1 -1], so its squared Frobenius norm is 2. This agrees with sigma22=2. The squared norm of A is 10, so this rank-one approximation retains 8/10 of its squared Frobenius magnitude.
That 80 percent is an algebraic ratio, not a promise about visual quality or educational information preserved. A small discarded component may matter greatly to a particular application. When singular values tie across the cutoff, a best low-rank approximation need not be unique.
Why the truncation bound is plausible
Orthogonal multiplication preserves Frobenius norm, so the truncation error reduces to the discarded diagonal entries of Sigma. For the 2-norm lower bound, any matrix B of rank at most k must annihilate some unit vector in the span of v1 through v(k+1). On that vector, ||(A-B)x||=||Ax|| is at least sigma(k+1). The truncated SVD attains that lower bound.
This proves the stated 2-norm optimality. The Frobenius optimality theorem additionally accounts for all discarded directions. The construction and the error identities are enough to compare concrete approximations without claiming that a single example proves the full theorem.[3]
The pseudoinverse and minimum-norm least squares
Form Sigma-plus by transposing the rectangular shape and replacing each positive singular value by its reciprocal, leaving zeros zero. The Moore-Penrose pseudoinverse is A-plus=V Sigma-plus UT. It exists even when A is singular or rectangular. The vector x-min=A-plus b is the unique least-squares minimizer of smallest Euclidean norm.[2]
For the example, A-plus=[1/4 1/2 0 ; 1/4 -1/2 0]. With b=[4;1;3], x-min=[3/2;1/2]. Its fitted output is [4;1;0], leaving residual [0;0;3] in the left null space. Since A has independent columns, this coefficient vector is also the only least-squares minimizer.
For dependent columns, other minimizing coefficients differ by null-space vectors. The pseudoinverse chooses the one in Row(A), perpendicular to those additions, so every other minimizer has a larger squared norm unless the added vector is zero. Minimum norm is a stated selection rule, not proof that these coefficients are the true physical parameters.
A rank-deficient example
Let B=[1 1 ; 2 2] and b=[3;7]. Every output is s[1;2] with s=x1+x2. Projection gives s=(3+14)/5=17/5. The minimizing coefficient pairs are [t;17/5-t]. Their minimum-norm member has equal coordinates [17/10;17/10], because the row space is span{[1;1]}.
The fitted vector is [17/5;34/5], and the residual is [-2/5;1/5], with squared norm 1/5. Adding t[1;-1] to the minimum-norm coefficients changes no fitted output. This connects the SVD selection rule with the orthogonal decompositions studied earlier.
Small singular values and sensitivity
For a square invertible matrix, the 2-norm condition number is kappa2(A)=sigma1/sigman. It is at least 1. A large ratio means that different directions are scaled very differently, so some relative perturbations can be amplified strongly when solving Ax=b. It is a worst-case sensitivity measure, not the actual error in every calculation.[4]
For A=diag(1,0.001), the condition number is 1000. The exact data b=[1;0] give x=[1;0]. Perturb b to [1;0.001]: the relative change in b has norm 0.001, while the solution changes to [1;1], a relative change of 1. This realizes an amplification factor of 1000 for this example.
With full column rank, the positive eigenvalues of ATA are the squared singular values, so its condition number is kappa2(A)2. This explains the earlier caution about normal equations. For noisy or nearly rank-deficient data, truncating tiny singular values or regularizing can limit amplification, but changes the problem and introduces a modeling choice. Report the threshold and its justification.

Recap
The SVD exists for every real matrix, uses two orthogonal bases, and displays rank through positive singular values. Truncation gives quantified low-rank error. The pseudoinverse selects the least-squares solution of minimum norm. Small singular values reveal sensitivity and require care before inversion.
Remember: check shapes, pair each input and output singular vector through Avj=sigmaj uj, and state exactly what norm or error your conclusion uses.
Common misconceptions
SVD works for rectangular and rank-deficient matrices. Singular values are nonnegative and are not generally eigenvalues. A pseudoinverse does not make an inconsistent system exact; it selects the minimum-norm least-squares solution.
Retrieve, check, and revisit
Before looking back: For A=diag(5,2), find the best rank-one truncation, its spectral error, and its squared Frobenius error.
Feedback after attempting
Keep diag(5,0). The spectral error is 2 and squared Frobenius error is 4.
Tomorrow: Explain the governing definition or theorem aloud, then change one entry or assumption and solve again. About a week later: Replace the second singular value by 0.001. Explain what improves in approximation and what worsens in inversion. Attempt it alongside an earlier lesson problem. These are practical review intervals; adjust them when recall is weak.
Keep an error log with the incorrect step, its cause, and a corrected example. Reattempt the missed step from memory. A familiar-looking worked solution is not yet evidence that you can produce the reasoning independently.
Sources
- MIT OpenCourseWare, Gilbert Strang. Linear Algebra (Fall 2011), singular value decomposition, lecture and summary. Read the source.
- MIT OpenCourseWare, Gilbert Strang. Linear Algebra (Fall 2011), left and right inverses pseudoinverse, lecture and summary. Read the source.
- Daniel Hsu. Singular Value Decomposition, COMS 3251 (Fall 2022), Section 2.5 and Theorem 3. Read the source.
- University of Illinois. CS 357: Singular Value Decompositions (2022 course-note version). Read the source.
- Key terms
- Singular value
- A nonnegative square root of an eigenvalue of A^T A, with the appropriate rectangular convention.
- SVD
- A=U Sigma V^T with orthogonal U,V and rectangular nonnegative diagonal Sigma.
- Truncated SVD
- The sum of the leading k rank-one singular-vector terms.
- Frobenius norm
- The square root of the sum of squares of all matrix entries.
- Pseudoinverse
- V Sigma-plus U^T, reciprocating positive singular values and leaving zeros zero.
- 2-norm condition number
- For square invertible A, the ratio of largest to smallest singular value.