<s>[INST] Finding $(a+\sqrt b)^n+(a-\sqrt b)^n$ where $n$ is natural For the expression $\left(a+\sqrt{b}\right)^n+\left(a-\sqrt{b}\right)^n$ where $n \in \mathbb{N}$, and $a,b, \in \mathbb{Q}$, the radical is always ends up cancelled, and the result is always in $\mathbb{Q}$.  Is there any way that this could be reexpressed with the assumption that n is always a positive integer without the use of a square root operation, such as an alternative closed form for even $n$, and another closed form for odd $n$, or am I always stuck having to calculate a square root?
 [/INST] Since 
$$\begin{bmatrix}
A & B \\
1 & A
\end{bmatrix} = \begin{bmatrix}
1 & 1 \\
\frac{-1}{\sqrt B} & \frac{1}{\sqrt B}
\end{bmatrix} \begin{bmatrix}
A - \sqrt B & 0 \\
0 & A + \sqrt B
\end{bmatrix} \begin{bmatrix}
1 & 1 \\
\frac{-1}{\sqrt B} & \frac{1}{\sqrt B}
\end{bmatrix}^{-1}
$$
It follows that
$$\begin{bmatrix}
A & B \\
1 & A
\end{bmatrix}^n = \begin{bmatrix}
1 & 1 \\
\frac{-1}{\sqrt B} & \frac{1}{\sqrt B}
\end{bmatrix} \begin{bmatrix}
A - \sqrt B & 0 \\
0 & A + \sqrt B
\end{bmatrix}^n \begin{bmatrix}
1 & 1 \\
\frac{-1}{\sqrt B} & \frac{1}{\sqrt B}
\end{bmatrix}^{-1}
$$
$$Q = \begin{bmatrix}
1 & 1 \\
\frac{-1}{\sqrt B} & \frac{1}{\sqrt B}
\end{bmatrix}^{-1} \begin{bmatrix}
A & B \\
1 & A
\end{bmatrix}^n \begin{bmatrix}
1 & 1 \\
\frac{-1}{\sqrt B} & \frac{1}{\sqrt B}
\end{bmatrix} = \begin{bmatrix}
(A - \sqrt B)^n & 0 \\
0 & (A + \sqrt B)^n
\end{bmatrix}
$$
If you assume that $\begin{bmatrix}
A & B \\
1 & A
\end{bmatrix}^n = \begin{bmatrix} H & I \\ J & K \end{bmatrix}$ then multiply out the above it follows that $(A - \sqrt B)^n + (A + \sqrt B)^n = Q_{1,1} + Q_{2,2} = H + K$.
In summary, $$(A - \sqrt B)^n + (A + \sqrt B)^n = \text{trace}\left(\begin{bmatrix}
A & B \\
1 & A
\end{bmatrix}^n\right)$$
</s>