I am using the book by Strauss on partial differential equations and I am looking at the proof for stability requirements of numerical approximations. There is a part of the proof that I don't quite understand and the book gives a solution and just asks the reader to trust the solution. Below is what is needed to understand the problem.
Let $u_j^n$ be the numerical approximation of the diffusion equation at position $j$ and time $n$. We look for a solution of the form $u_j^n = X_jT_n$. Upon substituting this back into the diffusion equation and dividing by $T_nX_j$, we get $$\frac{T_{n+1}}{T_n} = 1 - 2s + s\cdot\frac{X_{j+1} + X_{j-1}}{X_j}$$ where $s = \frac{\triangle t}{(\triangle x)^2}$ and $X_j = j\cdot \triangle x$.
But because this is a numerical approximation we get that both sides of $u_j^n = X_jT_n$ are equal to some constant $\xi$. Thus, $$T_n = \xi^n\cdot T_0$$ and $$1 - 2s + s\cdot\frac{X_{j+1} + X_{j-1}}{X_j} = \xi. \qquad (7)$$ To solve the spatial equation (7), we argue that it is a discrete version of a second-order ODE which has sine and cosine solutions. Therefore, we guess solutions of the form $$X_j = Acosj\theta + Bsinj\theta$$ for some $\theta$.
If anyone can help me understand how they derived the general solution to this second order difference equation I would be very helpful. I have not taken a class that focuses on solving difference equations so I am not sure where this comes from. Thank you in advance!
They rewrote eq $(7)$ as $$X_{j+1}+\frac{1-2s-\xi}sX_j+X_{j-1}=X_{j+1}+2cX_j+X_{j-1}=0$$ Then with a trial solution of $X_j=A^j$ they got $A^2+2cA+1=0$ so if $|c|>1$, $$A=-c\pm\sqrt{c^2-1}=(-c+\sqrt{c^2-1})^{\pm1}$$ Since it's a linear homogeneous difference equation any linear combination of solutions is itself a solution so the general solution is $$X_j=c_1(-c+\sqrt{c^2-1})^j+c_2(-c+\sqrt{c^2-1})^{-j}$$ If $|c|=1$, then $A=-c$ is a double root of the characteristic equation so, much as with differential equations, the general solution would be $$X_j=(c_1+c_2j)(-c)^j$$ Just plug it in to verify. Finally, if $|c|<1$ we get $$A=-c\pm i\sqrt{1-c^2}=e^{\pm i\cos^{-1}(-c)}$$ And then the general solution is $$\begin{align}X_j&=c_1e^{ij\cos^{-1}(-c)}+c_2e^{-ij\cos^{-1}(-c)}\\ &=\left(\frac{c_1+c_1^*}2+\frac{c_1-c_1^*}2\right)e^{ij\cos^{-1}(-c)}+\left(\frac{c_2+c_2^*}2+\frac{c_2-c_2^*}2\right)e^{-ij\cos^{-1}(-c)}\\ &=\left(\frac{c_1+c_1^*+c_2+c_2^*}{2}\right)\cos j\cos^{-1}(-c)+\left(\frac{c_1^*-c_1+c_2-c_2^*}{2i}\right)\sin j\cos^{-1}(-c)\\ &\quad+i\left(\frac{c_1+c_1^*-c_2-c_2^*}2\right)\sin j\cos^{-1}(-c)+i\left(\frac{c_1-c_1^*+c_2-c_2^*}{2i}\right)\cos j\cos^{-1}(-c)\end{align}$$ The first row is the real part and the second row is the imaginary part of the general solution.