<s>[INST] Continued fraction expansion of $\sqrt{d^2+1}$ How can I show that the continued fraction expansion of $\sqrt{d^2+1}$ is $[d, \overline{2d}]$? 
And why is the fundamental unit of $\mathbb Q(\sqrt{d^2+1})$ equivalent to $d+\sqrt{d^2+1}$, if $d^2+1$ is squarefree? 
 [/INST] Partial answer/hint. From
$$\sqrt{d^2+1}-d=\frac{1}{\sqrt{d^2+1}+d} \Rightarrow
\sqrt{d^2+1}=d+\frac{1}{d+\sqrt{d^2+1}}\Rightarrow\\
\sqrt{d^2+1}=\color{red}{d}+\frac{1}{\color{red}{2d}+\frac{1}{d+\sqrt{d^2+1}}} \Rightarrow\\
\sqrt{d^2+1}=\color{red}{d}+\frac{1}{\color{red}{2d}+\frac{1}{\color{red}{2d}+\frac{1}{d+\sqrt{d^2+1}}}}$$
</s>