1

I'm trying to solve this recurrence $x_{n+2} - 2x_{n+1} + x_n = 8$, but the solution of the homogeneous is $a_n=b+cn$, and I don't know how to change it to find the non-homogeneous solution.

4 Answers4

2

Try the Ansatz $x_n=kn^2$ so$$8=k[n^2+4n+4-2n^2-4n-2+n^2]=2k\implies k=4.$$

J.G.
  • 115,835
  • Great, it worked! Whenever I have a non-homogeneous recurrence whose f (x) is a constant, will this solution work? – Gabriel Delgado Jan 20 '21 at 18:44
  • 1
    @GabrielDelgado There's no general rule, but a useful tip is to try the next simplest thing to the homogeneous case. – J.G. Jan 20 '21 at 18:55
  • @NeatMath That's already included in the homogeneous solution. – J.G. Jan 20 '21 at 20:41
  • OK, fair enough. I did have a lecture notes pdf file on my dead computer where there is some example when guess work doesn't work. I'll show you the example when I recover the file. – Neat Math Jan 20 '21 at 20:46
  • @NeatMath Cool, I look forward to seeing it. As with differential equations, no toolkit is a panacea. – J.G. Jan 20 '21 at 21:07
2

$$x_{n+2} - 2x_{n+1} + x_n = 8\tag{1}$$ Set $n=n+1$ $$x_{n+3}-2x_{n+2}+x_{n+1}=8$$ Subtract the two equations $$x_{n+3}-2x_{n+2}+x_{n+1}-x_{n+2} + 2x_{n+1} - x_n=0$$ $$x_{n+3}-3x_{n+2}+3x_{n+1}-x_n=0$$ Characteristic equation is $$\lambda^3-3\lambda^2+3\lambda-1=0\to (\lambda-1)^3=0\to \lambda=1$$ and finally $$x_n=an^2+bn+c\tag{2}$$


edit

from $(1)$ we get $x_0=8+2x_1-x_2$

from $(2)$ we have $x_0=c,\;x_1=a+b+c;\;x_2=4a+2b+c$

putting all together $$\begin{cases} c=8+2x_1-x_2\\ a+b+c=x_1\\ 4a+2b+c=x_2\\ \end{cases} $$ $$\begin{cases} a+b+8+2x_1-x_2=x_1\to a+b=x_2-x_1-8\\ 4a+2b+8+2x_1-x_2=x_2\to 4a+2b=2x_2-2x_1-8\\ \end{cases} $$ $$\begin{cases} a+b=x_2-x_1-8\\ 2a+b=x_2-x_1-4\\ \end{cases} $$ subtracting the two equations, we get $a=4$ so the $(2)$ becomes $$x_n=4n^2+bn+c$$

Raffaele
  • 26,371
2

If the non-homogeneous part is constant you can always take the difference and make it homogeneous. In your case,

$$(\mathbb E-1)^2 x_n = 8 \implies (\mathbb E-1)^3 x_n = (\mathbb E - 1)8=0$$

And you get your characteristic function immediately which is $(\lambda-1)^3=1$.

Here $\mathbb E$ is the forward shift operator, $\mathbb E^i x_n = x_{n+i}, \forall i \in \mathbb N$.

For a non-constant $f(x)$ example, check out this answer.

Neat Math
  • 4,790
0

Another way is applying unilateral $\mathcal{Z}$-transform which is defined as $$X(z) = \sum_{n=0}^{+\infty}x[n]z^{-n}$$The equation is $$x[n+2] -2x[n+1] +x[n] = 8u[n]$$We can easily show that the following properties holds:$$\mathcal{Z}\{\alpha^nu[n]\} = \frac{1}{1-\alpha z^{-1}} \\ \mathcal{Z}\{x[n+1]\} = zX(z) - zx[0]\implies\mathcal{Z}\{x[n+2]\} = z^2X(z) - z^2x[0] - zx[1] \\ \mathcal{Z}\{nx[n]\} = -z\frac{dX(z)}{dz}\\ \mathcal{Z}\{x[n-1]\} = z^{-1}X(z) + x[-1] \\ \mathcal{Z}\{\delta[n]\} = 1$$Applying the transform to the equation yields $$z^2X(z) - z^2x[0] - zx[1] - 2(zX(z) - zx[0]) +X(z) = \frac{8}{1-z^{-1}}$$For convenience, let $x[0] = a$ and $x[1] = b$. Partial fraction decomposition gives $$X(z) = a + \frac{8}{(z-1)^3} + \frac{8 - a + b}{(z-1)^2} + \frac{b}{z-1}$$Taking the inverse transform gives $$x[n] = a\delta[n] + bu[n-1] + (8 - a + b)(n-1)u[n-1] + 8(\frac{1}{2}(n-2)(n-1)u[n-1])$$Which can be written as $$x[n] = a - 4n - an + bn + 4n^2 = 4n^2 + n(b-a-4) + a$$ It can be verified by WA. Note that the counterpart of the Laplace transform for discrete-time signals is the $\mathcal{Z}$-transform.

S.H.W
  • 4,379