# Nonhomogeneous difference equation

Let $x(n+1)-f(n)x(n)=g(n)$ and $f(n)\not=0$

I would like to show that the solution of the 1-order homogeneous equation $g=0$ is given by

$x_h(n):= \begin{cases} x(0)*\prod_{j=0}^{n-1}f(j) & \; n>0 \\ \;\;\,1 & \; n=0 \\ x(0)*\prod_{j=n}^{-1}f(j)^{-1}& \; n<0 \\ \end{cases}$

but I have never seen such an eqaution before, may you could help me with it.

Edit: Is there are way to use a guess with variation of constants to show that the solution is given by

$x_(n):=x_h(n)+ \begin{cases} x_h(n)*\sum_{j=0}^{n-1}\frac{g(j)}{x_h(j+1)} & \; n>0 \\ \;\;\,0 & \; n=0 \\ -x_h(n)\sum_{j=n}^{-1}\frac{g(j)}{x_h(j+1)}& \; n<0 \\ \end{cases}$

-
In the second part of the question, the formulas you have written don't make sense, as $x_h(n)$ appears on both sides. Perhaps it's meant to be $x_h(0)$, or $x(0)$ (and maybe the subscript $h$ should be gone, since I take it that $h$ stands for homogeneous). Also, it should be easy enough to plug your purported solution back into the recurrence to see whether it works, right? –  Gerry Myerson Dec 11 '12 at 22:46
I edited my post. –  Voyage Dec 11 '12 at 22:47
Good. Now, check to see whether it gives you the right answer for, say, $x(1)$ and $x(2)$. –  Gerry Myerson Dec 11 '12 at 22:51
To check that the solutions fits in my equation at the beginning is clear. I would be interesting in deriving this formula using a variation of constants ansatz (guess) –  Voyage Dec 11 '12 at 22:57