prove $x_n(t) =(\prod_{k=0}^{n-1}a(k))y_0+\sum_{k=0}^{n-1}(\prod_{j=k+1}^{n-1}a(j))c(k)$.. Prove the following : Let $a(n)$ and $c(n)$,$n ∈ N$, be real sequences. Then the linear first order difference
equation $x(n + 1) = a(n)x(n) + c(n)$ with initial condition $x(0) = y_0$ has the following solution:
$x_n(t) =(\prod_{k=0}^{n-1}a(k))y_0+\sum_{k=0}^{n-1}(\prod_{j=k+1}^{n-1}a(j))c(k)$..
I've managed to show that $x_H=(t)=(\prod_{k=0}^{n-1}a(k))y_0$ but i couldn't figure how to get the non-homogenous part.
any hint?
 A: We consider the recurrence relation
\begin{align*}
\color{blue}{x_{n+1}}&\color{blue}{=a(n)x_n+c(n)\qquad\qquad n\geq 0}\tag{1}\\
\color{blue}{x_0}&\color{blue}{=y_0}
\end{align*}
where $\left(a(n)\right)_{n\geq 0},\left(c(n)\right)_{n\geq 0}$ are real-valued sequences and the initial value $x_0=y_0$ is given. We do not assume that $x_n=x_n(t), n\geq 0$ is a function of $t$. This is not needed, as it is not part of the right-hand side of OPs solution.

Method: The idea is to simplify the recurrence relation to
\begin{align*}
z_{n+1}&=z_n+d(n)\qquad\qquad n\geq 0
\end{align*}
by multiplication with a convenient factor. This way we get rid of $a(n)$ and it can then be solved easily via telescoping.

We assume $a(n)\ne 0, n\in\mathbb{N}$ and multiply (1) with
\begin{align*}
\color{blue}{A(n+1)}&\color{blue}{=\frac{1}{\prod_{j=0}^n a(j)}\qquad\qquad n\geq 0}\tag{2}\\
\end{align*}
We set $A(0)=1$.

We multiply (1) with $A(n+1)$ and obtain:
\begin{align*}
A(n+1)x_{n+1}&=A(n+1)a(n)x_n+A(n+1)c(n)\\
&=A(n)x_n+A(n+1)c(n)\tag{3}
\end{align*}
From (3) we get by summing up from $k=0,\ldots,n$ and telescoping:
\begin{align*}
\sum_{k=0}^nA(k+1)x_{k+1}&=\sum_{k=0}^nA(k)x_k+\sum_{k=0}^nA(k+1)c(k)\tag{4}\\
A(n+1)x_{n+1}&=A(0)x_0+\sum_{k=0}^nA(k+1)c(k)\tag{5}\\
\color{blue}{x_{n+1}}&=\frac{A(0)x_0+\sum_{k=0}^nA(k+1)c(k)}{A(n+1)}\\
&=\left(x_0+\sum_{k=0}^n\frac{c(k)}{\prod_{j=0}^{k}a(j)}\right)\prod_{j=0}^{n}a(j)\tag{6}\\
&\,\,\color{blue}{=y_0\prod_{j=0}^n a(j)+\sum_{k=0}^nc(k)\prod_{j={k+1}}^na(j)}\tag{7}
\end{align*}
and the claim follows.

Comment:

*

*In (4) we sum up (3) from $k=0,\ldots,n$.


*In (5) we apply telescoping and cancel common summands.


*In (6) we use the definition (2) of $A(k)$.


*In (7) we simplify and use the initial condition $x_0=y_0$.
