solve the recurrence relation $a_{n+2} + a_n =0$ solve the recurrence relation $a_{n+2} + a_n =0$
$ r=i $
$r=-i$
I know what to do (and I know the answer)
But I dont know how to work with $\sin $ and $\cos $
to get it to look like $a_n = A \cos(n \pi/2)+B \sin(n \pi/2)$
(its on grimaldi Example 31.10)
I know  $i=cos(π/2)+isin(π/2)i=cos⁡(π/2)+isin⁡(π/2)$, so $i^n=cos(nπ/2)+isin(nπ/2)$
but why $cos(nπ/2)+isin(nπ/2) + cos(-nπ/2)+isin(-nπ/2)  = A \cos(n \pi/2)+B \sin(n \pi/2)$
 A: Going through a formal derivation of a generalized Fibonacci sequence, say $f_n=af_{n-1}+bf_{n-2}$, as described here, we can show that
$$a_n=a_1\left(\frac{\alpha^n-\beta^n}{\alpha-\beta}\right)+ba_0 \left(\frac{\alpha^{n-1}-\beta^{n-1}}{\alpha-\beta}\right)$$
where $\alpha,\beta=\pm i$ are the roots as determined in the OP. In the present case, this reduces to
$$a_n=a_1\left(\frac{i^n-(-i)^n}{2i}\right)-a_0 \left(\frac{i^{n-1}-(-1)^{n-1}}{2i}\right)$$
The $a_1$-terms are zero for even values of $n$ and the $a_0$-terms are zero for odd values of $n$. The non=zero terms alternate between plus and minus one, so this can probably be simplified further.
EDIT
I have been able to simplify the result as follows:
$$a_n=a_1\sin\left(\frac{n\pi}{2}\right)+a_0\cos\left(\frac{n\pi}{2}\right)$$
These results have all been verified numerically.
A: $$
a_n = \alpha^n \rightarrow \alpha^n(\alpha^2+1)=0 \rightarrow \alpha = \pm i 
$$
$$
a_n = C_1 i ^n + C_2 (-i)^n = C_1 e^{\pi ni / 2} + C_2 e^{-\pi ni/ 2} =  C_1 ( \cos (\pi n /2) + i \sin (\pi n / 2)) + C_2  ( \cos (\pi n /2)  - i \sin (\pi n / 2)) =
$$ 
$$
(C_1 + C_2) \cos (\pi n /2) +(C_1 - C_2) i  \sin (\pi n / 2)) =  A\cos (\pi n /2) +B\sin (\pi n / 2))
$$
