On this page
You build a binary string one bit at a time, or a domino tiling one column at a time. At every step, what you may add next depends only on a little information at the edge: the last bit, or which cells of the next column are already covered. Call that information the state. The transfer matrix method turns this observation into matrix arithmetic, and it hands you the recurrence instead of leaving you to guess one from small cases.
What is the transfer matrix method?
The transfer matrix method is a counting technique that encodes the allowed transitions among finitely many states as a matrix, so that extending an object step by step becomes matrix multiplication (MathWorld, Transfer-Matrix Method). If entry M(i, j) is the number of ways to go from state i to state j in one step, then entry (i, j) of M^n counts the ways to go from i to j in n steps; this is the same as counting walks in a directed graph whose adjacency matrix is M. Because M has a fixed size, the counts satisfy a linear recurrence with constant coefficients.
How do you count binary strings with no two adjacent 1s?
Take the last bit as the state. After a 0 you may write 0 or 1; after a 1 you may only write 0. With rows meaning from 0 and from 1, and columns meaning to 0 and to 1, the transfer matrix is M = [[1, 1], [1, 0]].
The strings of length 1 are 0 and 1, one ending in each state, so start with the row vector (1, 1). Multiply by M once for each extra bit, then add the two entries:
Length 1: (1, 1), total 2.
Length 2: (2, 1), total 3.
Length 3: (3, 2), total 5.
Length 4: (5, 3), total 8.
Length 5: (8, 5), total 13.
These are Fibonacci numbers. The OEIS entry for the Fibonacci sequence records that F(n+2) is the number of binary sequences of length n with no consecutive 0s (OEIS A000045); swapping 0 and 1 gives our count. Check length 3 by hand: 000, 001, 010, 100 and 101.
How many ways can you tile a 3×n board with dominoes?
Fill the board column by column. The state at each cut says which cells of the next column are already covered by horizontal dominoes poking across it. Since a 3×n board has 3n cells and each domino covers 2, only even n have tilings.
So step two columns at a time. Then only two kinds of cut occur: flat (no domino crosses) and jagged (two horizontal dominoes cross, in the top two rows or the bottom two, mirror images counted together). Drawing the cases gives:
flat to flat: 3 ways, the three tilings of a 3×2 block
flat to jagged: 2 ways, one for each mirror image
jagged to flat: 1 way
jagged to jagged: 1 way
With rows meaning from flat and from jagged, the two-column transfer matrix is T = [[3, 2], [1, 1]]. Start at (1, 0), a flat edge, and multiply by T:
3×2: (3, 2)
3×4: (11, 8)
3×6: (41, 30)
3×8: (153, 112)
The tiling must also end flat, so the first entry is the answer: 3, 11, 41 and 153. These match the OEIS sequence for domino packings of 3×2(n−1) rectangles, which lists the recurrence a(n) = 4a(n−1) − a(n−2) (OEIS A001835). The 4 is the trace of T and the 1 is its determinant, so the recurrence comes straight from the characteristic polynomial λ² − 4λ + 1, as the Cayley–Hamilton theorem says it must.
Why does the largest eigenvalue give the growth rate?
If you diagonalise the matrix, M^n becomes a sum of terms of the form constant × λ^n, one for each eigenvalue (our guide to finding large powers of a matrix by diagonalisation shows the steps). As n grows, the term with the largest eigenvalue swamps the rest. For matrices with non-negative entries, the Perron–Frobenius theorem explains when that largest eigenvalue is real, positive and alone at the top.
Strings: λ² − λ − 1 = 0 gives λ = (1 + √5)/2, about 1.618, the golden ratio. For long strings, each extra bit multiplies the count by close to 1.618.
Tilings: λ² − 4λ + 1 = 0 gives λ = 2 + √3, about 3.732 per two columns. OEIS lists 2 + √3 as the limit of the ratio of consecutive terms (OEIS A001835), and 153/41 is already 3.7317.
If eigenvalues still feel abstract, start with what the eigenvalues of a 2x2 matrix mean.
How do you set up a transfer matrix for a new problem?
Name the states: the smallest boundary information that decides what can come next.
Fill the matrix by drawing every one-step case from each state. Count, do not guess.
Choose a start vector and an end condition, then compute n = 1, 2, 3 and compare with a brute-force list.
Find the characteristic polynomial. It gives the recurrence and, through its largest root, the growth rate.
For wider boards the same idea scales up; David Klarner and Jordan Pollack's paper Domino tilings of rectangles with fixed width90098-9) (Discrete Mathematics, 1980) is a place to read further.
Matrix multiplication, eigenvalues and linear recurrences each have their own lesson in the Fermi Concept Library. To practise, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.
Try it next on strings with no three consecutive 1s: three states, a 3×3 matrix, and a growth rate you can now predict.



