Lite / Textbooks / Applied Engineering Mathematics / Chapter 1
1. Linear systems in practice
Introduction
Circuits, trusses and calibration problems all arrive as many linear equations at once. This chapter writes them as A·x = b, treats matrix multiplication as doing one map after another, and asks the practical questions a textbook exercise skips: should you ever form an inverse, and how much can you trust the answer? The condition number is the honest measure. When it is large, a tiny error in the data can move the solution a long way.
Figure 1.1. Two nearly parallel lines (described in words)
Two almost parallel lines, x + y = 2 and x + 1.01y = 2.01, cross at (1, 1). Changing the second right-hand side by only 0.01, to 2.02, moves the crossing all the way to (0, 2). The matrix has a condition number of about 402, so small data errors are greatly amplified.
Explanation
Built from 4 School lessons. Each part is the lesson's own explanation.
1.1 Writing engineering problems as Ax = b
A resistor network, a loaded frame and a cross-talking sensor pair look nothing alike. Why does one line of code solve all three?
A recipe for modelling
- Choose unknowns (loop currents, member tensions, true quantities). 2. Write one equation per physical law: Kirchhoff's voltage law per loop, ΣF = 0 per direction per joint, one sensor model per reading. 3. Collect coefficients into A, knowns into b. 4. Count: as many independent equations as unknowns for a unique answer.
Example: two-loop circuit
A 2 V source drives loop 1 through 2 Ω, and loop 2 contains a 3 V source and 1 Ω. A 1 Ω resistor is shared. KVL in loop 1: 2I₁ + 1(I₁ − I₂) = 2, so 3I₁ − I₂ = 2. Loop 2: 1(I₂ − I₁) + 1·I₂ = 3, so −I₁ + 2I₂ = 3. So A = [[3, −1], [−1, 2]], b = (2, 3), and I = (1.4, 2.2) A.
Always check the residual
Compute r = b − A·x. A tiny residual says you solved the equations you wrote; it does not say they were the right equations. So also sanity-check physics: are currents in a sensible direction, do tensions in a hanging cable come out positive, does the answer change sensibly when you double a source?
Common mix-ups
If the residual is zero, the model is right.
✓ A zero residual only verifies the solve. Validation needs physics checks and data.More equations always means a better model.
✓ Dependent equations add nothing; inconsistent ones make the system unsolvable. Count independent equations.
Open the Lite lesson: Writing engineering problems as Ax = b
1.2 Matrix multiplication as composition
Rotate then shear, or shear then rotate: the same two moves, different results. Why does order matter for matrices?
The rule
If A is m×n and B is n×p, then AB is m×p with (AB)ᵢⱼ = Σₖ aᵢₖbₖⱼ: row i of A dotted with column j of B. Inner dimensions must match. Equivalently, column j of AB is A times column j of B.
Composition
(BA)x = B(Ax): first A acts, then B. So BA means 'A then B', read right to left, just like function composition f(g(x)). Associativity, (CB)A = C(BA), lets you pre-multiply a chain of frames into one matrix once.
Order and transposes
In general AB ≠ BA; commuting is the exception (for example two rotations about the same axis, or diagonal matrices). The transpose swaps rows and columns, and reverses products: (AB)ᵀ = BᵀAᵀ. Similarly (AB)⁻¹ = B⁻¹A⁻¹: to undo 'put on socks, then shoes', take off shoes first.
Common mix-ups
AB = BA, like ordinary numbers.
✓ Matrix products usually do not commute; the order encodes which map happens first.Matrix multiplication multiplies matching entries.
✓ That is the element-wise (Hadamard) product. The matrix product is rows times columns.
Open the Lite lesson: Matrix multiplication as composition
1.3 Inverses: undoing a linear map
A sensor matrix turns true forces into readings. Can you always run it backwards to turn readings into forces?
What an inverse is
A⁻¹ is the matrix with A⁻¹A = AA⁻¹ = I. It exists exactly when A is square with det A ≠ 0 (rank n). Then Ax = b has the unique solution x = A⁻¹b. Geometrically, the map must not squash any direction to zero, or it cannot be undone.
Gauss–Jordan for bigger matrices
Write [A | I] and row-reduce all the way to [I | X]: eliminate below and above each pivot and scale pivots to 1. Then X = A⁻¹. If a zero pivot cannot be fixed by swapping, A is singular.
Solve, don't invert
In computation, forming A⁻¹ costs about three times more than an LU solve and is typically less accurate. Libraries offer solve(A, b) for this reason. Inverses remain useful on paper, for small fixed matrices, and when you genuinely need the entries (for example a covariance matrix).
Derivation: The 2×2 inverse formula
Let A = [[a, b], [c, d]]. We want X with AX = I.
Try X = k·[[d, −b], [−c, a]] (swap the diagonal, negate the off-diagonal).
Then AX = k·[[ad − bc, −ab + ba], [cd − dc, −cb + da]] = k·(ad − bc)·I.
Choosing k = 1/(ad − bc) gives AX = I, so A⁻¹ = (1/det A)·[[d, −b], [−c, a]].
This only works if det A = ad − bc ≠ 0; when it is zero there is no inverse.
Common mix-ups
Every square matrix has an inverse.
✓ Only those with det A ≠ 0.A small determinant means nearly singular.
✓ Scaling changes det without changing difficulty: 0.1·I in 10D has det 10⁻¹⁰ yet is perfectly conditioned. Use the condition number (week 5).
Open the Lite lesson: Inverses: undoing a linear map
1.4 Conditioning: when small errors become big ones
Your solver is perfect, your sensors are 0.1% accurate, and your answer is 50% wrong. Who is to blame?
A property of the problem
κ(A) ≥ 1 measures how sensitive the solution of Ax = b is to changes in b (and in A). κ ≈ 1 is perfect (rotations, orthogonal matrices); κ = 10⁶ means relative data errors may be magnified up to a million times. It is a property of the problem itself, so no algorithm can beat it.
Determinant is not the test
det(0.01·I) in 10 dimensions is 10⁻²⁰, yet κ = 1: it is perfectly conditioned, just scaled. [[1, 1], [1, 1.0001]] has det 10⁻⁴ and κ ≈ 4×10⁴. Use κ, not det, to judge closeness to singularity.
Problem versus algorithm
Conditioning is about the problem; stability is about the algorithm. Elimination without pivoting on the tiny-pivot example is an unstable algorithm on a well-conditioned problem (κ ≈ 2.6). Pivoting fixes the algorithm. For an ill-conditioned problem, the fix is to change the problem: better sensor placement, rescaling, or more independent measurements.
Derivation: The error-amplification bound
Exact: Ax = b. Perturbed data: A(x + δx) = b + δb. Subtract: A·δx = δb, so δx = A⁻¹δb.
Take norms: ‖δx‖ ≤ ‖A⁻¹‖·‖δb‖. Also ‖b‖ = ‖Ax‖ ≤ ‖A‖·‖x‖, so 1/‖x‖ ≤ ‖A‖/‖b‖.
Multiply: ‖δx‖/‖x‖ ≤ ‖A‖·‖A⁻¹‖·‖δb‖/‖b‖.
Define κ(A) = ‖A‖·‖A⁻¹‖. In the 2-norm this is σmax/σmin, the ratio of the largest to smallest singular value.
Rule of thumb: you can lose about log₁₀ κ significant digits. With double precision (about 16 digits) and κ = 10¹⁰, expect about 6 good digits.
Common mix-ups
A tiny determinant means ill-conditioned.
✓ Use the condition number; determinants change with scaling.Better code always fixes inaccurate answers.
✓ Only if the algorithm was unstable. An ill-conditioned problem is sensitive whatever the code.
Open the Lite lesson: Conditioning: when small errors become big ones
Worked examples
Writing engineering problems as Ax = b: example 1
Two sensors read r₁ = q₁ + 0.5q₂ and r₂ = 0.25q₁ + q₂. Readings are r = (3, 2.5). Find the true quantities q.
Solution
A = [[1, 0.5], [0.25, 1]]. From the first equation q₁ = 3 − 0.5q₂. Substituting: 0.75 − 0.125q₂ + q₂ = 2.5, so q₂ = 2 and q₁ = 2. Residual: (3 − 2 − 1, 2.5 − 0.5 − 2) = (0, 0).
Matrix multiplication as composition: example 1
Compute AB for A = [[1, 2], [3, 4]], B = [[0, 1], [1, 0]], and BA.
Solution
AB = [[1·0 + 2·1, 1·1 + 2·0], [3·0 + 4·1, 3·1 + 4·0]] = [[2, 1], [4, 3]] (columns of A swapped). BA = [[3, 4], [1, 2]] (rows of A swapped). Different.
Inverses: undoing a linear map: example 1
Invert A = [[3, 1], [2, 5]] and check.
Solution
det A = 15 − 2 = 13. A⁻¹ = (1/13)[[5, −1], [−2, 3]]. Check: A·A⁻¹ = (1/13)[[15 − 2, −3 + 3], [10 − 10, −2 + 15]] = I. ✓
Conditioning: when small errors become big ones: example 1
κ(A) = 10⁴ and the measurements in b have 0.01% relative error. What is the worst-case relative error in x?
Solution
‖δx‖/‖x‖ ≤ 10⁴ × 10⁻⁴ = 1, i.e. up to 100%. The answer may have no correct digits.
Interactive figures, in words
Figure 1.2 from Matrix multiplication as composition
Load 'Shear' into A and choose 'Then apply B: Rotate 30°'. Note where î and ĵ land. Now load 'Rotate 30°' into A and apply B = 'Shear'. Same two maps, different picture. Check that det(BA) = det(B)·det(A) both times.
The transformation grid shows a grid and unit square mapped by the combined matrix B·A, with î and ĵ drawn as labelled arrows. Text gives the combined matrix entries and det A, det B and det(BA).
Figure 1.3 from Conditioning: when small errors become big ones
Set ε = 1 and nudge b₂. Then slide ε down to 10⁻⁴. For each, record κ, the relative change in b and the relative change in x. Does the amplification ever exceed κ?
The condition explorer draws two lines whose intersection is the solution, plus a dashed nudged line and the new intersection. Sliders set ε and the nudge. Text reports κ, both solutions and the relative changes in b and x.
Laboratory
These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.
- Equation Lab: Matrices (Equation Lab exploration)
Make the two columns of a 2×2 matrix nearly parallel and watch how far the solution moves when you nudge the right-hand side.
Open on the full site - Code Lab (Studio)
Solve a three-node resistor network as A·x = b, then perturb one resistor by 1 % and report how much each node voltage changes.
Open on the full site
Practice
Each question links to its Lite lesson, where your answer is checked on our server and a wrong answer gets a hint. Answers are never sent to your device.
- For the circuit in the lesson (3I₁ − I₂ = 2, −I₁ + 2I₂ = 3), what is I₂ in amperes?
Answer it in “Writing engineering problems as Ax = b” - Your solver returns x with residual ‖b − Ax‖ ≈ 10⁻¹⁴. What have you shown?
Answer it in “Writing engineering problems as Ax = b” - To apply A first and then B to a vector x, you compute…
Answer it in “Matrix multiplication as composition” - A is 3×2 and B is 2×4. What size is AB?
Answer it in “Matrix multiplication as composition” - A colleague computes x = inv(A) * b for a 5000×5000 system. Best advice?
Answer it in “Inverses: undoing a linear map” - κ = 500, relative error in b is 0.002 (0.2%). What is the worst-case relative error in x?
Answer it in “Conditioning: when small errors become big ones” - Working with about 16 significant digits and κ = 10⁹, roughly how many digits of x can you trust?
Answer it in “Conditioning: when small errors become big ones” - A calibration matrix has κ = 10⁷. What actually helps?
Answer it in “Conditioning: when small errors become big ones”
Engineering applications
Circuit simulators
A simulator writes one current-balance equation per node and solves them together. It never forms an inverse: elimination on the system is faster and loses fewer digits.
Calibration fits
A sensor calibrated from readings bunched in a narrow range gives a badly conditioned system. Spreading the calibration points across the whole range is the cheapest fix.
Watch (optional)
Streaming video uses a lot of data. Everything you need is in the text.
- “Matrix multiplication as composition | Chapter 4, Essence of linear algebra” by 3Blue1Brown
- “Inverse matrices, column space and null space | Chapter 7, Essence of linear algebra” by 3Blue1Brown
- “2. Elimination with Matrices.” by MIT OpenCourseWare
Summary
- Many engineering problems are A·x = b: one row per balance law, one unknown per column.
- AB means apply B first, then A; the order matters and the sizes must match.
- Solve by elimination rather than computing an inverse; it is cheaper and more accurate.
- The condition number κ bounds how much relative error in b can grow in x; large κ means fragile answers.
Glossary
- Matrix multiplication
- Multiplying matrices combines rows of the first with columns of the second: each entry of the result is a dot product of a row and a column. Field Guide
- Kirchhoff's current law (KCL)
- At any junction in a circuit, the total current flowing in equals the total current flowing out. Field Guide
- Floating-point rounding and comparison
- Most decimal fractions cannot be stored exactly in binary floating point, so tiny rounding errors appear and == between floats is unreliable. Field Guide
- Absolute and relative uncertainty
- Absolute uncertainty is the ± range in the same units as the measurement; relative uncertainty is that range divided by the measurement, often as a percentage. Field Guide
Project: How fragile is my network?
Pick a small resistor network or a two-member truss. Write it as A·x = b, solve it, then repeat with each input changed by 1 %. Estimate the condition number and say whether the measured sensitivity matches it.
Deliverables
- The system written as A·x = b with units
- The solution and the perturbed solutions
- A condition-number estimate with a one-paragraph interpretation
Write it up on paper or in your own notes. Lite never stores what you write.
References
- Gilbert Strang (2016). Introduction to Linear Algebra, 5th edition. Wellesley-Cambridge Press.
- Lloyd N. Trefethen and David Bau III (1997). Numerical Linear Algebra. SIAM.
- MIT OpenCourseWare (2010). 18.06 Linear Algebra (Spring 2010). Massachusetts Institute of Technology. Link