Esta lección aún no está traducida. Por ahora se muestra en inglés; la versión en español está en camino.
In algebra you met recursive formulas given to you. Here you build them. Many counting problems are hard to attack head-on but easy once you notice that a big object is a small object with one more piece. That is the sum rule again, and strong induction is what makes the recurrence trustworthy.
🔑 Idea clave
To set up a recurrence for $a_{n}$, split the objects of size $n$ by how they end (their last piece). Each case should leave a smaller object of the same kind, counted by an earlier term. Add the cases, and state enough starting values for the recurrence to run.
💡 Por qué funciona
Take tilings of a 1-by-$n$ strip with squares and dominoes. The last tile is either a square, leaving a strip of length $n - 1$ tiled in any of $a_{n-1}$ ways, or a domino, leaving length $n - 2$ in $a_{n-2}$ ways. These cases cannot overlap and cover everything, so $a_{n} = a_{n-1} + a_{n-2}$. Since the recurrence reaches back two steps, it needs two starting values: $a_{1} = 1$ and $a_{2} = 2$.
Every tiling sorted by its last tile. Each group is a complete list of smaller tilings, so the counts add: $a_{n} = a_{n-1} + a_{n-2}$. Move the slider to grow $n$.
Worked examples
✏️ Ejemplo resuelto: Tilings
How many ways are there to tile a 1-by-$6$ strip with squares and dominoes?
Disks of $n$ sizes sit on a peg, largest at the bottom. Move them to another peg, one at a time, never putting a disk on a smaller one. Find a recurrence for the fewest moves $h_{n}$.
The largest disk must move at some point, and when it does, the other $n - 1$ disks must all be on the third peg.
So: move $n - 1$ disks out of the way ($h_{n-1}$ moves), move the largest ($1$), then move the $n - 1$ disks on top of it ($h_{n-1}$).
The Tower of Hanoi: step through the best solution and watch the three phases.
⚠️ Error común
Missing a way the pattern can end, or forgetting starting values. Counting only tilings that end in a square gives $a_{n} = a_{n-1}$, which says every length has just one tiling. And $a_{n} = a_{n-1} + a_{n-2}$ alone does not determine a sequence: with $a_{1} = 2$, $a_{2} = 3$ you get the bit strings, not the tilings. Check: list all cases for small $n$ by hand and make sure the recurrence reproduces them.
Práctica
Apruebas con 3 respuestas correctas, las 2 últimas seguidas. Cada respuesta correcta da 2 XP.
Oscar Levin, Discrete Mathematics: An Open Introduction (3rd ed.), sections "Definitions" (recursive definitions of sequences) and "Solving Recurrence Relations"
MIT OpenCourseWare 6.042J Mathematics for Computer Science (Lehman, Leighton and Meyer), chapter "Recurrences" (the Towers of Hanoi)