I would like to know more about constructing generating functions for certain type of sequences defined differently over certain ranges of $n$, and would appreciate any references.
For example, if there is a sequence:
$a_{n+1} = 3a_n$, the standard trick is to multiply both sides by $x^n$, and sum over all valid values of $n$.
However, I would like to know if there are any methods to find a generating function for something like: $ a_{n+1} = \left\{ \begin{array}{r l} 3a_n & n \leq K \\ 0 & n > K \end{array}\right. $ for some constant $K$. Or for example, $ a_{n+1} = \left\{ \begin{array}{r l} \frac{1}{n+1}a_n & n \leq K \\ K_1 & n > K \end{array}\right. $
To be more specific, are there any methods for problems like $ a_{n+1} = \left\{ \begin{array}{r l} f_1(n) a_n & n \leq K_1 \\ f_2(n) a_n & K_1 < n \leq K_2 \\ \vdots \end{array}\right. $ ?
Thanks!
A fantastic reference for this is Generatingfunctionology by Wilf.
In the first case, start with the generating function for $a_n$, $A(x)$. Then, the generating function for $3 a_n$ is $3 A(x)$. Expand it into a series and truncate after $K+1$. Most of the time though, you usually ignore that constant $K$ while doing the counting via generating functions, and then at the end look at coefficients in the generating function which give valid results.