The recursive sequence $a_n$ has the following generating function
$$\begin{align} &f(x)={\frac{x}{1-2x}+{\frac{4}{1+3x}}} \end{align}$$
I am to find $a_0$ and $a_1$:
Rule: ${\frac{1}{1-a}}=1+a+a^2+a^3+...+a^n$
So we have
${\frac{1}{1-2x}}=1+2x+4x^2+8x^3+...+2^{n-1}x^{n-1}+2^nx^n$
${\frac{1}{1+3x}}=1-3x+9x^2-27x^3+...+(-3)^{n-1}x^{n-1}+(-3)^nx^n$
Thus,
$$\begin{align} &f(x)={\frac{x}{1-2x}+{\frac{4}{1+3x}}}\\ &f(x)= x(1+2x+4x^2+8x^3+...) + 4(1-3x+9x^2-27x^3+...)\\ &f(x)= x+2x^2+4x^3+8x^4+... + 4-12x+36x^2-108x^3+... \end{align}$$
For $a_0$ we have: $x+4=0+4=4$ , but when I try to calculate $a_1$ I get the wrong answer. The right answer should be $a_1=-11$, but I get
$$\begin{align} &a_1=x+2x^2+4-12x=1+2+4-12=-5 \end{align}$$
What am I doing wrong? What is the correct way to find $a_1$?
\begin{align}f(x) &= x+2x^2 + 4x^3+ \dots + 4 - 12 x + 36 x^2 - 108x^3 + \dots \\&= 4-11x+38x^2-104x^3+\dots\\&=a_0+a_1x+a_2x^2+a_3x^3+\dots\end{align}
where the last line is precisely the definition of a generating function. There is no need to substitute any values of $x$.
Alternatively we have $a_n = \dfrac {f^{(n)}(0)}{n!}$, where $f^{(n)}(x)$ is the $n$th derivative. This might be useful for some other $f$.