Example 7 As shown in Figure 1, let $A$ and $E$ be opposite vertices of a regular octagon. There is a kangaroo at vertex $A$. Except for vertex $E$, the kangaroo can jump to any one of the two adjacent vertices from any vertex of the octagon, and the kangaroo stops when it lands on vertex $E$. Let $a_{n}$ be the number of ways the kangaroo can jump from vertex $A$ to $E$ in exactly $n$ jumps. Find $a_{n}$.
$$
(\mathrm{IMO}-21-6)
$$
Solution: Clearly, $a_{4}=2, a_{1}=a_{2}=a_{3}=0$, and any odd number of jumps cannot reach $E, a_{2 m-1}=0 .(m \in \mathbf{N})$

From $A$, jumping 2 times can reach $C$ and $G$. Let the number of ways to jump $n$ steps from point $C$ to $E$ be $b_{n}$, then $b_{2}=1$. Thus,
$$
b_{n}=a_{n-2}+2 b_{n-2} .
$$
(indicating jumping from point $C$ to $A$, or from $C$ to $B$ or $D$ and then back to $C$)

or $a_{n}=2 b_{n-2}+2 a_{n-2}$.
(indicating jumping from point $A$ to point $C$ or $G$, or from point $A$ to $H$ or $B$ and then back to $A$)
From (1)-(2) simplification, we get
$b_{n-2}=a_{n-2}-a_{n-4}$.
Thus, $a_{n}=4 a_{n-2}-2 a_{n-4}$.
When $n=2 m, a_{2}=0, a_{4}=2$, let $c_{m}=$ $a_{2 m}$, then
$$
c_{m}-4 c_{m-1}+2 c_{m-2}=0, c_{1}=0, c_{2}=4 .
$$

By the characteristic equation method, we get
$$
c_{m}=A(2+\sqrt{2})^{m}+B(2-\sqrt{2})^{m}
$$

From the initial conditions, we get
$$
\dot{A}=\frac{1}{\sqrt{2}(2+\sqrt{2})}, B=\frac{1}{\sqrt{2}(2-\sqrt{2})} .
$$

Therefore, $a_{2 m}=c_{m}$
$$
=\frac{1}{\sqrt{2}}(2+\sqrt{2})^{m-1}-\frac{1}{\sqrt{2}}(2-\sqrt{2})^{m-1} .
$$