$\DeclareMathOperator\GL{GL}$Let $\theta$ be a real quadratic irrationality with discriminant $\Delta$; let $\mathcal{O}_\Delta$ denote the resulting quadratic order of discriminant $\Delta$ in $\mathbb{Q}[\theta]$; let $\GL(2,\mathbb{Z})_\theta$ denote the stabilizer subgroup of $\theta$ with respect to the action of $\GL(2,\mathbb{Z})$ on $\mathbb{R} \setminus \mathbb{Q}$ by fractional linear transformations. It turns out (see, e.g., F. Halter-Koch, *Quadratic Irrationals*, Theorem 5.2.10) that the map
$$
\GL(2,\mathbb{Z})_\theta \to \mathcal{O}_\Delta^\times, \quad \begin{bmatrix}k&l\\m&n\end{bmatrix} \mapsto m\theta + n
$$
is an isomorphism with explicit inverse given by
$$
\frac{u + v\sqrt{\Delta}}{2} \mapsto \begin{bmatrix} \frac{u+bv}{2} & -cv \\ av & \frac{u-bv}{2}\end{bmatrix},
$$
where $(a,b,c)$ is the type of $\theta$, i.e., the unique $(a,b,c) \in \mathbb{Z}^3$ such that $a \neq 0$, $b^2-4ac$ is not a square, and $\theta = \frac{b+\sqrt{b^2-4ac}}{2a}$, so that $\Delta = b^2-4ac$. Is there a traditional attribution for this result?

My apologies if this is well-known—I’m afraid I’m not a number theorist, so even googling this has been an uphill climb for me.

[By way of explanation, I’m interested in this result because it’s well-known to be at the heart of the existence and classification of non-trivial noncommutative line bundles over the corresponding noncommutative $2$-torus $C(\mathbb{T}^2_\theta)$, cf., for instance, Kodaka’s computation of its Picard group.]