# Second Order Homogeneous Linear Difference Equation

So i have this equation i want to solve $$yx_{j-1} + (1+y^2)x_j + yx_{j+1} = 0$$

with conditions $$(1+y^2)x_n + yx_{n-1} = 0$$ and $$(1+y^2)x_1 + yx_2 = y$$ I tried solving this by guessing that $x_j = Aw^j$, but have not found solution. Can anyone give me some hints to how i can solve this equation?

If you must solve this analytically, you may try this: $$\left( \begin{array}{c} x_{n+1}\\ x_n \end{array} \right)=\left( \begin{array}{cc} -y-1/y&-1\\ 1&0 \end{array} \right)\left( \begin{array}{c} x_n\\ x_{n-1} \end{array} \right).$$ This is of the form $$\mathbf{x}_n=A\mathbf{x}_{n-1},$$ whose solution reads $$\mathbf{x}_n=A^{n-1}\mathbf{x}_1.$$ As for $A^{n-1}$, you need to diagonalize $A$ at first, i.e., $A=P\Lambda P^{-1}$, where $\Lambda$ is a diagonal matrix. In this way, $A^{n-1}=P\Lambda^{n-1}P^{-1}$.
You need to leave $x_1$ undetermined, and set $x_2$ as per your last constraint. After you obtain the general solution to $x_n$ and $x_{n-1}$ (obviously, they depends on the value of $x_1$), you determine the value of $x_1$ by using your second constraint.