Expansion of Associated Reduced Quadratic Irrational

Lemma
Let $\alpha$ be a reduced quadratic irrational which is associated to $n$.

Let $\alpha$ be transformed into its integer part and fractional part via:
 * $\alpha = \left \lfloor {\alpha} \right \rfloor + \dfrac 1{\alpha'}$

Then the resulting quadratic irrational $\alpha'$ is also reduced and associated to $n$.

Proof
Let $\alpha = \dfrac{\sqrt n + P} Q$ and $X = \left \lfloor {\alpha} \right \rfloor$

Then we have:
 * $\dfrac 1 {\alpha'} = \dfrac {\sqrt n - \left({Q X - P}\right)} Q$

Because $\sqrt n$ is irrational, we must have:
 * $\dfrac 1 {\alpha'} > 0$

Because $\dfrac 1 {\alpha'}$ is the fractional part:
 * $0 < \dfrac 1 {\alpha'} < 1 \implies \alpha' > 1$

Transforming:

we have:
 * $P' = Q X - P$

and:
 * $Q' = \dfrac 1 Q \left({n - \left({Q X - P}\right)^2}\right)$

To show $Q' \in \Z$:

We have that:
 * $n - \left({Q X - P}\right)^2 \equiv n - P^2 \pmod Q$

Because $\alpha$ is associated to $n$, $Q$ must divide this quantity.

Hence $Q'$ is an integer as defined.

Because $X = \left \lfloor{\dfrac{\sqrt n + P} Q}\right \rfloor$ is an integer and $\alpha$ is irrational:
 * $X < \dfrac {\sqrt n + P} Q$

Hence:
 * $P' = QX - P < \sqrt n $

forcing:
 * $\tilde{\alpha}' < 0$

Because $\alpha > 1$:
 * $X \ge 1 \iff 0 \le X - 1$

Thus:

Hence $\tilde \alpha' > -1$ and $\alpha'$ is reduced.

Because $Q' = \dfrac 1 Q \left({n - \left({P'}\right)^2}\right)$:
 * $n - \left({P'}\right)^2 \equiv Q Q' \equiv 0 \pmod {Q'}$

Hence $\alpha'$ is associated to $n$.

Thus $\alpha'$ is both reduced and associated to $n$.