From Abstraction to the Real World
Every application in this lesson follows the same template: identify the unknown quantities, write down the balance or conservation laws that relate them, and organize those laws as a matrix equation Ax = b. From there, Gaussian elimination takes over.
Electrical Circuits: Kirchhoff's Laws
Any resistive circuit is fully described by two of Kirchhoff's laws. KCL (current law): the sum of currents entering any node equals the sum leaving — charge is conserved. KVL (voltage law): the sum of voltage drops around any closed loop is zero — energy is conserved.
For a circuit with n nodes and m independent loops, these laws produce a system of equations. The unknowns are the branch currents I₁, I₂, …, Iₖ. Each resistor contributes a term IᵢRᵢ to the voltage equations (Ohm's law), and each current source or battery appears on the right-hand side.
A Three-Branch Example
Consider a circuit with a 12V battery and three resistors R₁ = 2Ω, R₂ = 3Ω, R₃ = 6Ω arranged so that R₂ and R₃ share a middle node. Assigning branch currents I₁, I₂, I₃:
- KCL at middle node: I₁ = I₂ + I₃
- KVL outer loop: 12 = 2I₁ + 3I₂
- KVL inner loop: 3I₂ = 6I₃
KCL at every node and KVL for every independent loop produce exactly as many independent equations as there are unknown currents — provided you use the right number of independent loops (mesh analysis). The resulting matrix is always consistent and typically has a unique solution for a well-designed circuit.
Balancing Chemical Equations
A chemical equation must balance: the number of atoms of each element is identical on both sides. The stoichiometric coefficients (the numbers in front of each molecule) are the unknowns. Conservation of each element type produces one linear equation.
Combustion of Ethane
Consider: a C₂H₆ + b O₂ → c CO₂ + d H₂O. We need to find positive integers a, b, c, d. Conservation of each element:
- Carbon: 2a = c
- Hydrogen: 6a = 2d
- Oxygen: 2b = 2c + d
This is a homogeneous system Ax = 0 with four unknowns and three equations — so rank(A) = 3 and nullity = 1. The solution has one free variable: set a = 1, and the unique solution (up to scaling) is a = 2, b = 7, c = 4, d = 6, giving the balanced equation 2 C₂H₆ + 7 O₂ → 4 CO₂ + 6 H₂O.
Network Flow Problems
In any network — road traffic, internet packets, supply chains, water pipes — flow is conserved at every node: inflow equals outflow. Label the flow on each edge as an unknown. At each internal node, write: sum of incoming flows = sum of outgoing flows. This immediately produces a linear system.
A Four-Node Traffic Network
Suppose a city block has four intersections A, B, C, D with one-way streets. Known inflows enter at A (100 vehicles/hr) and B (80 vehicles/hr), and known outflows leave at C (90 vehicles/hr) and D (90 vehicles/hr). The edge flows x₁, x₂, x₃, x₄ on the interior streets are unknown.
KCL-style conservation at each intersection gives four equations. One will be redundant (total inflow = total outflow is guaranteed), leaving three independent equations in four unknowns — consistent, with one free variable. This means the traffic can be routed in a one-parameter family of ways, all satisfying conservation.
Network flow systems are often underdetermined — there are more streets than intersections, so rank(A) < n. The free variables represent design choices: which routes to prioritize. The entire feasible set (all non-negative flow assignments satisfying conservation) is the intersection of the affine solution space with the non-negativity constraints — this is the starting point for linear programming.
Least Squares Fitting: Preview
In practice, measurement data rarely satisfies any linear model exactly. If we try to fit m data points with a model having n parameters (m > n), we get an overdetermined system Ax = b with no exact solution — there is no x that makes all m equations true simultaneously.
The least squares solution minimizes the total squared residual ||Ax − b||². Geometrically, we project the vector b onto the column space of A. The optimal x̂ satisfies the normal equations:
Linear Regression as Least Squares
Fitting a line y = mx + c to n data points (x₁,y₁), …, (xₙ,yₙ) is a least squares problem. Build the matrix A with rows [xᵢ 1] and the vector b with entries yᵢ. The unknown vector is [m, c]ᵀ. The system Ax = b is overdetermined (n ≥ 2 equations in 2 unknowns), and the normal equations give the best-fit slope and intercept in closed form.
Signal Processing: Filter Design
A finite impulse response (FIR) filter computes each output sample as a weighted sum of the current and past input samples: y[n] = h₀x[n] + h₁x[n−1] + … + h_{L−1}x[n−L+1]. The filter coefficients h₀, …, h_{L−1} are the unknowns.
If we want the filter to produce specific output values for a set of test inputs, each test case gives one equation. Enough test cases produce a square or overdetermined system for the coefficients. More commonly, frequency-domain specifications (pass certain frequencies, reject others) translate directly into linear constraints on the coefficients.
Requiring the filter's frequency response H(f) to equal target values at L specific frequencies produces L equations in L unknowns — exactly a square linear system. When the target is achievable exactly, Gaussian elimination finds the coefficients. When it is not (more frequency constraints than coefficients), the least squares approach finds the best-fit filter in the L² sense. This is the foundation of digital filter design in DSP.
The Common Thread
Across all these applications, the workflow is identical:
- Identify unknowns — currents, coefficients, flows, parameters.
- Write balance laws — conservation of charge, atoms, flow, or minimum error.
- Assemble Ax = b — each law becomes a row; each unknown becomes a column.
- Classify and solve — is the system square, overdetermined, or underdetermined? Apply Gaussian elimination, normal equations, or parametric solution accordingly.
The theory from the previous three lessons — setting up systems, elimination, and solution types — is precisely what makes all of these applications tractable. Linear algebra is not a prerequisite for engineering; it is the language engineering is written in.
Conservation laws in physics, chemistry, and engineering are linear equations — and their collection is a matrix system. Kirchhoff's laws produce the current vector from circuit topology. Chemical balancing finds the null space of the atom-conservation matrix. Network flow uses KCL-style node equations with free variables representing routing flexibility. When data exceeds unknowns, the normal equations Aᵀax = Aᵀb give the least squares optimum — the foundation of regression and filter design. The mathematical machinery is always the same: Ax = b, analyze rank, solve.