Models: the math under the cybernetics

Move the picture, then watch the formula fall out of it. If you forget a formula, rebuild it from the picture. Nothing here needs memorizing.

Each step leans on the ones before it. The determinant comes from area. Inverses come from the determinant. A neuron is model 1 with one output. Change of basis is model 1 run backward. Eigenvectors come from the determinant again. Ashby's law comes from counting.

How to read any formula

Four questions that turn a formula from something to remember into something to rebuild.

1 · What goes in, what comes out?Vectors in, a vector out? Two numbers in, one out? That alone tells you its shape.
2 · What's the picture?Arrows, areas, a table of arrows, a staircase. If you can't draw it, you don't have it yet.
3 · What happens at the edges?Try zero, one, negative, equal. Edges are where formulas show what they're for: det = 0, slope = 1, k = n.
4 · What would I do by hand?Do one small case slowly. The general rule is the small case with letters in place of numbers.

Under each model, six lenses: what it means, where it came from, where it's used, what it looks like every day, what it does in the cybernetics, and a question to check yourself. Printing shows them all.

1 · Where the basis lands

3Blue1Brown, Essence of Linear Algebra, chapters 3 and 4. Drag the tips of î and ĵ. The grid follows, because every point is made of them.

Derive it

  1. Any vector is a recipe: v = x·î + y·ĵ.
  2. A linear transformation keeps the origin in place and grid lines straight, parallel and evenly spaced, so it keeps the recipe. The output is x·(where î went) + y·(where ĵ went).
  3. So write down where î and ĵ land as two columns. That pair of columns is the matrix.
  4. Matrix times vector is x copies of column 1 plus y copies of column 2. The rows-times-columns rule is just this, written out.
  5. Composition (chapter 4): to do B and then A, send each of B's columns through A. That is all matrix multiplication is.

A matrix is a list of where each basic direction goes. Everything else is made of those directions, so the list is the whole story. Coordinates are a recipe: how much of each ingredient. The matrix swaps in new ingredients and keeps the recipe.

Coordinates come from Descartes and Fermat in the 1630s: geometry turned into algebra. Grids of coefficients are much older. The Chinese Nine Chapters on the Mathematical Art (compiled about two thousand years ago) solved systems of equations by arranging numbers in a grid and eliminating, the method we now name after Gauss.

Sylvester coined the word matrix in 1850. Cayley (1858), building on Gauss and Eisenstein, defined matrix multiplication as doing one substitution and then another, so the multiplication rule was derived from composition, exactly step 5 here. Nobody memorized it first; it was a consequence.

Every rotate, zoom and skew on a screen is a matrix acting on points. Robot arms chain one matrix per joint. A spreadsheet that multiplies quantities by prices is a matrix times a vector. Each layer of a neural network is one matrix.

Two coffees and a bagel, priced at two different shops. Your order is the vector (2, 1). Each shop's prices form a row. The bill at every shop at once is the matrix times your order.

Any time you say "everything follows from what happens to a few basic things", you are thinking in a basis.

A whole transformation is known from what it does to a few things. Ashby's transformation is the same idea without the straight-line condition: model 7 is his table. Linearity is what lets a matrix get away with storing only its columns.

î lands on (0, 1) and ĵ lands on (−1, 0). Where does (3, 2) go? Use the recipe, not a rule.

answer

3·(0, 1) + 2·(−1, 0) = (−2, 3). It's a quarter turn counterclockwise.

notes

2 · One more column

Chapter 5. k̂ joins, and the matrix gets a third column. Nothing else changes. Drag on the picture to turn it.

Derive it

  1. The recipe grows by one term: x·î + y·ĵ + z·k̂.
  2. Where the three land are the three columns. Nothing new to learn, just one more column.
  3. The unit cube becomes a slanted box (a parallelepiped). Its volume is the size of the 3D determinant, and model 3 does the same in flat area. A negative sign means space was turned inside out, like a mirror.
  4. If k̂ lands in the plane of the other two, the box goes flat, and that's volume zero. Try "flatten to a plane".

Try

Set the third column equal to the first plus the second. The box flattens. Three directions that only span a plane can't describe all of space.

Adding a dimension adds an ingredient and nothing else. The rules you learned in the plane hold unchanged in three, or in seven hundred and eighty-four. Area becomes volume, and the idea stays the same.

The letters are Hamilton's. In 1843, looking for a way to multiply in three dimensions, he found the quaternions and carved their rule (i² = j² = k² = ijk = −1) into Brougham (now Broom) Bridge in Dublin. The carving is gone; a plaque marks the spot. He gave the astronomers' old word vector its modern meaning and coined scalar. Grassmann, in 1844, worked out spaces of any dimension. In the 1880s Gibbs and Heaviside pulled the useful part out of quaternions and gave physics the i, j, k unit vectors it still writes (the hats came later, from textbooks).

3D graphics and games, physics (forces, velocities), and colour: a pixel is a 3-vector of red, green and blue, and a camera's colour correction is a 3×3 matrix mixing them. A network layer reading a 28×28 image is a matrix with 784 columns: the same idea, just more columns.

A smoothie with three ingredients is a point in 3D. A recipe change that trades some banana for more berries is a transformation. When a photo looks too blue and you warm it, that's often a 3×3 matrix applied to every pixel.

Ashby works with systems of any number of variables: a state is a vector of readings, one per variable. The homeostat had four units, so its state lived in four dimensions. That's no stranger than your three, only harder to draw.

Make the third column equal to the first plus the second. What is the volume scale, and why?

answer

Zero. k̂ lands in the plane spanned by where î and ĵ landed, so the box is flat.

notes

3 · Area: the determinant

Chapter 6. The unit square becomes a parallelogram. The determinant is how many times bigger it got. If it flips over, the determinant is negative.

Derive ad − bc

  1. Take the case where î and ĵ both point up and to the right, with ĵ counterclockwise of î (the first preset). Put the parallelogram in the box around it, which is (a+b) wide and (c+d) tall. The other cases work the same way with signs.
  2. Cut away what isn't the parallelogram: two triangles of area ac/2, two of bd/2, and two rectangles of bc.
  3. (a+b)(c+d) − ac − bd − 2bc = ad − bc. Press the button to see the pieces.
  4. Composition multiplies areas, so det(AB) = det A · det B. There's nothing to memorize, because scale factors multiply.
  5. Inverse (chapter 7): undoing A has to shrink the area back by the same factor, so it divides by det A. When det A = 0 there's nothing to divide by, and no inverse.

One number for how much the transformation scales space, and whether it flips it. It's a gauge: big means stretched, small means squeezed, zero means a dimension was lost, negative means a mirror image.

Determinants are older than matrices. Seki Takakazu in Japan (1683) and Leibniz in Europe (1693) found them independently, while eliminating unknowns from equations. Cauchy (1812) gave them their modern meaning, and he and Binet proved that they multiply. The picture of area and volume makes all of it obvious, but it came later than the algebra. Here you get the picture first.

Does a system of equations have one answer? Check the determinant. In calculus, a curved map scales area differently at each spot, and the local determinant (the Jacobian) is how integrals change variables. Graphics uses the sign to tell which side of a line a point is on, or which way a triangle faces.

A world map: the Mercator projection's local area scale grows toward the poles, which is why Greenland looks the size of Africa. Two survey questions that really measure the same thing make a near-zero determinant (exactly zero only if they're perfectly redundant), so you can't separate their effects. Statisticians call that collinearity.

A zero determinant is a machine that forgets. Model 4 counts what is forgotten, and Ashby measures it as lost variety.

Without the formula: what is the determinant of [[3, 0], [0, 2]]? And of [[1, 2], [2, 4]]?

answer

6: a 3 by 2 rectangle. Then 0: the second column is twice the first, so both land on one line.

notes

4 · Collapse loses variety

Forty-nine dots you can tell apart. Pull the slider toward zero area and watch distinct dots land on top of each other.

Derive it

  1. Variety is the number of things you can tell apart. Here that's the number of distinct positions.
  2. While the area stays above zero, no two dots meet, so all 49 stay distinct and the move can be undone.
  3. At zero area the plane collapses onto a line, and dots that differed only along the crushed direction now coincide.
  4. Once two dots coincide, no later step can tell them apart again. That's why the inverse fails at det = 0. The information is gone.

Variety is how many different things you can tell apart. A many-to-one step makes some of them indistinguishable, and nothing later can split them again. Information is the ability to make distinctions, and this is how it is lost.

Ashby defined variety in An Introduction to Cybernetics (1956) as the number of distinguishable elements, often counted in bits, following Shannon's information theory (1948). Linear algebra's version is the rank-nullity theorem: the dimension of what comes out (the rank) plus the dimension of what gets crushed to zero (the null space) equals the dimension you started with.

Lossy compression (JPEG and MP3 throw away what your senses miss), hashing, summary statistics, and privacy, where aggregation loses who is who on purpose.

An average, a grade, a dashboard number, a one-line summary: each collapses many situations into one reading. From a class average you can't get any one student's score back. That's fine, as long as you chose what to lose. A gauge is a deliberate collapse.

Ashby counts variety, and every many-to-one step reduces it. A regulator is a machine built to reduce variety on purpose, at the outcome, while keeping enough variety inside itself to do so. Models 7 and 8 show how.

A class average is 80. Can you tell who scored what? What would you need to keep to be able to?

answer

No: the average is many-to-one. You'd have to keep every score, which means as much variety as the class has.

notes

5 · The dot product, and a neuron

3Blue1Brown chapter 9. Drag the weight arrow and set the threshold. The neuron fires on one side of the line.

Derive it

  1. A neuron turns two inputs into one number. That's a transformation from the plane to a line, a 1×2 matrix [w₁ w₂].
  2. Model 1's recipe: (x₁, x₂) → x₁·w₁ + x₂·w₂. That's the dot product, w·x.
  3. In the picture, it's the signed length of x's shadow on w's line (negative when it falls behind), times the length of w: |w||x| cos(angle). Same arrow, same direction: big. At right angles: zero. Opposite: negative.
  4. Fire when w·x > θ. The boundary w·x = θ is a straight line at right angles to w, so one neuron can only draw one straight line.

Why XOR can't be done

Firing means w·x > θ. (0, 0) must not fire, so 0 ≤ θ. (1, 0) and (0, 1) must fire, so w₁ > θ and w₂ > θ, which adds to w₁ + w₂ > 2θ ≥ θ. But (1, 1) must not fire, so w₁ + w₂ ≤ θ. Both can't hold.

Try

Press XOR, then try to place the line so that only (1, 0) and (0, 1) fire. You can't. That one fact became the most famous argument about what a single neuron can't do.

The dot product asks how much one arrow points along another. A neuron asks the same question about its input and its weights, then decides: past the threshold it fires, otherwise it doesn't. The line where it changes its mind is a distinction drawn across the plane.

The dot product, in the notation we use, comes from Gibbs and Heaviside's vector analysis (1880s); Grassmann and Hamilton had it in other forms. McCulloch and Pitts (1943, the same year as the Rosenblueth, Wiener and Bigelow paper) showed that units like this, with weighted inputs and a threshold, can compute logic. Rosenblatt's perceptron (1958) learned the weights from examples. Minsky and Papert's Perceptrons (1969) proved hard limits on single-layer networks (XOR is the simplest case, parity the general one), and funding and interest moved elsewhere for a time; how much the book caused that is still argued. Backpropagation, invented several times and made widely known by Rumelhart, Hinton and Williams (1986), trained multi-layer networks past the limit.

Every neuron in every network. Search by meaning: two pieces of text become vectors, and the dot product of the two, scaled to length 1 (cosine similarity), says how alike they are. Recommendation systems and spam filters work the same way.

A weighted decision. Score a job offer: salary counts heavily, commute somewhat, title a little. That's a dot product of weights with features, and the threshold is where you'd say yes. A course grade with weighted categories is one too.

The 1943 neuron is where cybernetics and computing share a root. McCulloch went on to chair the Macy conferences. A single neuron draws one distinction, a straight line. Spencer-Brown's Laws of Form begins from the same act: draw a distinction.

Weights (1, 1), threshold 1.5. Which of the four corners fire? What logic is that?

answer

Only (1, 1), because 1 + 1 = 2 is past 1.5. That's AND. Lower the threshold to 0.5 and you get OR.

notes

6 · Change of basis: same arrow, two standpoints

3Blue1Brown chapter 13. Drag b₁ and b₂: they're someone else's basis, described in yours. Drag v. The arrow doesn't move, only its description does.

Derive it

  1. Write her basis vectors, in your coordinates, as the columns of P.
  2. Her coordinates (c₁, c₂) mean c₁·b₁ + c₂·b₂, model 1's recipe, which is P·c. So P translates her description into yours.
  3. Going the other way undoes P: her coordinates are P⁻¹·v. That only works if det P ≠ 0 (model 3): her two arrows must not lie on one line.
  4. To apply your transformation A to something she describes: translate in (P), act (A), translate back (P⁻¹). That's P⁻¹AP, and you never have to memorize the order, because you read it right to left as three steps.
  5. Choose her basis to be A's eigenvectors (model 9) and P⁻¹AP comes out diagonal: in that standpoint, A only stretches. Try the second preset.

The arrow is one thing, and its coordinates are a description that depends on who is describing it. Change the standpoint and the numbers change while the arrow doesn't. To act in someone else's language: translate in, act, translate back. That's P⁻¹AP.

The question of what stays true when the observer's frame changes runs through physics, from Galileo's ship to Einstein's relativity. In linear algebra it became similarity: two matrices that are the same transformation seen from two bases. Segner (1755) and Euler (1758 to 1765) found that every rigid body has principal axes, a basis in which its motion is simplest. That basis is made of eigenvectors.

Maps and GPS convert between coordinate systems constantly. Graphics moves between world, camera and screen space. Principal component analysis turns data onto the axes it varies along most. Diagonalizing (finding the basis where a matrix only stretches) makes repeated application easy, which is model 9's subject.

A recipe in cups when you think in grams: convert in, cook, convert back. Two colleagues describe the same project in different vocabularies, and both are accurate. Before arguing about the numbers, check whose basis they're in.

This is the second-order move in miniature: the description includes the describer. The vector doesn't need an observer, but its coordinates do.

Her basis is b₁ = (2, 1) and b₂ = (−1, 1). She says a point is at (1, 1) in her coordinates. Where is it in yours?

answer

1·(2, 1) + 1·(−1, 1) = (1, 2). Going from hers to yours is model 1's recipe, which means multiplying by P.

notes

7 · Ashby's table

Ashby, An Introduction to Cybernetics (free), chapters 2 and 3. A transformation doesn't have to be a matrix. It can be any table of "this becomes that". Click a state, then click where it should go.

Derive it

  1. Write the table: each state and what it becomes. Ashby calls the drawing a kinematic graph: one arrow out of every state.
  2. Put a token on every state and step. When two occupied states point at the same state, their tokens merge, and variety drops (model 4 again).
  3. Every path ends in a loop, because there are only finitely many states. A loop of length one is a fixed point: a state that becomes itself.
  4. A matrix is the same kind of table for infinitely many states, and linearity lets you write it as just its columns.

A machine is a table of "this state becomes that one". Run it and you see where things end up. Stability is where the arrows lead and stay, not stillness. Every path in a finite table ends in a loop.

Ashby, Design for a Brain (1952) and An Introduction to Cybernetics (1956), where the drawing is called a kinematic graph. The same object shows up as Markov's chains (1906) when the arrows carry probabilities, and as Turing's machines (1936) when a tape is added. Ashby's homeostat (1948) was a physical machine that searched its own table until it found a stable one.

Software state machines: an order goes placed, then paid, then shipped. A user interface's screens. Network protocols. Give the arrows probabilities and you get a Markov chain: Google's original PageRank (Brin and Page, 1998) treated the web as one, and ranked pages by where a random surfer ends up.

Draw your evenings as states: tired, phone, couch, walk, desk, bed. Where do the arrows lead? A loop you keep falling into is an attractor, a habit. Changing one arrow (the phone charges in the kitchen) moves the attractor more cheaply than willpower spent on every state.

Ashby builds equilibrium, stability and adaptation from this one drawing. When arrows merge, variety drops (model 4 again). A regulator chooses its own arrows so the system's paths end in the states it wants.

If every state points to d, what is the variety after one step? What kind of machine is that?

answer

One: everything collapses onto d. It's the most stable machine there is and the most forgetful: after one step nothing about where a token started survives. It isn't regulating anything, though, because nothing is disturbing it.

notes

8 · Requisite variety

An Introduction to Cybernetics, chapter 11, the first step of the reading path. The world picks a disturbance (a row). You pick a response (a column). The cell is the outcome. Your job is to keep outcomes few.

Derive the law by counting

  1. In this table every column holds each outcome exactly once: a response can't make two disturbances come out the same.
  2. So one outcome, say "a", can absorb at most one disturbance per response. With k responses, at most k disturbances end up as "a".
  3. To cover all n disturbances you need at least n ÷ k different outcomes (rounded up).
  4. So outcome variety ≥ disturbance variety ÷ response variety. To hold outcomes to one, you need as many responses as there are disturbances. Ashby's own phrase: only variety in R can force down the variety due to D.

Try

Click one cell in each row to choose your response. With 6 disturbances and 2 responses, you can't get below 3 outcomes, however you play. Then give yourself 6 responses.

To hold outcomes steady against a varied world, you need about as many kinds of response as the world has kinds of disturbance. You can't beat this by being clever, because it's counting, as long as the world itself doesn't absorb some of the variety first (a wall, a buffer, a filter). As Stafford Beer put it, only variety can absorb variety.

Ashby, An Introduction to Cybernetics (1956), chapter 11. He tied it to Shannon's tenth theorem (1948), which says you can only correct noise with a correction channel of enough capacity. Stafford Beer applied it to management from the late 1950s; in Brain of the Firm (1972) the moves are attenuate the variety coming in, amplify the variety going out. Conant and Ashby (1970) argued that the simplest regulator that does best must be a model of what it regulates.

Security (many kinds of attack against a set of defences), operations (runbooks, on-call), support desks, immune systems, thermostats, traffic control, any governor.

When overwhelmed, there are only three moves:

  1. More responses: templates, tools, agents, a second person.
  2. Fewer disturbances: filters, routines, standards, saying no.
  3. Accept more outcome variety where it doesn't matter: let some things be different each time.

An inbox is a disturbance stream. Someone with one response for everything will see everything go wrong.

Playing your best meant picking, for each row, the column that cancels it. That rule is a model of the disturbances, and the best simple regulator has to carry one: that's Conant and Ashby's theorem.

12 kinds of disturbance, 4 kinds of response. How few outcomes could you possibly hold it to?

answer

At least ⌈12 ÷ 4⌉ = 3, whatever you do. Whether you can reach exactly 3 depends on the table; in this page's table you can. To get to 1, you need 12 responses, or a filter that cuts the disturbances to 4.

notes

9 · What stays put: fixed points and eigenvectors

Chapter 14, and Kauffman's EigenForm. Left: a process run on its own output. Right: a matrix applied again and again. Both settle on what the process gives back unchanged, when the slope allows it.

Derive it

  1. A fixed point is where the process gives back its input: x = f(x). On the picture, that's where the curve crosses the line y = x.
  2. The staircase (a cobweb): go up to the curve to get f(x), then across to the diagonal so it becomes the next input. Repeat.
  3. Started close enough, it settles when the curve near the crossing is flatter than the diagonal, which means slope less than 1 in size: |f′(x*)| < 1. Steeper than that, it's pushed away. (This is where the derivative earns its keep.)
  4. For a matrix, a direction that stays on its own line, only scaled by λ (which may shrink it or flip it), is an eigenvector: Av = λv.
  5. Move it all to one side: (A − λI)v = 0. A nonzero v gets crushed to nothing, so A − λI flattens space, so det(A − λI) = 0. That's model 3, reused. Solving it gives λ.

Run a process on its own output and see what comes back unchanged. That's a fixed point. For a matrix, an eigenvector is a direction that stays on its own line, only scaled. Whether it settles depends on one thing: does each pass shrink the difference (slope under 1 in size) or grow it?

The averaging method for square roots is very old (try the √2 option): guess, average the guess with 2 ÷ guess, and repeat. Heron of Alexandria wrote it down in the first century. Babylonian tablets show √2 to six places far earlier, though how the scribes got it isn't recorded, so the old name "Babylonian method" is a tradition, not a fact. The principal axes of a spinning body (Segner 1755, then Euler) were eigenvectors before the word existed. Hilbert (1904) used the German eigen, meaning own. Banach (1922) proved that a map which shrinks every distance by at least a fixed factor below 1 (on a complete space, such as the number line) has exactly one fixed point, and that repeating it from any start finds that point. Von Mises and Pollaczek-Geiringer (1929) described the matrix version you see here, now called power iteration.

PageRank is the main eigenvector of the web's link table, adjusted so the surfer sometimes jumps at random. Vibration modes, such as a bridge's sway or a guitar string's harmonics, are eigenvectors. The long-run state of a well-mixed Markov chain (one that can reach every state and doesn't cycle) is its eigenvector with λ = 1. Principal component analysis, quantum mechanics, and population models all use them.

A microphone near its speaker squeals because the loop gain is over 1: each pass makes the sound louder. Turn it down below 1 and the loop calms. Reputations, habits and moods settle into whatever reproduces itself. Asking "what keeps regenerating this?" is often more useful than asking what caused it.

Von Foerster's essay title, "Objects: tokens for (eigen-)behaviors", names it: what we call a stable thing may be what a process settles on when it keeps acting on its own results. Kauffman's eigenform is that staircase, applied to how an observer sees. A person's steadiness can be read the same way, as a fixed point of their routines.

What is the fixed point of x → x/2 + 1? Does the staircase settle there?

answer

Solve x = x/2 + 1, so x = 2. The slope is ½, under 1 in size, so it settles: each step halves the distance.

notes

The shortcuts

Each row is a formula next to the picture that rebuilds it.

formulathe picture that rebuilds itmodel
A·v = x·col₁ + y·col₂the recipe for v, with the landed basis put in1
AB = A applied to each column of Bdo B and then A: follow where B sends î and ĵ1
3×3: one more columnk̂ is just a third ingredient2
det = ad − bcthe surrounding box minus the corner pieces3
det(AB) = det A · det Bscale factors multiply3
A⁻¹ exists ⇔ det A ≠ 0a flattened space can't be unflattened3, 4
A⁻¹ = (1/det)·[[d, −b], [−c, a]]multiply it by A and you get det·I. Check it rather than recall it3
w·x = w₁x₁ + w₂x₂ = |w||x| cos(angle)a 1×2 matrix: the recipe again, landing on a number line; the shadow of x on w5
one neuron = one straight linew·x = θ is a line at right angles to w; XOR needs two5
yours = P·hers, hers = P⁻¹·yoursher coordinates are a recipe in her basis; P writes her basis in yours6
P⁻¹APread right to left: translate in, act, translate back6
many-to-one ⇒ variety lostdots that land together stay together4, 7
outcomes ≥ disturbances ÷ responseseach response sends at most one disturbance to each outcome8
x* = f(x*); attracts nearby starts if |f′(x*)| < 1the staircase closes in when the curve is flatter than the diagonal9
|loop gain| < 1 calms, > 1 runs awaythe microphone squeal: each pass multiplies the difference9
det(A − λI) = 0an eigenvector gets crushed by A − λI, so it flattens space3, 9

Where I learned this

The math on this page I am learning from Grant Sanderson's 3Blue1Brown: Essence of Linear Algebra first (the chapter numbers above are his), then Essence of Calculus and the series on neural networks. He draws the picture first and lets the formula come out of it, and that is the whole idea here. These models are how I keep what I watched: pictures I can move when a formula slips away.

After 3Blue1Brown I plan to go deeper with Khan Academy, through the lectures and the practice: linear algebra, calculus, and multivariable calculus, which is most of the math under a neural network. The rest of the path, and why I am on it, is the math under the papers.

The history in the lenses is summarized from standard histories of mathematics (the MacTutor archive at St Andrews is a good place to check a date) and from the cybernetics papers themselves. An agent assembled it and a second pass checked each claim against MacTutor and the original texts (Ashby's wording against the 1956 text). Confirm a date before quoting it.