Hi, I'm Matt

Profile photo
Resume · GitHub · LinkedIn ·
copied to clipboard

Second-year Applied Mathematics & Computer Engineering student at Queen's University. Interested in mathematics, AI engineering, and data work.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra, est eros bibendum elit, nec luctus magna felis sollicitudin mauris. Integer in mauris eu nibh euismod gravida.

Some puzzles I think are cool (click the titles to learn more)

Lights Out

moves: 0

Lights Out

Lights Out was released by Tiger Electronics in 1995 as a handheld electronic game. The premise is simple: you have a grid of lights, some on and some off. Pressing any light toggles it and its four direct neighbours. Your goal is to turn every light off.

What makes the game mathematically fascinating is that it can be completely analysed using linear algebra over the field GF(2) — the field with just two elements, 0 and 1. Every puzzle is either solvable or not, and the answer depends on the null space of the toggle matrix.

The Math

Number each cell 1 through n. Define the toggle matrix A over GF(2):

Aij = 1 if pressing cell j toggles cell i, else 0

A board state is a vector b ∈ GF(2)n where bi = 1 means light i is on. We want to find a move vector x such that:

Ax = b  (mod 2)

This is a system of linear equations over GF(2). The puzzle is solvable if and only if b lies in the column space of A — equivalently, b is orthogonal to every vector in the null space of AT.

For the standard 5×5 board, the null space of A has dimension 2, meaning there are exactly 4 equivalence classes of solutions. Not every configuration is solvable — roughly 25% of random states are unreachable.

Graph Generalisation

The game generalises naturally to any graph. Replace the grid with an arbitrary network of nodes, and pressing a node toggles it and all its graph-neighbours. The same linear algebra applies. Try it below — drag to rotate, click a node to toggle.

moves: 0

Mod-K Generalisation

Replace GF(2) with ℤ/Kℤ. Each cell cycles through K states (0, 1, …, K−1), and pressing a cell increments it and its neighbours by 1 modulo K. The solvability condition becomes:

Axb  (mod K)

Gaussian elimination works over ℤ/Kℤ when K is prime. For composite K, Smith normal form gives the complete picture. Try it:

moves: 0

Back From The Klondike

moves: 0

Back From The Klondike

In 1898, puzzle inventor Sam Loyd published a maze in the New York Journal that he claimed was specifically designed to defeat Leonhard Euler's method for solving mazes.

Euler's technique — working backward from the exit — exploits the continuous topology of traditional wall-based mazes. Loyd circumvented this by inventing the jump maze: movement is determined by arithmetic (jump N steps in a direction), not by walls and corridors. Working backward from the border tells you nothing useful, because many interior cells can reach the exit.

The Rules

Start at the heart in the center (value 3). Each cell shows a number — that's how many steps you must jump in a straight line, in any of 8 compass directions (N, NE, E, SE, S, SW, W, NW). You win by landing exactly on a border cell.

The Artist's Error

In 1976, two graduate students at the University of Washington wrote a Fortran program to solve Loyd's puzzle and discovered hundreds of possible solutions. All solutions converged through a particular cell that wasn't part of Loyd's published answer — suggesting an artist's error in the original drawing. When one cell is corrected (from 2 to 1), the puzzle has a unique solution.

The Math

The puzzle creates an implicit directed graph: each numbered cell is a node, and each possible jump creates a directed edge. Finding the solution is a graph traversal problem — but the graph's structure (determined by arithmetic on cell values) makes backward search ineffective. The state space is finite but branching, requiring depth-first exploration.

Loyd's puzzle is one of the earliest examples of a problem designed to be computationally resistant — 75 years before computers were used to crack it.

Peg Solitaire

moves: 0 · pegs: 32

Peg Solitaire

The game first appears at the court of Louis XIV around 1697 — a German engraving from that era depicts a princess playing alone on the cross-shaped board. The English variant uses 33 holes in a plus shape. Start with 32 pegs (center empty), jump pegs over each other to remove them, and try to finish with a single peg — ideally back in the center.

Position Classes

Label each cell with the pair (row mod 3, col mod 3). Every legal jump — moving a peg two cells in a cardinal direction — has a predictable effect on the counts of pegs in each class. Some quantities are invariants: they never change regardless of how you play.

From the standard starting position, these invariants constrain the final peg to exactly 5 possible cells out of 33. The center is one of them — which is why "finish in the center" is the classic challenge.

Conway's Soldiers & The Pagoda Function

John Conway posed a beautiful variant: fill every cell below a horizontal line with pegs. How far above the line can you advance a single peg?

The answer is exactly 4 rows — never 5. The proof uses a weighting scheme Conway called the pagoda function, built from the golden ratio φ = (1+√5)/2.

Assign each cell a weight φ−d, where d is its distance from the target row. The magic of φ: since φ² = φ + 1, every legal jump either preserves or decreases the total weight. The starting configuration's total weight is finite — and reaching row 5 would require more weight than you began with. The golden ratio is the unique constant that makes this argument work.

Try it yourself — advance a peg as high as you can. The pagoda value tracks your budget. You need ≥ 1.00 to reach the top row, but you start with less.

drop some wisdom