Blog

A Forest of Diagonals: Slant and the Mathematics of Trees

November 5, 20266 min readBen Miller

In 1845, a German student named Gustav Kirchhoff was staring at a tangle of wires. He had already worked out the two simple laws that still carry his name: current flowing into a junction must flow out again, and the voltages around any closed loop must add up to zero. The trouble was the loops. A messy circuit has loads of them, and it isn't obvious which ones you actually need to check.

His answer, published in 1847, was wonderfully tidy. Pick out a set of wires that connects every junction but contains no loop at all. Mathematicians now call that a spanning tree. Every wire you left out then closes exactly one loop when you put it back, and those loops are the only ones you need. The tree is the skeleton. Everything else is a single extra bone.

Our puzzle Slant is built on that same skeleton, though it took us a while to notice.

One line per cell, and no circles

The rules of Slant are short. Every cell gets a diagonal line, either a forward slash (/) or a backslash (\). No cell is left empty. Some of the grid intersections, the points where four cells meet, carry a number, and that number tells you how many of the surrounding diagonals touch that point. Finally, the diagonals must never form a closed loop.

The number clues are local. They only care about the four cells around one point. The no-loop rule is global. A loop can snake across half the board, and the cell that closes it might be nowhere near the cells that started it. Most of the fun in Slant comes from those two kinds of rule pulling against each other.

Here's the mathematician's way to see a finished board. Treat every intersection as a dot and every diagonal as a line joining a pair of dots. A network of dots and lines with no loops has a name: a forest. Each separate connected piece of it is a tree. The word was put to mathematical use by Arthur Cayley in the 1850s, and it stuck because the pictures really do look like branches. So every solved Slant board is, quite literally, a forest of diagonals.

Two networks that never touch

Colour the intersections of the grid like a chessboard: a point is "even" if its row number plus its column number is even, and "odd" otherwise. Now look at a single cell. Its four corners alternate even, odd, even, odd as you walk around it. A diagonal joins two opposite corners, and opposite corners always share a colour.

That means every diagonal joins two points of the same colour. A Slant board isn't one network. It's two, woven through each other like the threads of a basket, and they never share a single point. A backslash in one cell feeds the even network, say, and a backslash in the cell next door feeds the odd one.

This is more than a curiosity. Imagine the even network closes a loop. Whatever lies inside that loop is cut off from the edge of the board, including some odd points, which are now trapped inside. That picture is what makes loops easy to spot with practice: a loop is a fence, and you start to feel when a fence is about to close.

The arithmetic of a forest

Trees obey one beautifully simple law: a tree with k points always has exactly k - 1 lines. Two points need one line to connect them. Three points need two. Add a point and you add a line to reach it. Add a line without a new point, and you've joined two points that were already connected, which closes a loop. That is Kirchhoff's "one extra bone" again.

Put that law to work on a whole board. A 5x5 Slant grid has 25 cells, so 25 diagonals, and it has 6 x 6 = 36 intersection points. If the finished board has no loops, every piece is a tree, and each tree has one fewer line than points. So the number of separate trees is 36 - 25 = 11, every time, for every solved 5x5 board. (A point that no diagonal touches counts as a tiny tree of one.) The puzzle changes, the clues change, the forest's shape changes, but the count of trees never does.

Cayley later counted trees in a different way. In 1889 he published the result now known as Cayley's formula: there are n to the power n - 2 different trees that connect n labelled points. With 3 points there are 3 trees. With 4 points there are 16. With 10 points there are a hundred million. Trees are simple, but there are a staggering number of them, which is exactly why a Slant puzzle needs clues to pin down just one.

Solving with the forest in mind

The number clues give you your opening moves, and the edges are where they bite hardest. A corner point borders only one cell, so a 1 there means that cell's diagonal points into the corner, and a 0 means it points away. An edge point has two cells, so a 0 or a 2 on the edge settles both at once. Inside the grid, a 4 means all four diagonals point straight at the clue. Start there, every time.

After that, the forest does the heavy lifting. Our tip sheet puts it simply: if both diagonal orientations satisfy the number clues but one creates a loop, choose the other. The trick is spotting the danger early. Whenever you place a line, ask whether its two ends already belong to the same tree. If you can trace a path from one end to the other through lines you've already drawn, then that diagonal would be the extra bone, and the cell must take the other slant.

A good habit is to follow the long branches. Short stubs near the edge rarely cause trouble, but a big tree winding through the middle has lots of points that are already connected to each other, and every one of them is a loop waiting to happen. Those are the cells where the no-loop rule hands you free answers.

Seeing the skeleton

Kirchhoff's insight was that a tangled system becomes manageable once you find the part with no redundancy in it. Families, road maps, the folders on your computer and the chain of who-told-whom in a piece of gossip all have the same shape: branches without circles. When something gets confusing, it can help to ask which connections are the skeleton and which one is the extra line that turns a path into a loop.

Slant lets you practise that question one cell at a time. Fill in a line, check your branches, and watch the forest grow.

← Back to Blog