1. Make every tile white
- A white tile is solved.
- Colored tiles are not wrong. They just need to keep advancing until they return to white.
- The puzzle ends only when every tile is white at the same time.
A modular tile puzzle
Campaign
Custom Level
Playground
Daily
Campaign
Guide
Clear every tile by turning it white. Tapping a tile applies its tap pattern to the board, and every tile reached by that tap advances by one state.
Use previews and level clues to plan calmly before each tap.
Modes
Guide
Invert the Matrix is a modular linear-algebra puzzle.
To play, think of each tile as having a state, shown by its color. A tap on a tile does not change only that tile, but every tile in a pattern centered on the chosen tile. After the last state, or color, a tile returns to white. The goal is to find a sequence of taps that makes all tiles white at the same time. Some boards have only two possible states: white and blue, and only one pattern: a cross centered on the tile you tap. But later on, everything gets much more complicated.
Modeling the game
To model a level, first list the active board positions in a fixed order. Once that list is fixed, a displayed board becomes a vector \(s\in R^m\). Here \(R=\mathbb Z/n\mathbb Z\) means values are read modulo \(n\), \(n\) is the number of tile states, and \(m\) is the number of active positions.
Each allowed tap has an effect vector in \(R^m\). For a tappable position \(q_j\), the vector \(v_j\) has value \(1\) exactly at the active positions advanced by that tap, and \(0\) elsewhere. The matrix \(A\) is built by placing these effect vectors as its columns. A tap-count vector \(x\in R^r\) records how many times each allowed tap is used, modulo \(n\), and solving means choosing \(x\) with \(s+Ax=0\).
All arithmetic is performed modulo \(n\), so the value after \(n-1\) is \(0\). Prime state counts such as \(2,3,\) and \(5\) give finite fields, where every value different from \(0\) has a multiplicative inverse. The four-state mode uses the ring \(\mathbb Z/4\mathbb Z\), where some values different from \(0\) cannot be used for division.
From Lights Out
In ordinary Lights Out, every tile is either \(0\) or \(1\). Tapping a tile changes the same shape of tiles around it every time, usually the tapped tile plus the tiles directly above, below, left, and right. Changing a tile is adding \(1\) modulo \(2\), so tapping the same tile twice gives no net change. This is the simplest version of adding tap effects together.
This game keeps that add-the-effects rule while allowing \(n\) states, so values are read in \(R=\mathbb Z/n\mathbb Z\). Empty holes are not included in the board vector. Tiles with lock icons stay in the board vector because they must become white, but they do not get tap choices. Tap patterns determine the columns of \(A\).
The mathematical question is precise: can the allowed taps add up to the target change \(-s\)?
Let \(P=\{p_1,\ldots,p_m\}\) be the list of active board positions, in a fixed order. A configuration is the vector \(s=(s_1,\ldots,s_m)\in R^m\), where \(s_i\) is the state value shown on tile \(p_i\), read modulo \(n\). The solved board is the zero vector \(0\in R^m\).
Let \(q_1,\ldots,q_r\) be the positions that can be tapped. The effect vector of the tap at \(q_j\) is \(v_j\in R^m\). Its \(i\)-th value is \(1\) when that tap advances tile \(p_i\), and \(0\) otherwise. The tap matrix is \(A=[v_1\ \cdots\ v_r]\), so the \(j\)-th column of \(A\) is \(v_j\).
In the matrix, a row tracks a board position and a column tracks an allowed tap. A tile with a lock icon still gets a row because its value must become zero, and nearby taps may change it. It does not get a column because it cannot be tapped directly.
Goal
A tap-count vector is an element \(x=(x_1,\ldots,x_r)\in R^r\). Its coordinate \(x_j\) counts how many times the tap at \(q_j\) is used, modulo \(n\). Executing \(x\) adds \(\sum_j x_jv_j=Ax\) to the board. Thus tap order is irrelevant to the algebra. Only each tap count modulo \(n\) matters.
After applying the plan, the board is \(s+Ax\). Solving the puzzle means making this vector equal to the zero vector, equivalently solving \(Ax\equiv -s\pmod n\).
The columns of \(A\) generate the set of all board changes obtainable by allowed taps. Call this set the image of \(A\), written \(\operatorname{Im}(A)=\{Ax:x\in R^r\}\). A solution exists exactly when the target vector \(-s\) is in that set.
Over a field, such as \(\mathbb F_2,\mathbb F_3,\mathbb F_5\), this can be checked by simplifying the rows of the system \([A\mid -s]\). A row of the form \([0\ \cdots\ 0\mid c]\), where \(c\) is not \(0\), proves that no solution exists. If no such row appears, the simplified system gives at least one tap plan.
For composite \(n\), \(\mathbb Z/n\mathbb Z\) is a ring but not a field. You may add and multiply as usual, but division is valid only by values with a multiplicative inverse. For \(n=4\), the value \(2\) is different from \(0\) and has no inverse: no value \(a\) satisfies \(2a\equiv 1\pmod 4\).
The rule does not change: there is still a solution exactly when \(-s\) is in \(\operatorname{Im}(A)\), but the check must respect ring arithmetic. Row operations that divide by values with no inverse are not valid. For larger composite \(n\), the check can be split into smaller modulo checks that must all agree.
If \(x_0\) is one solution, then every other solution is \(x_0+z\), where \(z\in R^r\) is a tap-count vector with \(Az=0\). The equation \(Az=0\) means that using the taps in \(z\) causes no net change on the board. The set of all such \(z\) is the kernel of the tap matrix, written \(\ker(A)\).
Tap counts already live modulo \(n\), so tapping one tile \(n\) additional times adds \(n e_j=0\), the zero vector in \(R^r\). That represents the same tap-count vector, not a new tap-count solution.
Uniqueness fails exactly when there is a tap-count vector \(z\ne 0\), meaning \(z\) is not the zero vector, with \(Az=0\). In that case \(x_0\) and \(x_0+z\) are distinct tap-count vectors that solve the same board. Thus the solution as a tap-count vector is unique precisely when \(\ker(A)=\{0\}\). Over fields this is equivalent to saying that no combination using at least one allowed tap adds the effect vectors to zero. Over rings, the same kernel condition is the correct statement over \(\mathbb Z/n\mathbb Z\).
A true inverse matrix can exist only when \(A\) is square, meaning it has the same number of rows and columns. This happens on a \(w\times h\) board with no tiles with lock icons and no empty holes, when there is exactly one allowed tap for each tile. In that case \(A\) sends vectors in \(R^{wh}\) to vectors in \(R^{wh}\), and invertibility means every starting board has one unique tap-count solution.
Equivalently, \(\det A\) must have a multiplicative inverse modulo \(n\). For prime state counts \(n=2,3,5\), this means \(\det A\not\equiv0\pmod n\). Equivalently, simplifying rows can choose a value different from \(0\) in every column. For \(n=4\), it means \(\det A\) is odd. If this fails in the square case, some board vectors are unreachable and some tap-count vectors different from zero lie in \(\ker(A)\). With tiles with lock icons or empty holes, \(A\) may have different numbers of rows and columns. Then the useful tests are whether the target change is reachable and whether \(\ker(A)\) contains tap-count vectors different from zero.
If there are several tap-count solutions, the game can still ask for the most efficient one. For each tap count \(x_j\in R\), choose the number \(\tilde{x}_j\in\{0,\ldots,n-1\}\) that represents it. The physical length of a plan is \(\ell(x)=\sum_j\tilde{x}_j\), and the star target is based on a solution with minimal length among the solutions found.
For small boards the app searches by tap count: first boards one tap away, then two taps away, and so on. The first time it reaches the zero board, that number is the true minimum number of physical taps.
For larger boards with prime state counts \(n=2,3,5\), it simplifies the rows of \(Ax=-s\). If the simplified system leaves choices that are not forced, the solutions are \(x_0+\ker(A)\). When the search over those extra tap-count vectors is small enough, the app enumerates them and chooses the one minimizing \(\ell(x)\). If that exact search is too large, or \(n\) is composite and the board is too large for that search, the game falls back to a known solving plan instead of claiming a proof of minimality.
The shortest tap-count vector is not necessarily unique. Distinct solutions can tie for the same \(\ell(x)\), and a single vector can be played in many tap orders. The app keeps the same shortest plan every time when it can prove the minimum. It does not currently mark whether all shortest plans are unique.
A tile with a lock icon stays in the board vector because its value must become zero, and nearby taps may still change it. It does not get its own tap choice in \(x\) because it cannot be tapped directly. An empty hole is left out of the ordered list \(P\), so the equation only tracks active board positions. This is how the same equation adapts to irregular boards.
The generator uses the same ingredients: board shape, tiles with lock icons, empty holes, tap pattern, and effect vectors. It chooses or verifies a starting vector \(s\) together with a tap-count vector \(x\) satisfying \(s+Ax=0\). When the exact solver is available, it searches the solution set for a short tap-count vector so the star thresholds have a mathematical basis. Hints use a stored plan one tap at a time.
Options
About
Complete
Tap Pattern
When you tap a tile, this pattern is centered on that tile. Every tile inside the pattern changes state.
The green outline matches the preview you see when you hold a tile.