<s>[INST] closed form for this recurrence I am having trouble figuring out if the following recurrence has a closed form:
$$f(n)=2f(n-1)+(n-1)2^{n-2}$$
I have never really done such problems, so I dont know what is a good strategy. I will appreciate any hints!
Edit: $f$ is defined for $n\geq 1$ and $f(1)=0$.
 [/INST] I was thinking on using the Z-transform here:
$$ f(n) = 2f(n-1) + (n-1)2^{n-2} $$
using $f(n) = x_n$ and $ f(n-1) = x_{n-1}$ we get:
$$ x_n = 2x_{n-1}+n\frac{2^n}{4}-\frac{2^n}{4} $$
Taking the transform on both sides:
$$ X(z) = 2(z^{-1}X(z)+x_{-1}) + \frac{2z}{4(z-2)^2}-\frac{z}{4(z-2)} $$
$$ X(z) = 2(z^{-1}X(z)+\frac{1}{8}) + \frac{2z}{4(z-2)^2}-\frac{z}{4(z-2)} $$
$$ X(z)(1-\frac{2}{z}) = \frac{2z-z(z-2)}{4(z-2)^2} + \frac{1}{4}$$
$$ X(z) = \frac{z^2(4-z)}{4(z-2)^3} + \frac{z}{4(z-2)}$$
Taking the inverse Z transform we get a result:
$$ x_n = n(n-1)2^{n-3} $$
</s>