Solving Systems of Linear Equations
Every neural network, every linear regression, every constrained optimization problem rests on one core skill. That skill is finding values that satisfy multiple linear equations at once. You will learn to write these systems compactly using matrices. You will transform them step by step into a form where the solution stares you in the face. You will also learn to recognize when a system has exactly one answer, no answer, or infinitely many.
By the end of this lecture, the augmented matrix and row operations will be second nature. More importantly, you will see why the linear equation is the DNA of modern machine learning.
2.1 What Is a Linear Equation
2.1.1 Definition and Core Idea
The analogy breaks in one way: a real balance scale can tip when overloaded. A linear equation never tips — it is an exact mathematical statement. Either the numbers satisfy it or they do not. No wiggle room.
A linear equation is an equation where every variable has degree one. No variable is raised to a power higher than 1. For example, is linear because appears as and appears as . There are no squared terms, no products of variables, no trigonometric functions, no logarithms. Just variables multiplied by constants and added together.
The name comes from the graph. Rewrite as . Plot it — in a tool like Desmos, or by hand — and you get a straight line. The equation depicts a line.
But "linear" does not mean "a line in all dimensions." In three variables, a linear equation like represents a plane — a flat sheet cutting through space. In variables, it represents a hyperplane — still a flat surface, never curved. The defining property never changes. Variables never multiply each other. They never appear with exponents other than 1.
2.1.2 Formal Form
A general linear equation in variables is written as:
| Symbol | Type | Meaning |
|---|---|---|
| scalar | Variable (unknown), degree 1 | |
| scalar | Coefficient (constant multiplier attached to ) | |
| scalar | Constant term (right-hand side) | |
| integer | Number of variables in the equation |
Every coefficient tells you how much weight variable carries. If , then effectively does not appear in this equation — it carries zero weight. The right-hand side is the target value the weighted sum must hit.
Classify each equation as linear or nonlinear:
| Equation | Verdict | Reason |
|---|---|---|
| Linear | Variables only multiplied by constants, added. | |
| Nonlinear | appears with exponent 2. | |
| Nonlinear | and are multiplied together. | |
| Nonlinear | is a nonlinear function of . | |
| Linear | is fine — coefficient zero means the variable is absent. | |
| Linear | Constants can be irrational; only the variables must be degree-1. |
Sense-check: The last equation looks exotic with , , and , but it is just a flat proportional relationship between and . The coefficients being irrational does not break linearity.
- Degree-1 variables: Every variable appears only as . No , , or .
- No products of variables: Terms like or are forbidden.
- Coefficients are constants: Each is a fixed number, not a function of any variable.
If any condition fails, the equation is nonlinear. Nonlinear equations are harder to solve, often have multiple isolated solutions, and require entirely different methods (Newton's method, not Gaussian elimination).
Visual Intuition. Open Desmos and type 2x + y = 5. You will see a straight line crossing the y-axis at and the x-axis at . The line slopes downward. The coefficient of is positive and the coefficient of is positive, so rearranging to gives a negative slope of . Every point on that line is a solution to the equation. Points above the line give ; points below give . The line is the boundary where equality holds.
In 3D, the equation becomes a plane. If you slice it with the XY-plane (setting ), you get back the 2D line . The plane tilts in 3D space, but it never bends.
- "Linear" means more than "a line." A sine wave is a curved line, but is nonlinear. The shape of the graph is not the test — the algebraic form is.
- Zero coefficients are OK. is still linear. The term is just absent — it does not make the equation quadratic or degenerate.
- Constants can be anything. is linear. The coefficients are constants — their specific numeric form does not matter. Only the variables must be degree-1.
- Rearranging does not break linearity. and are the same linear equation. Moving terms across the equals sign preserves linearity.
Bridge. One linear equation gives you a line. But one line has infinitely many points. To pin down a single point, you need a second equation that crosses the first — a system of linear equations. That is where we go next.
Real-World & Domain Connection. Linear equations are the workhorse of linear programming, the field that optimizes everything from airline crew schedules to portfolio allocations. When FedEx routes 50,000 packages through Memphis overnight, the constraint "total package weight ≤ plane capacity" is a linear inequality. It is built from linear equations. When an engineer checks whether a bridge can hold a given load, the force-balance equations are linear. The simplicity of linear equations — add, multiply by constants, never bend — is exactly what makes them computable at enormous scale. Every optimization solver (Gurobi, CPLEX, open-source alternatives) is, at its core, a machine for solving millions of linear equations.
2.2 Systems of Linear Equations and the Common Solution
2.2.1 Definition
The analogy breaks when paths are parallel (no meeting point) or coincident (infinite meeting points). Those are real outcomes — we will handle them in Section 2.9.
A system of linear equations is a collection of two or more linear equations that share the same variables. The goal is to find values for those variables that satisfy every equation simultaneously — a common solution.
A system of linear equations in unknowns:
- is the coefficient of variable in equation (row , column ).
- is the constant on the right-hand side of equation .
- A solution is an -tuple that makes every equation true.
2.2.2 The General Problem
Whether you have two equations or millions, the core question is the same. Does a common point exist that satisfies all of them? If it does, that point is the solution. The methods for finding it — elimination, substitution, matrix row operations — all work toward the same goal.
The only thing we are looking for is a common point — a common solution for all equations. This holds for two equations or a trillion.
Consider:
Rewrite both in slope-intercept form:
To find the intersection, set them equal:
Plug into Line 1:
Solution: .
Sense-check: Plug into Line 2: ✓. Both equations are satisfied. The two lines cross at exactly one point — a unique solution.
Visual Intuition. Plot both lines in Desmos. Line 1 () slopes downward steeply, crossing the y-axis at . Line 2 () slopes downward gently, crossing at . They intersect in the second quadrant at — left of the origin, high up. That point is the only one that belongs to both lines.
- Exactly one solution (lines intersect at a single point)
- No solution (lines are parallel, never meet)
- Infinitely many solutions (lines are coincident — the same line)
We explore all three outcomes in detail in Section 2.9. For now, the focus is on the unique-solution case: equations, unknowns, , one answer.
- Thinking fewer equations means an easier problem. Fewer equations than unknowns usually means you cannot pin down a unique answer. You need at least as many independent equations as variables.
- Assuming every system has a solution. Not all systems do. The equations might contradict each other. We will see how to detect this in Section 2.9.
- Forgetting to check the answer. Always plug your solution back into every original equation. A single equation satisfied is not enough — all must hold.
A: Yes — if you have fewer equations than unknowns, you generally cannot find a unique solution. The number of equations must match the number of variables for the system to be solvable uniquely. If you have more unknowns than equations, the system becomes underdetermined. You may have infinitely many solutions or none at all, depending on consistency.
Several students asked this — it is a foundational point. The intuition: each equation is one constraint. With variables, you need independent constraints to fix all values.
Bridge. We now know what systems look like and what we are solving for. So why does any of this matter for machine learning? The answer is the single equation . It is repeated trillions of times inside every neural network.
Real-World & Domain Connection. Systems of linear equations appear wherever multiple constraints must be satisfied simultaneously. In circuit analysis (Kirchhoff's laws), the currents through each branch of a circuit form a linear system. In chemical stoichiometry, balancing a reaction like means solving for the integer coefficients — a system of linear equations in disguise. In GPS navigation, your receiver solves a system of four equations (one per satellite). It pins down your 3D position plus clock bias. Every one of these applications asks the same question: what values satisfy all these linear relationships at once?
2.3 Linear Equations as the Foundation of Machine Learning
2.3.1 The Governing Equation of Neural Networks
The analogy breaks because real soundboards mix signals in parallel; neural networks stack many mixing boards in sequence. But the core idea holds: each layer is a linear transformation — a weighted sum — followed by a simple nonlinearity.
Neural networks, including LLMs, are built on one governing equation:
| Symbol | Type | Shape | Meaning |
|---|---|---|---|
| vector | Weight parameters — what the model learns | ||
| vector | Input features — the data fed to this layer | ||
| scalar/vector | or | Bias term — the intercept, shifts the output | |
| scalar | Dot product: |
Expanded, the dot product is exactly the form of a linear equation from Section 2.1:
Add the bias and set to zero. You now have the decision boundary. It is the hyperplane that separates one class from another in a classifier. It is also the activation threshold that decides whether a neuron fires.
Structurally, this is identical to — just with vectors instead of scalars. The math scales, but the form does not change.
2.3.2 The Scale: GPT-4 and 1.7 Trillion Parameters
To make this concrete: GPT-4 has approximately 1.7 trillion parameters. Each parameter is a single weight — a single entry in some weight vector inside the model. Each weight participates in exactly one linear equation of the form (per input).
When you train the model, you are solving — iteratively, not directly — for the values of all 1.7 trillion weights. The training data provides millions of pairs (input, desired output). The optimization algorithm nudges each weight to reduce the mismatch between predicted and desired output. After billions of such nudges, the weights converge to values that make the model work.
2.3.3 Why Solving Matters
Consider a single neuron with two inputs:
Suppose we have one training example. Let , , and we want the output to be 10. The unknowns are and .
We have one equation: . Three unknowns, one equation — infinitely many solutions. This is why neural networks need many training examples: each example adds one equation. With enough examples (and some regularization), the system becomes determined and the weights are pinned down.
Now scale this up: GPT-4 has 1.7 trillion unknowns and is trained on trillions of tokens. It is the same idea — just at enormous scale.
- It IS a linear equation. has no variable raised above degree 1, no products of variables, no nonlinear functions applied to the variables themselves.
- It is NOT the whole neural network. A neural network stacks many such linear transformations, each followed by a nonlinear activation function like ReLU () or sigmoid. Without the nonlinearities, stacking linear layers would collapse into a single linear layer — nothing would be gained. The nonlinearities are what give neural networks their expressive power. But the atomic operation inside every layer is still linear.
- Training is NOT Gaussian elimination. You cannot solve 1.7 trillion equations with row operations — the computational cost would be astronomical (). Instead, neural networks use gradient descent: an iterative algorithm that takes small steps downhill on an error surface. The matrix intuition from REF/RREF still transfers — you are manipulating matrices to understand data transformations.
Visual Intuition. Picture a single neuron as a dividing line in 2D. The equation is a line. Points on one side of the line give (neuron fires); points on the other side give (neuron stays silent). Training adjusts the slope () and position () of this line until it best separates the data. In 3D, the neuron becomes a dividing plane. In higher dimensions, a dividing hyperplane. Same equation, same geometry — just more dimensions.
- "1.7 trillion parameters" sounds like 1.7 trillion separate equations to solve simultaneously. It is not — each weight participates in one linear combination per input. The weights themselves are the unknowns, not the equations. The equations come from the training data.
- Thinking neural networks solve linear systems with Gaussian elimination. They do not. They use iterative optimization (gradient descent). The REF/RREF material in this lecture builds matrix intuition; it is not the algorithm used to train models.
- Confusing a single linear layer with the whole network. One layer is linear. A deep network is a composition of linear and nonlinear functions. The linear part is what we study here; the nonlinear part comes later in the course.
A: Yes, exactly. Each parameter is a weight in a linear equation. The weight vector is enormous — on the order of "trillion × 1" — but conceptually it is still a vector. Each entry is one weight in one linear equation of the form .
Q: What is the actual size of these weight matrices?
A: They are very large — on the order of trillion-by-one for individual weight vectors. In practice, weights are organized into matrices (e.g., ), not a single flat vector. But each row of that matrix is a weight vector participating in its own linear equation. The total parameter count — 1.7 trillion — is the sum of all entries. It spans all weight matrices and bias vectors in the model.
Several students asked variations of these questions — the scale is hard to internalize. The key insight: no matter how big the vector gets, the math is the same. It matches the 2-variable equations you solved in high school.
Bridge. Understanding how linear systems are systematically solved is the gateway to machine learning. First we solve by hand with elimination. Then we solve with matrices. Let us start with the simplest method: elimination.
Real-World & Domain Connection. Every large language model — GPT-4 (OpenAI), Claude (Anthropic), Llama (Meta), Gemini (Google) — uses this same governing equation at its core. The "intelligence" emerges from stacking many such linear transformations with nonlinear activation functions between them. Strip away the activations, and what remains is a cascade of linear equations.
The same structure powers three other fields. Convolutional neural networks use it for image recognition: each filter is a linear combination of pixel values. Recommendation systems use it as user embeddings × item embeddings + bias = predicted rating. Time-series forecasting uses it as linear regression on lagged values. Linear algebra is the common language they all speak.
2.4 Elimination and Substitution Methods
2.4.1 The High-School Methods
The analogy breaks because real seesaws pivot around a center point; linear equations do not pivot — they are rigid constraints. But the idea of "canceling out" one variable by matching coefficients is the core insight.
Given two equations:
The goal is to find and . The standard method is elimination: eliminate one variable, solve for the other, then substitute back.
2.4.2 Worked Example: Elimination
Step 1 — Eliminate : Multiply the first equation by 2 so the -coefficient matches the second equation's -coefficient.
Subtract the second equation from this new equation:
Step 2 — Back-substitute: Plug into the simpler equation ():
Solution: .
Sense-check: Plug into the second equation: ✓. Both equations are satisfied. Graphically, the lines and intersect exactly at .
Someone said multiply the first equation by two and subtract the second from it to eliminate X. That is why it is called elimination — we eliminate one variable.
2.4.3 Why These Methods Do Not Scale
Elimination and substitution work beautifully for two equations with two variables. But what if you have 1000 equations in 1000 unknowns? Writing out "multiply equation 47 by 3.2, subtract from equation 89" becomes unmanageable. You need a more compact notation — and that is where matrices come in.
The importance of matrices here is you have to realize these are only two equations. What would happen when you have more equations and hundreds of variables? It becomes a lot difficult to actually do the back substitution or elimination method. So what we do is we use a slightly easier notation, which is called the matrix notation.
Elimination works when:
- The system is consistent (a solution exists).
- Coefficients are not all zero in the column you are eliminating.
- You are working over a field (real numbers, complex numbers — division always works for nonzero scalars).
Elimination breaks when:
- A pivot (the coefficient you are using to eliminate) is zero. You then need to swap rows, which is fine if a nonzero pivot exists in a lower row.
- The system is singular — no row swap can produce a nonzero pivot. This means the equations are either redundant or contradictory. We will diagnose these cases in Section 2.9.
Visual Intuition. Picture the two lines from the example. Line 1: (slope , crosses axes at and ). Line 2: (slope , crosses at and ). They intersect at . The elimination step — multiplying and subtracting — is the algebraic equivalent of finding where the lines cross. You do not need to draw them; the algebra finds the intersection for you.
- Forgetting to apply the multiplier to the right-hand side. When you multiply an equation by 2, you must multiply the constant on the right as well. becomes , not .
- Subtracting in the wrong order. gives . Reversing the subtraction gives . Pick one order and stay consistent.
- Stopping after finding one variable. Elimination gives you one variable. You must back-substitute to get the rest.
A: If the nonlinear term (e.g., ) appears in multiple equations, you can substitute to linearize the system temporarily. Solve for using linear methods. Then back-substitute . But this only works if the same nonlinear term replicates across equations. An isolated in one equation cannot be handled by linear elimination. You would need nonlinear solution methods (Newton's method, etc.).
Bridge. The bottleneck is notation — writing variable names over and over. The fix is to strip the variables away entirely and keep only the coefficients and constants. That is the augmented matrix.
Real-World & Domain Connection. Elimination is the algorithm behind every row-reduction operation in linear algebra software. When you call np.linalg.solve(A, b) in NumPy, the library is doing elimination under the hood. It uses many optimizations (partial pivoting, LU decomposition) for numerical stability. The same principle powers circuit simulators (SPICE) and structural analysis software (finite element method solvers). It also powers any system that needs to solve for moderate-sized . The 1000-equation case that breaks hand calculation is routine for a computer. But the algorithm is the same one you just did by hand.
2.5 The Augmented Matrix Representation
2.5.1 Definition and Construction
The analogy is more than an analogy: MATLAB and NumPy literally store matrices as arrays in memory. When you call a solver, it reads rows and columns from a 2D array — exactly like a spreadsheet.
An augmented matrix is a compact way to write a system of linear equations. You strip away the variable names and the equality signs. You keep only the coefficients and the right-hand-side constants, separated by a vertical bar.
Given a system of 3 equations in 3 unknowns:
The augmented matrix is:
Construction rule: Row gets the coefficients from equation . Column (before the bar) gets the coefficients of . The last column gets the right-hand-side constants. The vertical bar is a visual reminder of where the equals sign was.
At the top we write the variables which are . The first equation: the coefficient of is 2, is 1, is 1. On the right-hand side you have 5.
2.5.2 Why This Representation Helps
The key benefit: you are freed from rewriting the variable names. Each row is one equation. Each column (before the bar) corresponds to one variable. The rightmost column holds the constants. All the work of solving now happens by manipulating rows. You never touch the variable names again until you read off the final answer.
System:
Augmented matrix:
Notice: a zero coefficient ( in equation 1, in equation 3) becomes a 0 in the matrix. These zeros are important — they show that the variable is absent from that equation. The matrix must have an entry in every position; missing variables are zeros, not blanks.
2.5.3 The General Form
For equations in unknowns:
- is the coefficient matrix (left of the bar).
- is the constant vector (right of the bar).
- Together, is the augmented matrix.
- Forgetting to align columns by variable. If equation 2 is written as , you must reorder it to before extracting coefficients. The columns must be consistent across all rows.
- Leaving blanks instead of zeros. A missing variable is a zero coefficient, not an empty cell. Write 0 in the matrix — it matters for row operations.
- Omitting the vertical bar. The bar is not mathematically necessary, but it is a crucial visual cue: left side = coefficients, right side = constants. Many students accidentally apply row operations to the constants column incorrectly because they lose track of the boundary.
Bridge. We now have the system in a clean matrix form. The question is: what operations can we perform on these rows to solve it? The answer: exactly three — row swap, row scaling, and row replacement.
Real-World & Domain Connection. Every numerical linear algebra library — MATLAB, NumPy, LAPACK, Eigen — stores linear systems as matrices internally. When you call np.linalg.solve(A, b), NumPy builds the augmented matrix . It then applies row operations, with optimizations like partial pivoting and LU decomposition. The augmented matrix is not just a pedagogical tool — it is the actual data structure used in production solvers. High-performance computing (HPC) codes for weather simulation, computational fluid dynamics, and structural analysis all pass around augmented matrices. They use augmented matrices as their fundamental unit of work.
2.6 Elementary Row Operations
2.6.1 The Three Allowed Operations
Think of the augmented matrix as a deck of cards, with each card being one row (one equation). You have three legal moves.
- Swap any two cards. Reordering equations does not change the solution.
- Scale all numbers on one card by a nonzero constant. Scaling an equation does not change what values satisfy it.
- Replace one card with itself minus a multiple of another. This is the elimination move. It combines equations to cancel terms.
Any sequence of these three moves preserves the solution set. Any other move (squaring a row, deleting a row, adding a constant) breaks it.
The analogy breaks because real cards have a fixed order. Here the "deck" is a mathematical object and row swaps are fully reversible. But the constraint is the same: only these three operations are fair game.
Once the system is in augmented matrix form, you can manipulate the rows using exactly three elementary row operations.
| Operation | Notation | What It Does | Why It Preserves Solutions |
|---|---|---|---|
| Row swap | Exchange two rows | Reordering equations does not change their meaning | |
| Row scaling | Multiply every entry in a row by | Multiplying both sides of an equation by the same nonzero number preserves equality | |
| Row replacement | Subtract times row from row | This is the elimination move — subtracting equal quantities from both sides |
Row 2 equals 2 times row 1 minus row 2. That is row replacement — the workhorse operation that zeros out entries to create the staircase pattern.
2.6.2 What These Operations Achieve
The goal is to transform the augmented matrix into a form where the solution becomes obvious. You systematically create zeros below (and eventually above) the pivot entries — the first nonzero entry in each row.
These are the basic operations. Every step of Gaussian elimination and Gauss-Jordan elimination is just a sequence of these three moves.
Start with:
Operation 1 (Row replacement):
New row 2:
Operation 2 (Row scaling):
Operation 3 (Row replacement):
New row 1:
Solution: , . Sense-check: ✓; ✓.
- Preserved: The solution set. If satisfied the original system, it satisfies the transformed system, and vice versa.
- NOT preserved: The individual equations. After , row 2 is a new equation — a linear combination of the original equations. It is not the original equation 2. But it carries equivalent information.
- NOT preserved: The determinant (if the matrix is square). Row swaps flip the sign; row scaling multiplies the determinant. These properties matter later but do not affect the solution.
- Scaling by zero. replaces an entire equation with , destroying the information it carried. Scaling by zero is forbidden — must be nonzero.
- Mixing up row replacement direction. means: modify row . Do NOT modify row . Only row changes. Row stays as it was.
- Applying an operation to only part of a row. Every entry in the row — including the constant on the right of the bar — must be updated. Forgetting the constant column is the single most common error in Gaussian elimination.
- Thinking "legal" means "the same equation." Row replacement produces a new equation that is a linear combination of old ones. It looks different but is equivalent in terms of what solutions it allows.
Bridge. Armed with these three operations, we can now systematically transform any augmented matrix into Row Echelon Form. That is the triangular shape where back-substitution solves the system. That algorithm is Gaussian elimination.
Real-World & Domain Connection. Row operations are the primitive instructions executed by every linear algebra processor. GPU-accelerated libraries like cuBLAS (NVIDIA) perform row operations on thousands of rows in parallel. The same three operations, just vectorized across hardware threads. When a self-driving car updates its Kalman filter, it runs row operations on a small matrix dozens of times per second. A Kalman filter is a linear system for sensor fusion. The algorithm is identical to what you do by hand. Only the scale and speed differ.
2.7 Row Echelon Form and Gaussian Elimination
2.7.1 Definition of Row Echelon Form (REF)
The analogy breaks because real cleaning does not guarantee the piles form a perfect staircase. But in REF, the staircase is rigid and defined by the pivot positions.
A matrix is in Row Echelon Form when it satisfies two conditions:
- All zero rows are at the bottom. A row of only zeros must sit below any row that has a nonzero entry.
- Each pivot is strictly to the right of the pivot above it, and all entries below every pivot are zero. The first nonzero entry in any row — the pivot — sits farther right than the pivot in the row above. Below each pivot, the column contains only zeros.
Visually, the pivots form a staircase stepping down and to the right:
- = pivot (nonzero)
- = any number (can be zero or nonzero)
- Everything below each pivot = 0
- Zero rows (if any) at the very bottom
This is a nice-looking staircase pattern. The first element in the column is called a pivot element. We want these bold boxes as nonzero, and everything below them as zero.
2.7.2 Gaussian Elimination — The Process
Purpose: Transform any augmented matrix into Row Echelon Form, from which the solution can be found by back-substitution.
Inputs: An augmented matrix .
Outputs: The same matrix transformed to REF, with the same solution set.
Steps:
- Start at column 1, row 1. Set current row , current column .
- Find a pivot. Look down column from row to row . The first nonzero entry is your pivot. If the pivot is not in row , swap it up to row ().
- Eliminate below. For every row , perform . This zeros out the entry at position .
- Advance. Move to the next row () and next column ().
- Repeat from step 2 until or .
After reaching REF, solve by back-substitution: the last equation has only one variable (or reveals inconsistency), so you solve it directly. Substitute that value into the second-to-last equation, which now has only one unknown, and work upward.
2.7.3 Worked Example: Gaussian Elimination
Given the system:
Step 1 — Write the augmented matrix:
Step 2 — Eliminate below the first pivot (column 1, row 1):
Pivot = . Zero out rows 2 and 3.
Step 3 — Eliminate below the second pivot (column 2, row 2):
Pivot = . Zero out row 3.
REF achieved:
Step 4 — Back-substitution:
Solution: .
Sense-check:
- Eq 1: ✓
- Eq 2: ✓
- Eq 3: ✓
- Use Gaussian elimination for solving directly when and is dense.
- Use iterative methods (Jacobi, Gauss-Seidel, conjugate gradient) when is very large and is sparse.
- Use LU decomposition when you need to solve for multiple different with the same .
- Never use Gaussian elimination to train neural networks — gradient descent is the right tool for that scale.
Why the upper-triangular shape matters: When everything below the diagonal is zero, the last row contains only one variable. You solve it instantly. Then each row above adds exactly one new variable, which you solve by plugging in values you already know. It is like untying a knot — you loosen the last strand first, then work backward.
Visual Intuition. Picture the matrix as a set of steps. Row 1 has information about all three variables. Row 2 has information about and only (the entry is zero). Row 3 has information about only. This is the staircase. You step onto row 3 first (solving ). Then use that to step up to row 2 (solving ). Then step up to row 1 (solving ). Each step upward uses exactly one new piece of information.
- Stopping before the staircase is complete. You must zero out ALL entries below each pivot. A single nonzero below a pivot means the matrix is not in REF and back-substitution will give wrong answers.
- Misidentifying the pivot. The pivot is the first nonzero entry in the current row from the left. If the entry at is zero, you must either swap rows or move to the next column.
- The pivot must stay in its assigned row. The pivot for column 2 cannot be in row 1 — that column's pivot position is already taken by row 1. The staircase forces each pivot to shift rightward.
- Dividing by zero in the multiplier. The multiplier for elimination is . If , you cannot divide — swap rows first to bring a nonzero pivot into position.
Bridge. REF requires back-substitution. But what if we go further — clean ABOVE each pivot too, and scale every pivot to 1? Then the solution is readable directly, no substitution needed. That is Gauss-Jordan elimination, producing Reduced Row Echelon Form.
Real-World & Domain Connection. Gaussian elimination is the foundation of every direct linear solver. LAPACK's dgesv routine performs it with partial pivoting. It swaps rows to use the largest available pivot for numerical stability. The same routine powers MATLAB's backslash operator A\b and NumPy's np.linalg.solve.
The same algorithm computes matrix inverses, determinants, and ranks. In PageRank (Google's original search algorithm), the core step is solving a linear system. Its size equals the number of web pages — millions of equations. Specialized Gaussian elimination variants exploit sparsity to make this feasible.
2.8 Reduced Row Echelon Form and Gauss-Jordan Elimination
2.8.1 Definition of Reduced Row Echelon Form (RREF)
The analogy breaks because real labeling is tedious; RREF is more work than REF. But the clarity at the end is absolute — the rightmost column IS the answer vector.
RREF is REF with two additional requirements:
- Every pivot equals 1. Scale each pivot row so the leading entry becomes 1.
- All entries above every pivot are zero (not just below). The pivot is the only nonzero entry in its entire column.
In RREF, the solution is directly readable — no back-substitution needed:
An equation like , , — it is immediately readable. That is the target of RREF.
2.8.2 Gauss-Jordan Elimination — The Process
Purpose: Extend Gaussian elimination to produce Reduced Row Echelon Form, where the solution is directly readable without back-substitution.
Inputs: An augmented matrix already in REF. Or the original matrix — Gauss-Jordan can be applied from scratch. It zeros both below and above each pivot in one pass.
Outputs: The same matrix in RREF. Every pivot = 1. Every pivot column is a unit vector — all zeros except the 1 at the pivot.
Steps (starting from REF):
- Normalize pivots to 1. For each pivot row , scale: .
- Zero out above pivots, right to left. Start from the rightmost pivot. For each row above the pivot row : . This zeros out the entry above the pivot.
- Move left to the next pivot and repeat step 2.
2.8.3 Continuing the Worked Example to RREF
Starting from the REF matrix from Section 2.7:
Normalize pivots to 1:
Zero out above the third pivot (column 3):
:
Zero out above the second pivot (column 2):
:
Solution read directly: , , .
Sense-check: Same solution as the REF back-substitution — both methods give the same answer. RREF just made it instant.
You will have to think through what we can do. Then apply the operations that make everything above the pivot element zero. Also make everything below the pivot element zero.
- Use Gauss-Jordan (RREF) for: computing matrix inverses (), finding the rank, and solving small systems by hand. Also for theoretical work where you need the cleanest form.
- Use Gaussian elimination (REF) for: large systems where back-substitution is cheaper than zeroing above pivots. And when you only need the solution, not the fully reduced form.
- Naming: Gaussian elimination → REF is sometimes called the Gauss method. Gauss-Jordan elimination → RREF is the Gauss-Jordan method.
Visual Intuition. Picture the matrix transforming through three stages. Stage 1 (REF): a staircase of pivots with numbers above them — useful but not final. Stage 2 (normalized pivots): the staircase steps are all exactly 1. Stage 3 (RREF): the staircase collapses into a perfect diagonal of 1s, with zeros everywhere else in those columns. The rightmost column has become the answer — in row 1, in row 2, in row 3. The matrix has become an identity matrix with the solution appended.
- Zeroing above pivots in the wrong order. Always go right-to-left. If you zero above the leftmost pivot first, later operations on right columns may reintroduce nonzero entries above left pivots. Right-to-left guarantees that each cleanup is permanent.
- Forgetting to normalize pivots to 1. A pivot of with zeros above and below is not RREF — the pivot must be exactly 1.
- Thinking RREF is always worth the extra work. For a system, Gauss-Jordan costs ~50% more than Gaussian elimination. Use REF + back-substitution for large systems; use RREF for small systems and theoretical work.
Bridge. Now that we can solve systems fully, the natural question is: does every system have a solution? And if it does, is it unique? The answer depends on what shape the REF/RREF matrix takes. That is the topic of the next section — the three possible outcomes.
Real-World & Domain Connection. RREF is the algorithm behind matrix inversion. To find , you augment with the identity matrix: . Apply Gauss-Jordan until the left side becomes ; the right side becomes . This is how NumPy's np.linalg.inv works for small matrices. RREF also computes the rank of a matrix (number of pivot columns) and the null space (solutions to ). In computer graphics, RREF solves for the coefficients of spline curves that interpolate given control points. In cryptography, certain lattice-based cryptosystems use RREF to find short vectors in high-dimensional lattices.
2.9 The Three Possible Outcomes
2.9.1 Overview
- Unique solution: Their paths cross at exactly one café. They meet there.
- No solution: Their paths are parallel streets that never cross. They wander forever.
- Infinitely many solutions: They are all walking on the same street. Every café on that street works — they cannot decide which one.
The analogy maps directly to the algebraic signatures in REF/RREF. A row of zeros with a nonzero constant is a contradiction ("street does not exist"). A column without a pivot is a free variable ("any café on this street works").
Every system of linear equations falls into exactly one of three categories. The outcome becomes visible once the matrix is in REF or RREF.
| Outcome | Visual (2D) | REF/RREF Signature |
|---|---|---|
| Unique solution | Two lines intersect at one point | Every variable column has a pivot; no free variables |
| No solution | Lines are parallel, never meet | A row like with |
| Infinitely many solutions | Lines coincide (same line) | At least one free variable (column with no pivot); a full zero row at bottom |
2.9.2 Unique Solution
This is the ideal case. In REF or RREF, every column corresponding to a variable contains a pivot. There are no free variables. You can read off exactly one value for each unknown.
Example (2D): and intersect at exactly .
Example (3D, from Section 2.7): The system gave . Three pivots, three variables, one answer.
2.9.3 No Solution (Inconsistent System)
This occurs when the equations contradict each other. In REF, you see a row where all coefficients are zero but the right-hand side is nonzero.
Signature of inconsistency:
This row says , i.e., . Since , this is impossible. No values of the variables can satisfy it.
The last row says . That cannot happen. Zero cannot be equal to one. When all values before the augmentation are zero and the right-hand side is a real number, that means 0 equals something nonzero. That is a no-solution condition.
Example (2D): and .
Augmented matrix:
:
Row 2 says — impossible. No solution. The two lines are parallel with different intercepts.
2.9.4 Infinitely Many Solutions
This occurs when at least one variable column has no pivot — that variable is free. There is also a full row of zeros at the bottom (, always true).
When a variable has no pivot, you assign it a parameter (any real number). You then express all other variables in terms of . The solution becomes a parametric family.
Procedure:
- Identify the free variable(s) — columns without pivots.
- Set each free variable equal to a parameter ().
- Solve for the pivot variables in terms of the parameters using back-substitution.
After REF:
- Row 3 is — always true, no constraint.
- (column 3) has no pivot → free variable. Set , where .
- Row 2: .
- Row 1: .
Solution (parametric form):
Sense-check: Pick : . Row 1: ✓. Row 2: ✓.
Whatever variable does not have a pivot element, take that element as . Then solve for all the other variables in terms of .
Visual Intuition. In 2D, the infinite-solution case means the two equations represent the same line. and — the second is exactly twice the first. Plot them in Desmos: only one line appears because the second equation adds no new information. Every point on that single line satisfies both equations — infinitely many solutions.
In 3D, infinite solutions happen when three planes intersect along a common line (one free variable). They also happen when all three planes are the same plane (two free variables). The number of free variables equals the dimension of the solution space.
- Confusing parallel with coincident. Parallel and distinct lines → no solution. Coincident lines (the same line) → infinitely many solutions. Always check whether the right-hand sides are proportional in the same ratio as the coefficients.
- Stopping at "infinitely many" without giving the parametric form. The answer is not just "infinitely many solutions." You must express the solution in terms of the free parameter(s).
- Misidentifying which variable is free. The free variable is the one whose column has no pivot — not necessarily the last variable. If columns 2 and 4 have no pivots, both and are free.
- The professor flagged this as the most important concept. The ability to read the three outcomes from REF/RREF is the skill that the exam will test.
A: No. Parallel lines that are distinct give no solution — they never meet. But if the lines are coincident, the story changes. Coincident means exactly the same line, with one equation being a multiple of the other. Then every point on that line satisfies both equations. That gives infinitely many solutions. Do not confuse "parallel" with "coincident." Parallel and distinct = no solution. Coincident = infinite solutions.
Several students asked this — the distinction between parallel and coincident is a classic trap.
Recap. Every linear system has exactly one of three outcomes. A unique solution means every column has a pivot. No solution means a row . Infinitely many solutions means at least one free variable. The REF/RREF matrix reveals which one instantly.
Bridge. Solving explicit systems of linear equations with REF/RREF is one use case. But the linear equation also serves a different role in machine learning: as a model whose parameters you fit to data. That is linear regression — and it uses the same matrix machinery in a different way.
Real-World & Domain Connection. The three-outcome classification is the basis of feasibility analysis in operations research. Before optimizing anything, a solver first checks two things. Is the constraint system feasible (does a solution exist)? Is it bounded (unique or infinite)? If the constraints are inconsistent (no solution), the solver reports infeasibility and stops. No amount of optimization can fix contradictory requirements.
In network flow problems (traffic, logistics, data routing), infinite solutions mean slack in the system. You can reroute flow without violating constraints. In robotics, a robot arm's inverse kinematics may have zero, one, or infinitely many joint-angle solutions to reach a target position. The solver must handle all three cases.
2.10 Linear Regression and Model Fitting
2.10.1 The Setup: Data as Vectors and Matrices
The analogy breaks because the rubber band's path is determined by physical forces. The regression line's position is determined by minimizing squared error. But the visual — a line finding the "center of gravity" of scattered data — is the same.
In machine learning, you do not start with a system of equations to solve. You start with data — rows of observations, each with features (inputs) and a target (output).
| Salary (target ) | Age () | Experience () |
|---|---|---|
| 35 lakhs | 40 | 15 |
| 75 lakhs | 35 | 17 |
| 5 lakhs | 22 | 4 |
| ... | ... | ... |
Majority of the times, you have historical data. And using that historical data, you are trying to create a model.
2.10.2 The Model as a Linear Equation
You want to find an equation that relates the inputs to the output:
| Symbol | Type | Meaning |
|---|---|---|
| scalar | Target / output variable (what you predict, e.g., salary) | |
| scalar | Input / predictor variable (known from data, e.g., age) | |
| scalar | Weight parameter (unknown, to be learned from data) | |
| scalar | Bias / intercept (unknown, to be learned) |
In the general case with features:
This is a linear equation — every variable has degree 1, no products, no nonlinear functions. The parameters and are the unknowns. The data provides the and values.
2.10.3 What the Bias Term Does
The bias is the intercept — the value of when all inputs are zero. It exists because the output rarely passes through the origin.
Suppose you model sales purely as a multiple of advertisement spend:
When advertisement = 0, sales = 0. But that is false. Sales happen even without advertising — because of brand recognition, word of mouth, and other unmeasured factors.
With a bias term:
Now when advertisement = 0, sales = 200. The bias captures the baseline — all the factors your measured variables do not account for.
Without bias, the fitted line is forced through the origin. With bias, the line can shift up or down to better match the data. In almost every real problem, you need a bias term.
2.10.4 Line Fitting and the Minimization of Error
The goal of linear regression: find so the line passes as close as possible to all data points. You do NOT require the line to touch every point. That is usually impossible when you have more data points than parameters.
The fitting process (conceptual):
- Start with random values for .
- For each data point, compute the error. It is the vertical distance between the predicted value () and the actual value ().
- Square all errors and sum them: . This is the mean squared error.
- Adjust to reduce the total loss.
- Repeat until the loss stops decreasing.
You start with very random values of weight and bias. Then the algorithm tries to see where the data points are and moves in that direction. On the right-hand side, the vertical dashed lines are the errors. The entire idea is to minimize these dashed lines.
2.10.5 Higher-Dimensional Fitting
The same idea extends to any number of dimensions:
- 2D (1 feature): Fit a line through scattered points.
- 3D (2 features): Fit a plane through scattered points.
- 4D+ (3+ features): Fit a hyperplane — a flat linear surface in higher-dimensional space.
A plane fits through all the data points. In higher dimensions, it is a higher-dimensional plane. Still linear fitting — the surface is always flat.
2.10.6 Data as Matrices
For observations and features, the data is naturally represented in matrix form.
The target variable becomes an column vector:
Each feature becomes an column vector. The design matrix stacks them:
Each row is one observation. The model is a system of linear equations in the unknowns .
Critical distinction: In regression, the data ( and ) are known and the parameters () are unknown. In the REF/RREF examples (Sections 2.7–2.9), the coefficients and constants were known, and the variables were unknown. The roles are swapped, but the mathematics is identical: you are solving linear equations.
- Applies when: The relationship between features and target is approximately linear. The errors are roughly normally distributed with constant variance. Observations are independent.
- Fails when: The true relationship is nonlinear (e.g., exponential growth, periodic patterns). Outliers dominate the fit. Features are highly correlated (multicollinearity — the design matrix becomes nearly singular, and the parameters blow up).
- Overdetermined systems: You typically have far more data points () than parameters (). The system is overdetermined — no exact solution exists. You find the best approximate solution by minimizing error. This is different from the square systems in Sections 2.7–2.9 where and an exact solution was possible.
Visual Intuition. Open Desmos or any plotting tool. Scatter some points: (1, 2), (2, 3), (3, 5), (4, 4), (5, 7). These five points do not lie on a single straight line. Now draw the best-fit line . Some points are above it, some below. The vertical distances to the line — the residuals — sum to zero if the line is correctly positioned. The squared residuals are minimized. The line captures the upward trend without passing through any single point exactly.
In 3D (two features), the regression surface is a plane tilting through a cloud of points. The plane's tilt in the direction is ; its tilt in the direction is ; its height at the origin is .
- Forgetting the bias term. Forcing the line through the origin () almost always gives a worse fit. Always include a bias unless you have a strong domain reason not to.
- Thinking the fitted line must pass through data points. It almost never does. The line is a summary of the trend, not an interpolation through every point.
- Expecting 100% accuracy. Some residual error is inevitable. The question is whether the error is small enough to be useful, not whether it is zero.
- Confusing the roles. In regression, the unknowns are and (the model parameters). In the earlier sections, the unknowns were . The same linear algebra applies — only the names have changed.
A: There is none. A simple constraint equation does not have a bias term — it is just a relationship between variables. A predictive model equation adds an explicit bias: . The bias exists because the output (e.g., sales) depends on factors beyond the measured inputs.
Q: Could sales be affected by unknown parameters beyond advertisement, introducing error?
A: Exactly — that is why bias exists. Bias aggregates the effect of all omitted variables. Adding more relevant features makes the model more sophisticated and typically reduces the bias magnitude. A large bias signals that important predictors are missing.
Q: Does every data point need to satisfy the fitted line exactly?
A: No. The goal is to find a line as close as possible to all points, minimizing the vertical errors. No model is 100% accurate; some residual error is inevitable. The fitted line is a summary of the trend, not a perfect predictor of every individual.
Q: How does linear fitting work in more than 2 dimensions?
A: In 2D you fit a line; in 3D you fit a plane; in 4D+ you fit a hyperplane. All are "linear fitting" because the surface is always flat — no curves. The errors are the vertical (perpendicular-to-hyperplane) distances between the fitted surface and each data point.
Bridge. Linear regression uses linear equations as predictive models. But linear equations also appear in a different role. They appear as constraints in optimization problems — deciding how many phones and tablets to manufacture given limited resources. That is linear programming.
Real-World & Domain Connection. Linear regression is the most deployed ML algorithm in industry. The Zillow Zestimate predicts house prices using a linear combination of square footage, bedrooms, bathrooms, location scores, and a bias. Credit scoring models (FICO, VantageScore) use logistic regression — a close cousin — to estimate default probability. They use age, income, credit history, and outstanding debt. Demand forecasting at retailers like Walmart uses linear models to predict weekly sales from past sales, promotions, and seasonality. Medical research uses linear regression to quantify the effect of a treatment while controlling for age, weight, and other covariates. Every one of these is an evaluation of with learned weights.
2.11 Linear Programming as an Application Context
2.11.1 What Linear Programming Is
Linear programming is a branch of operations research. You solve systems of linear equations (and inequalities) under constraints to optimize an objective — typically maximizing profit or minimizing cost.
Let's say I have some chips, some memory units, and some man-hours. I am trying to make tablets or mobile phones. I have certain restrictions on resources. I cannot make infinitely many products. I try to find what combination of tablets and phones maximizes revenue.
2.11.2 Structure of a Linear Programming Problem
A linear programming problem has three components:
- Decision variables: What you control (e.g., number of tablets , number of phones ).
- Constraints: Linear inequalities from limited resources. For example, if one tablet uses 2 chips, one phone uses 1 chip, and you have 15 chips: Similar constraints for memory, labor hours, etc.
- Objective function: A linear expression to maximize or minimize. For example, if each tablet earns ₹5000 profit and each phone earns ₹3000:
The solution method is typically the Simplex algorithm. It moves from one corner point of the feasible region to another. Each step improves the objective until the optimum is reached. Each step is a pivot operation — a row operation — exactly like those in Gaussian elimination.
2.11.3 Distinction from ML Model Fitting
The professor drew a clear boundary between two uses of linear equations:
| Context | What you have | What you solve for | Method |
|---|---|---|---|
| REF/RREF (Linear Programming) | Fixed equations with known coefficients | Values of the variables (e.g., how many tablets to make) | Gaussian / Gauss-Jordan / Simplex |
| ML Model Fitting | Data points (many observations) | Parameters of the model (weights and bias) | Iterative optimization (gradient descent) |
In linear programming, you solve a well-defined system of equations and inequalities directly. The coefficients are fixed, and you find the optimal variable values. In machine learning, the linear equation IS the model. You fit its parameters to data, and the system is typically overdetermined (more data points than parameters).
A: Yes. REF/RREF solves explicit systems of linear equations — like finding how many phones vs. tablets to manufacture given resource constraints. In ML, the linear equation is the model itself. You fit parameters (weights, bias) to data. You are not solving a fixed system of constraints. The REF/RREF skills build matrix intuition that transfers to ML, but the direct application is in optimization and operations research.
This is a key framing question — the professor wanted students to understand where each tool belongs.
- Confusing constraints with equations. Linear programming uses inequalities (), not just equalities. The feasible region is a polygon (2D) or polytope (higher-D), not just a single point.
- Assuming the optimum is always at the origin. The optimum of a linear program is always at a corner point of the feasible region. But it is almost never at the origin unless all resources are zero.
- Thinking LP is unrelated to what you learned. The Simplex method literally performs row operations on a tableau — an augmented matrix with extra rows for the objective. It is Gaussian elimination extended for optimization.
Bridge. This concludes the conceptual content of Lecture 2. The remaining sections — Exam Guidance and Key Industry Applications — consolidate what you have learned for exam preparation and real-world context.
Real-World & Domain Connection. Linear programming solvers — Gurobi, CPLEX, and open-source alternatives (HiGHS, GLPK) — power global supply chains. Airline crew scheduling is a massive linear program solved daily. It assigns pilots and flight attendants to thousands of flights while respecting duty-time regulations. Portfolio optimization (allocating capital across assets to maximize return for a given risk) uses quadratic programming, a direct extension. UPS's ORION system saves 100 million miles per year by solving vehicle routing problems — linear programs with integer constraints. All of these use pivoting methods built on the REF structures from Sections 2.7–2.8.
Exam Guidance Summary
What to expect
- Mark distribution was not explicitly stated in the session. However, the professor emphasized that solving linear systems using REF and RREF is a core assessed skill.
- Expect a mix of conceptual questions and procedural questions. A conceptual question might ask you to identify the three solution types. A procedural question might ask you to perform Gaussian elimination on a 3×3 system.
- Practice problems are included in the slide deck. The professor explicitly encouraged you to attempt them and check whether you can do them.
Study strategy
- The companion PDF (12 pages) is recommended over the full slide deck (41 slides) for efficient study. It covers the same content in a structured, easier-to-read format.
- For the open-book comprehensive exam, the full PPT slide deck will be the primary reference. Know where each topic is located across the slides so you can find it quickly.
- Key skills to master:
- Writing an augmented matrix from a system of equations
- Performing all three elementary row operations correctly
- Recognizing REF vs. RREF and converting between them
- Identifying pivot and free variables from the matrix form
- Interpreting the three solution types (unique, none, infinite) from REF/RREF
- Writing the parametric form for infinite-solution cases
High-weight topics
| Topic | Section | Exam Likelihood |
|---|---|---|
| Three solution types from REF/RREF | 2.9 | Very High (most important) |
| Gaussian elimination (REF) | 2.7 | High |
| Gauss-Jordan elimination (RREF) | 2.8 | High |
| Elementary row operations | 2.6 | High (foundational) |
| Augmented matrix construction | 2.5 | Medium |
| Linear regression connection | 2.10 | Medium (conceptual) |
| Linear programming distinction | 2.11 | Low–Medium |
Key Industry Applications
Large Language Models
- GPT-4 (OpenAI): ~1.7 trillion parameters, each a weight in a linear equation . Every transformer layer evaluates billions of these equations per input token.
- Claude (Anthropic), Llama (Meta), Gemini (Google): All use the same governing linear equation at their core. The "intelligence" emerges from stacking linear transformations with nonlinear activations between them.
Linear Algebra & Visualization Tools
- Desmos: Free online graphing calculator used in class to visualize linear equations, their intersections, and the geometric meaning of solutions.
- MATLAB / NumPy / LAPACK: Production linear algebra libraries. All represent systems in augmented matrix form and apply row operations internally. NumPy's
np.linalg.solve(A, b)performs Gaussian elimination with partial pivoting.
Optimization & Operations Research
- Gurobi / CPLEX / HiGHS: Commercial and open-source linear programming solvers. Use pivoting methods (built on REF) for supply-chain optimization, production planning, portfolio allocation, and airline crew scheduling. Handle millions of variables and constraints.
Predictive Modeling
- Zillow Zestimate: Predicts house prices using a linear combination of square footage, bedrooms, location scores, and a bias term. Every estimate is one evaluation of .
- Credit scoring (FICO, VantageScore): Logistic regression — a close cousin of linear regression — estimates default probability. It uses age, income, credit history, and debt. Weights are learned from historical loan data.
- Sales forecasting: Companies model sales as . The bias captures brand value and organic demand — the sales that happen even without advertising.
Navigation & Engineering
- GPS navigation: Your receiver solves a system of four linear equations (one per visible satellite). It determines your 3D position and clock bias. A direct application of solving .
- Circuit analysis: Kirchhoff's current and voltage laws produce sparse linear systems solved by Gaussian elimination variants.
- Structural engineering: Finite element analysis for bridges, buildings, and aircraft produces massive sparse linear systems (). They are solved by iterative methods built on the same row-operation principles.
MFML Lecture 02 notes · Solving Systems of Linear Equations
Sections Breakdown
Definition, degree-1 form, and the line/plane/hyperplane geometry of linear equations.
Collections of equations sharing variables; the common solution as an intersection.
The governing equation w^T x + b = 0 and GPT-4's 1.7 trillion parameters.
High-school elimination, worked example, and why it fails to scale.
Compact [A | b] form: rows are equations, columns are variables.
The three legal moves: swap, scale, replace — and what they preserve.
REF staircase, the Gaussian elimination algorithm, and back-substitution.
RREF with normalized pivots and direct readability of the solution.
Unique, no solution, and infinitely many solutions read from REF/RREF.
Flipping roles: data known, parameters unknown; minimizing squared error.
Optimization under inequality constraints via the Simplex pivot method.
What to expect, study strategy, and high-weight topics for the exam.
LLMs, solvers, predictive modeling, navigation, and engineering uses.
Exam Revision Notes
Below is the distilled, exam-ready core of this lecture. Every entry is built from the full textbook notes above. Use this section for rapid review — but if something doesn't make sense, go back to the full explanation in the main content.
2.1 What Is a Linear Equation
Must-know: A linear equation is a weighted sum of variables, each raised only to degree 1, set equal to a constant. It graphs as a line (2D), plane (3D), or hyperplane (nD) — always flat.
⚠️ Top pitfall: Thinking "the graph is a line" makes it linear. A circle is curved-smooth but nonlinear. The test is algebraic: variables only added, never multiplied or inside a function.
Self-check: Is linear? Why or why not?
Connects to: 2.2 Systems of equations, 2.3 Neural network governing equation.
2.2 Systems of Linear Equations
Must-know: A system is a set of linear equations sharing variables; the common solution is the point (intersection) satisfying all at once. You need at least as many independent equations as unknowns for a unique answer.
⚠️ Top pitfall: Assuming every system has a solution. Fewer equations than unknowns gives an underdetermined (often infinite) system; contradictory equations give none.
Self-check: With 3 variables, how many independent equations are needed for a unique solution?
Connects to: 2.5 Augmented matrix, 2.9 Three outcomes.
2.3 Linear Equations in Machine Learning
Must-know: Every neural network layer is built on — a linear equation. GPT-4's 1.7 trillion parameters are weights in such equations. Training uses gradient descent, NOT Gaussian elimination.
⚠️ Top pitfall: Believing the model "solves" the system with row operations. The weights are the unknowns; the training data supplies the equations. Gradient descent fits them iteratively.
Self-check: Why can't we use Gaussian elimination to train a 1.7-trillion-parameter model?
Connects to: 2.1 Linear equation, 2.10 Linear regression.
2.4 Elimination and Substitution
Must-know: Elimination matches a coefficient, subtracts one equation from another to cancel a variable, solves, then back-substitutes. It works for 2–3 equations but becomes unmanageable at scale — the motivation for matrices.
⚠️ Top pitfall: Forgetting to multiply the right-hand side when scaling an equation. becomes , never .
Self-check: After eliminating from a 2-equation system, what must you do to find both variables?
Connects to: 2.5 Augmented matrix, 2.6 Row operations.
2.5 The Augmented Matrix
Must-know: The augmented matrix strips variable names: rows = equations, columns (before bar) = variables, last column = constants. Missing variables become zeros, not blanks.
⚠️ Top pitfall: Misaligning columns. Reorder to before extracting coefficients, or the columns won't match.
Self-check: What does the vertical bar in an augmented matrix represent?
Connects to: 2.4 Elimination, 2.6 Row operations.
2.6 Elementary Row Operations
Must-know: Exactly three legal moves preserve the solution set: row swap (), row scaling (), and row replacement ().
⚠️ Top pitfall: Scaling by zero () destroys the equation. Also, row replacement modifies only row , never row — and the constant column must be updated too.
Self-check: Which of the three operations changes the individual equations but keeps the solution set identical?
Connects to: 2.7 Gaussian elimination, 2.8 Gauss-Jordan.
2.7 Row Echelon Form & Gaussian Elimination
Must-know: Gaussian elimination uses row operations to reach REF. REF is a staircase where each pivot is right of the one above and all entries below are zero. Then back-substitute from the last row up.
⚠️ Top pitfall: Stopping before all entries below every pivot are zero. One leftover nonzero means the matrix isn't in REF and back-substitution fails. Cost is .
Self-check: Why must you swap rows when the pivot position holds a zero?
Connects to: 2.6 Row operations, 2.8 RREF, 2.9 Outcomes.
2.8 Reduced Row Echelon Form & Gauss-Jordan
Must-know: RREF adds two rules to REF: every pivot equals 1, and every pivot column is zero everywhere except the pivot. The solution is then the rightmost column — no back-substitution needed.
⚠️ Top pitfall: Zeroing above pivots in the wrong order. Always go right-to-left, or later steps reintroduce nonzero entries above left pivots.
Self-check: In RREF, what must every pivot value be, and what fills the rest of its column?
Connects to: 2.7 Gaussian elimination, 2.9 Outcomes.
2.9 The Three Possible Outcomes
Must-know: From REF/RREF read the outcome directly. Unique means every variable column has a pivot. No solution means a row . Infinitely many means at least one free variable plus a zero row. This is the most important section.
⚠️ Top pitfall: Confusing parallel (no solution) with coincident (infinitely many). For infinite cases, you must write the parametric form using the free variable , not just say "infinitely many."
Self-check: A REF row reads . What does that tell you about the system?
Connects to: 2.7 REF, 2.8 RREF, 2.11 Linear programming.
2.10 Linear Regression & Model Fitting
Must-know: Linear regression flips the roles: data () is known, parameters () are unknown. Fit by minimizing the sum of squared errors. The bias captures the baseline when all inputs are zero.
⚠️ Top pitfall: Forgetting the bias term forces the line through the origin and worsens the fit. Also, the fitted line rarely passes through any data point — that's expected, not a failure.
Self-check: In regression, what are the unknowns — the 's or the 's and ?
Connects to: 2.3 Governing equation, 2.11 Linear programming.
2.11 Linear Programming
Must-know: Linear programming optimizes a linear objective (e.g., profit) subject to linear inequality constraints. The Simplex method pivots on a tableau — the same row operations as Gaussian elimination, applied to optimization.
⚠️ Top pitfall: Treating LP constraints as equalities. They are inequalities (), so the feasible region is a polytope. The optimum sits at a corner point — not the origin.
Self-check: How does the Simplex method relate to the row operations you learned in 2.6?
Connects to: 2.6 Row operations, 2.9 Feasibility.
Was this lecture useful?
BitsNotes AI Assistant
Subject Notes AssistantConfigure AI Chat
Choose how to access the chatbotSigned in as
Powered by BitsNotes — 20 messages per day. No API key needed. Want unlimited access? Use "Bring Your Own Key" mode.
Sign in to use AI Chat
Get 20 free AI messages per day to ask questions about your lecture notes. Sign in with Google or GitHub — it takes 5 seconds.
Sign In to BitsNotesSwitch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.