Prove that for $k>1$ $a_n$ is a perfect square I'm having problems with this exercise.
Let $k > 1$ be an integer. We define $(a_n)_{n \in \Bbb N_0}$ as:
$$a_0 = 1$$ $$a_1 = 1$$ $$a_{n+2} = (k^2-2)a_{n+1}-a_n-2(k-2)$$
Prove that $\forall n \in \Bbb N_0, a_n$ is a perfect square.
I'm not sure how to tackle this problem. I want to prove that $a_n=(a+b)^2$ in some way. I was going to attempt with induction, $P(0)$ and $P(1)$ are true, $P(2)=(k-1)^2$... but how should I pick $P(n)$ and $P(n+1)$. Or should I try other method?
I've also tried finding the roots so I could have the closed formula for the sequence but I've ended up with a rather disappointing looking expression: $\frac{(k^2-2) \pm \sqrt{k^4-4k^2-8k+16}}{2}$
Any ideas or suggestions? Thanks!
 A: just one of those things, given $b_0=1, b_1 = 1,$ and
$$  b_{n+2} = k \, b_{n+1} - b_n, $$ then
$$ a_n = b_n^2. $$
The key step is
$$ b_{n+2} b_n - b_{n+1}^2 = k-2 $$
Let us show how that fits in: we say $a_n = b_n^2.$ We know $b_{n+2} + b_n = k b_{n+1.}$ Square both sides, this gives
$$ b_{n+2}^2 + a_n + 2 b_{n+2}b_n = k^2 a_{n+1}, $$
$$ b_{n+2}^2 + a_n  = k^2 a_{n+1} -  2 b_{n+2}b_n, $$
$$ b_{n+2}^2 + a_n  = k^2 a_{n+1} -  2 b_{n+2}b_n +  2 b_{n+2}b_n - 2 b_{n+1}^2 - 2 k + 4, $$
$$ b_{n+2}^2 + a_n  = k^2 a_{n+1} - 2 b_{n+1}^2 - 2 k + 4, $$
$$ b_{n+2}^2 + a_n  = k^2 a_{n+1} - 2 a_{n+1} - 2 k + 4, $$
$$ b_{n+2}^2 + a_n  = (k^2 -2) a_{n+1}  - 2 k + 4, $$
$$  b_{n+2}^2   =  a_{n+2}. $$
In turn, $ b_{n+2} b_n - b_{n+1}^2 = k-2 $ comes from a standard quadratic forms construction. We consider the quadratic form $f(x,y) = x^2 - kxy + y^2.$ Its Hessian matrix is
$$
H = 
\left(
\begin{array}{rr}
2 & -k \\
-k & 2
\end{array}
\right)
$$ 
We define a matrix $A$ (for "automorphism") as
$$
A = 
\left(
\begin{array}{rr}
k & -1 \\
1 & 0
\end{array}
\right).
$$ 
The word automorphism means
$$  A^T H A = H. $$
In turn, from the observation that
$$
\left(
\begin{array}{c}
b_{n+2}  \\
b_{n+1} 
\end{array}
\right)
\left(
\begin{array}{rr}
k & -1 \\
1 & 0
\end{array}
\right) =
\left(
\begin{array}{c}
b_{n+1} \\
b_n
\end{array}
\right)
$$
we find 
$$ b_{n+2}^2 - k b_{n+2} b_{n+1} + b_{n+1}^2 =  b_{n+1}^2 - k b_{n+1} b_{n} + b_{n}^2, $$ so that
$$ b_{n+1}^2 - k b_{n+1} b_{n} + b_{n}^2 $$ is independent of $n$ and constant.
From $b_1$ and $b_0$ we find
$$ b_{n+1}^2 - k b_{n+1} b_{n} + b_{n}^2 = 2-k. $$
Finally
$$b_{n+2} b_n - b_{n+1}^2 = (k b_{n+1} - b_n) b_n - b_{n+1}^2 = - b_{n+1}^2 + k b_{n+1} b_n - b_n^2 = -(2-k) = k-2  $$
I asked the OP for the source of the problem, it turns out the part about defining $b_n$ was the  hint given; exercise 24. The exercise (review?) set pdf is at PDF

