TactivergeLite

Lite / Textbooks / Applied Engineering Mathematics / Chapter 1

1. Linear systems in practice

Version 1 · Technically checked (automated checks only) · 4 source lessons · Full interactive version

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

  1. 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

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

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
  1. Let A = [[a, b], [c, d]]. We want X with AX = I.

  2. Try X = k·[[d, −b], [−c, a]] (swap the diagonal, negate the off-diagonal).

  3. Then AX = k·[[ad − bc, −ab + ba], [cd − dc, −cb + da]] = k·(ad − bc)·I.

  4. Choosing k = 1/(ad − bc) gives AX = I, so A⁻¹ = (1/det A)·[[d, −b], [−c, a]].

  5. This only works if det A = ad − bc ≠ 0; when it is zero there is no inverse.

Common mix-ups

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
  1. Exact: Ax = b. Perturbed data: A(x + δx) = b + δb. Subtract: A·δx = δb, so δx = A⁻¹δb.

  2. Take norms: ‖δx‖ ≤ ‖A⁻¹‖·‖δb‖. Also ‖b‖ = ‖Ax‖ ≤ ‖A‖·‖x‖, so 1/‖x‖ ≤ ‖A‖/‖b‖.

  3. Multiply: ‖δx‖/‖x‖ ≤ ‖A‖·‖A⁻¹‖·‖δb‖/‖b‖.

  4. Define κ(A) = ‖A‖·‖A⁻¹‖. In the 2-norm this is σmax/σmin, the ratio of the largest to smallest singular value.

  5. 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

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.

The interactive versions are in the full chapter.

Laboratory

These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.

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.

  1. 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”
  2. Your solver returns x with residual ‖b − Ax‖ ≈ 10⁻¹⁴. What have you shown?
    Answer it in “Writing engineering problems as Ax = b”
  3. To apply A first and then B to a vector x, you compute…
    Answer it in “Matrix multiplication as composition”
  4. A is 3×2 and B is 2×4. What size is AB?
    Answer it in “Matrix multiplication as composition”
  5. A colleague computes x = inv(A) * b for a 5000×5000 system. Best advice?
    Answer it in “Inverses: undoing a linear map”
  6. κ = 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”
  7. 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”
  8. 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.

Summary

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

Write it up on paper or in your own notes. Lite never stores what you write.

References

← Contents2. Least squares and model fitting →