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?
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?
On
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}}}}$$
For the second part of your question: The fundamental unit of the ring of integers in $\mathbb Q(\sqrt{k})$ is the smallest unit greater than $1$. It turns out that if $x+y\omega>1$ is a unit in $O_{\mathbb Q(\sqrt{k})}=\mathbb Z[\omega]$, then $x,y>0$. Therefore we can find the fundamental unit by trial and error on $x$ and $y$.
However, we can find it much faster using continued fractions. It turns out that if the fundamental root is $x+y\omega$, then $\frac xy$ is a convergent to $-\omega'$. So we just need to find the first convergent that is also a unit. Note that the number we have to find the continued fraction of is $$ -\omega' = \begin{cases} \sqrt{k} & k \equiv 2,3 \pmod 4 \\ \frac{\sqrt{k}-1}{2} & k \equiv 1 \pmod 4 \end{cases} $$ In your case we have $k=d^2+1$. In case $d\equiv 1,3\pmod4$, then $d^2+1\equiv2$, so we find the convergents of $\sqrt{d^2+1}$. $d=d/1$ is the first convergent, so we check whether $d+1\cdot\sqrt{d^2+1}$ is a unit. $$ (d+\sqrt{d^2+1})\cdot(d-\sqrt{d^2+1}) = -1 $$ so $d+\sqrt{d^2+1}$ is indeed a unit, and thus the fundamental unit.
In case $d\equiv0,2\pmod4$, then $d^2+1\equiv 1$, and you can do a similar calculation, but it will be a bit more messy. Note also that the claim is actually false for $d^2+1=5$, where the fundamental unit is $\frac{1+\sqrt5}{2}$.