Problem : Write the recurrence relation for the sequence $\left( a _ { 0 } , a _ { 1 } , \ldots \right)$ where $a _ { n }$ is the number of ways we can climb $n$ stairs so that in each step we climb 1 or 3 stairs. Write the generating function for this sequence.
Solution : The recurrence relation is $a_{n+3} = a_{n+2} + a_n$. The sequence we obtain as $\left( c _ { n } \right) -$ $\left( b _ { n } \right) - \left( a _ { n } \right) ,$ where $\left( c _ { n } \right)$ is $\left( a _ { n } \right)$ shifted to the right by $3 ,$ and $\left( b _ { n } \right)$ is $\left( a _ { n } \right)$ shifted to the right by 1 is $( - 1,0,0,0 , \ldots )$. Thus, $x ^ { 3 } F ( x ) - x ^ { 2 } F ( x ) - F ( x ) = - 1 ,$ and hence, $F ( x ) = \frac { 1 } { 1 - x ^ { 2 } - x ^ { 3 } }$
I don't seem to understand why $c_n$ is $a_n$ shifted to the right by 3, and $b_n$ is $a_n$ shifted to the right by 1. Furthermore I don't understand why the sequence would be $( - 1,0,0,0 , \ldots )$.
We can write the recurrence relation as $$ a_n=a_{n-1}+a_{n-3}\quad (a_0=1, a_1=1,a_2=1) $$ for $n\geq 3$. We can make the change of index $n\to n+3$ to rewrite the recurrence relation as $$ a_{n+3}=a_{n+2}+a_n\quad (n\ge 0).\tag{1} $$ At this point multiply both sides of (1) by $x^n$ and sum on $n\geq 0$ (where we put $A(x)=\sum_{n=0}^\infty a_n x^n$ to get that $$ \frac{A(x)-a_0-a_1x-a_2x^2}{x^3}=\frac{A(x)-a_0-a_1x}{x^2}+A(x) $$ Solve for $A(x)$ to get that $$ A(x)=\frac{1}{1-x-x^3}. $$ Note that this answer makes sense the problem is equivalent to the number of ways to write $n$ as an ordered sum of ones and threes and this formulation is also apparent from writing $$ A(x)=\frac{1}{1-(x+x^3)}=\sum_{m=0}^\infty (x+x^3)^m. $$ and taking the coefficient of $x^n$ of the RHS.