Recurrence relation and closed formula I have the following problem:
I must find the closed formula for $$a_n = b_n + \lambda_1 a_{n-1} + \lambda_2 a_{n-2}$$ where  $$b_n = \frac{\Gamma(n+d)}{\Gamma(d)\Gamma(n+1)}, \quad d \in \mathbb{R}.
$$
I don't have any experience in recurrence relations or discrete math, I'm trying to find some book recommendations to study this. I know that recurrences like $$a_n = \lambda_1 a_{n-1} + \lambda_2 a_{n-2}$$ have closed formulas, but I'm stuck with the $b_n$ term.
In a more general way, I'm searching a closed formula for a relation like $$a_n = b_n + \sum_{i=1}^p \lambda_i a_{n-i}.$$
If any condition is not clear, please tell me so I can adjust it. Thanks!
 A: The way people generally solve problems of this type is through using generating functions.  The seminal reference for this is Wilf's Generatingfunctionology.
The basic idea is you turn the series $a_n$ you are looking for into a power series in an ancillary variable and look for a relation involving that power series.
In this particular case, the easiest way of doing that probably will work: Define $F(x) = \sum a_n x^n$. Define $G(x) = \sum b_n x^n$.  Multiply your recurrence relation by $x^n$ and sum, be careful about the $n=0$ and $n=1$ terms.
We then have $$\sum_{n=2}^\infty a_n x^n = \sum_{n=2}^\infty b_n x^n + \lambda_1 \sum_{n=2}^\infty a_{n-1} x^n + \lambda_2 \sum_{n=2}^\infty a_{n-2} x^n,$$ or $$F(x) - a_0 - a_1 x = (G(x) - b_0 - b_1 x) + \lambda_1 x(F(x) - a_0) + \lambda_2 x^2 F(x).$$
Grouping terms gives $$(1 - \lambda_1 x - \lambda_2 x^2) F(x) = G(x) + (a_0 - b_0) + (a_1 - \lambda_1 a_0 - b_1)x$$ or $$F(x) = (G(x) + (a_0 - b_0) + (a_1 - \lambda_1 a_0 - b_1)x) / (1 - \lambda_1 x - \lambda_2 x^2).$$  You can then use standard tricks to turn $1/(1-\alpha x -\beta x^2)$ into $C/(1+\gamma x) + D/(1+\delta x)$, and turn those into power series in $x$.
All of this will eventually give you the coefficients of $F$ -- the $a_n$ -- in terms of sums of coefficients of $G$ -- the $b_n$ -- and some other terms.
Now, I'm not going to work out the exact answers for you. If I'm not mistaken, G turns into a particular hypergeometric function. You are unlikely to get a "closed form" for the $a_n$, but you can certainly say something about their asymptotic behavior as $n$ gets large.
A: For $$a_n = \lambda\, a_{n-1} + \mu\, a_{n-2}$$ the solution is given by
$$a_n=2^{-n}\big[c_1 \,r_1^n+c_2 \,r_2^n\big]$$ with
$$\color{blue}{r_1=\lambda -\sqrt{\lambda ^2+4 \mu }}\qquad \text{and} \qquad \color{blue}{r_2=\lambda +\sqrt{\lambda ^2+4 \mu }}$$
Now, after looking at the results for the first integer values of $d$, I conjecture that the solution of
$$a_n = \lambda\, a_{n-1} + \mu\, a_{n-2}+\frac{\Gamma(n+d)}{\Gamma(d)\,\Gamma(n+1)}$$is
$$\color{red}{a_n=2^{-n}\big[c_1 \,r_1^n+c_2 \,r_2^n\big]-\frac {\Gamma (n+d+2) } {\mu (r_2-r_1)  \Gamma (d) \Gamma (n+3) }} \times$$ $$\color{red}{\Bigg[r_2 \, _2F_1\left(1,n+d+2;n+3;\frac{2}{r_1}\right)-r_1 \,   _2F_1\left(1,n+d+2;n+3;\frac{2}{r_2}\right)\Bigg]}$$
