Example 3 Given the sequence $\left\{a_{n}\right\}$ satisfies $a_{1}=a_{2}=1, a_{n}=\frac{a_{n-1}^{2}+2}{a_{n-2}}(n \geqslant 3)$, find its general term formula $a_{n}$.
Solution: The original recurrence relation can be transformed into $a_{n} a_{n-2}=a_{n-1}^{2}+2$.
Substituting $n+1$ for $n$ in the above equation, we get $a_{n+1} a_{n-1}=a_{n}^{2}+2$.
Subtracting the two equations, we get $a_{n+1} a_{n-1}-a_{n} a_{n-2}=a_{n}^{2}-a_{n-1}^{2}$, which simplifies to $\frac{a_{n+1}+a_{n-1}}{a_{n}}=\frac{a_{n}+a_{n-2}}{a_{n-1}}$. Let $b_{n}=\frac{a_{n}+a_{n-2}}{a_{n-1}}(n \geqslant 3)$, then $b_{n}=b_{n-1}=\cdots=b_{3}=\frac{a_{3}+a_{1}}{a_{2}}=4$. Therefore, $\frac{a_{n}+a_{n-2}}{a_{n-1}}=4$, which means $a_{n}=4 a_{n-1}-a_{n-2}(n \geqslant 3)$.
From its characteristic equation $x^{2}=4 x-1$, we solve for the two roots as $x_{1}=2+\sqrt{3}, x_{2}=2-\sqrt{3}$.
We can assume $a_{n}=A \cdot(2+\sqrt{3})^{n}+B \cdot(2-\sqrt{3})^{n}\left(n \in \mathbf{N}^{*}\right)$.
From $a_{1}=a_{2}=1$, we get $\left\{\begin{array}{l}A(2+\sqrt{3})+B(2-\sqrt{3})=1 \\ A(2+\sqrt{3})^{2}+B(2-\sqrt{3})^{2}=1\end{array}\right.$, solving which yields $A=\frac{-5+3 \sqrt{3}}{2 \sqrt{3}}, B=$ $\frac{5+3 \sqrt{3}}{2 \sqrt{3}}$.
Therefore, $a_{n}=\frac{1}{2 \sqrt{3}}\left[(-5+3 \sqrt{3})(2+\sqrt{3})^{n}+(5+3 \sqrt{3})(2-\sqrt{3})^{n}\right]\left(n \in \mathbf{N}^{*}\right)$.
Analysis: This problem seems difficult to approach at first, but through several substitutions, we arrive at the familiar form $a_{n+2}=\alpha a_{n}+$ $\beta a_{n+1}$. When solving problems, pay attention to transforming unfamiliar expressions into familiar ones for easier solving.