[guided]We now translate the arithmetic conditions on $(u, v)$ back into the element $\alpha = \frac{u}{2} + \frac{v}{2}\sqrt{d}$ and identify the corresponding ring.
**Cases A, B ($d \equiv 2, 3 \pmod 4$).** The condition "$u, v$ both even" is equivalent to "$u/2, v/2 \in \mathbb{Z}$" which, since $x = u/2$ and $y = v/2$, is "$x, y \in \mathbb{Z}$". Therefore
\begin{align*}
\mathcal{O}_L = \{x + y\sqrt{d} : x, y \in \mathbb{Z}\}.
\end{align*}
The right-hand side is by definition the subring $\mathbb{Z}[\sqrt{d}]$ of $L$ generated over $\mathbb{Z}$ by $\sqrt{d}$ — indeed, any $\mathbb{Z}$-linear combination of powers of $\sqrt{d}$ collapses to $x + y\sqrt{d}$ since $(\sqrt{d})^2 = d \in \mathbb{Z}$ reduces higher powers. So
\begin{align*}
\mathcal{O}_L = \mathbb{Z}[\sqrt{d}].
\end{align*}
**Case C ($d \equiv 1 \pmod 4$).** The condition "$u \equiv v \pmod 2$" is more subtle: it allows both coordinates odd, not just both even. Concretely, it allows $\alpha = \frac{1}{2} + \frac{1}{2}\sqrt{d} = \frac{1 + \sqrt{d}}{2}$, which we will call $\omega$.
We claim $\mathcal{O}_L = \mathbb{Z}[\omega]$ where $\omega := \frac{1 + \sqrt{d}}{2}$.
**Inclusion $\mathcal{O}_L \subseteq \mathbb{Z}[\omega]$.** Let $\alpha = \frac{u}{2} + \frac{v}{2}\sqrt{d} \in \mathcal{O}_L$, so $u \equiv v \pmod 2$ by our analysis. Since $u - v$ is then even, $a := (u-v)/2 \in \mathbb{Z}$. Set $b := v \in \mathbb{Z}$. Compute:
\begin{align*}
a + b\omega = \frac{u - v}{2} + v \cdot \frac{1 + \sqrt{d}}{2} = \frac{u - v}{2} + \frac{v}{2} + \frac{v}{2}\sqrt{d} = \frac{u}{2} + \frac{v}{2}\sqrt{d} = \alpha.
\end{align*}
So $\alpha = a + b\omega \in \mathbb{Z} + \mathbb{Z}\omega \subseteq \mathbb{Z}[\omega]$.
**Inclusion $\mathbb{Z}[\omega] \subseteq \mathcal{O}_L$.** We will show $1, \omega \in \mathcal{O}_L$; since $\mathcal{O}_L$ is a ring (by [Ring of Integers is a Ring](/theorems/1567)), every $\mathbb{Z}$-combination $a + b\omega$ lies in $\mathcal{O}_L$, and in fact every polynomial in $\omega$ with $\mathbb{Z}$-coefficients does.
- $1 \in \mathcal{O}_L$: $1$ satisfies the monic integer polynomial $t - 1$, so $1 \in \mathcal{O}_L$.
- $\omega \in \mathcal{O}_L$: compute the minimal polynomial of $\omega$. From the definition $\omega = \frac{1 + \sqrt{d}}{2}$, rearrange to $2\omega = 1 + \sqrt{d}$, so $\sqrt{d} = 2\omega - 1$. Squaring and using $\sqrt{d}^2 = d$:
\begin{align*}
d = (2\omega - 1)^2 = 4\omega^2 - 4\omega + 1, \qquad \text{so} \qquad 4\omega^2 - 4\omega + (1 - d) = 0.
\end{align*}
Dividing by $4$ (which is valid in $\mathbb{Q}$):
\begin{align*}
\omega^2 - \omega + \frac{1 - d}{4} = 0.
\end{align*}
The crucial check: $\frac{1 - d}{4} \in \mathbb{Z}$? This requires $4 \mid 1 - d$, i.e. $d \equiv 1 \pmod 4$, which is exactly the hypothesis of Case C. So
\begin{align*}
q(t) := t^2 - t + \frac{1 - d}{4} \in \mathbb{Z}[t]
\end{align*}
is a monic integer polynomial of degree $2$ with $q(\omega) = 0$. Since $\omega \notin \mathbb{Q}$ (as $\sqrt{d} = 2\omega - 1$ would then be in $\mathbb{Q}$, contradiction), the minimal polynomial of $\omega$ over $\mathbb{Q}$ has degree at least $2$. By [Minimal Polynomial Divides Any Annihilating Polynomial](/theorems/1569), $p_\omega \mid q$; since both are monic and $\deg q = 2 \leq \deg p_\omega$, we get $p_\omega = q \in \mathbb{Z}[t]$. By the [Integrality Criterion via Minimal Polynomial](/theorems/1570), $\omega \in \mathcal{O}_L$.
Combining both inclusions, $\mathcal{O}_L = \mathbb{Z}[\omega] = \mathbb{Z}\left[\tfrac{1 + \sqrt{d}}{2}\right]$, completing Case C.
**Summary of the three cases.**
\begin{align*}
\mathcal{O}_L =
\begin{cases}
\mathbb{Z}[\sqrt{d}] & \text{if } d \equiv 2 \text{ or } 3 \pmod 4, \\
\mathbb{Z}\!\left[\tfrac{1}{2}(1 + \sqrt{d})\right] & \text{if } d \equiv 1 \pmod 4.
\end{cases}
\end{align*}
**Final sanity check for Case C**: the element $\omega$ has minimal polynomial $t^2 - t + (1-d)/4$, whose coefficients lie in $\mathbb{Z}$ iff $d \equiv 1 \pmod 4$. So the integrality of $\omega$ — and hence the validity of enlarging the ring from $\mathbb{Z}[\sqrt{d}]$ to $\mathbb{Z}[\omega]$ — is precisely conditioned on the residue class of $d$ modulo $4$. This is the hallmark of ramification at $2$: for $d \equiv 1 \pmod 4$, the prime $2$ is unramified in $\mathcal{O}_L$, which manifests as the presence of the "half-integer" element $\omega$; for $d \equiv 2, 3 \pmod 4$, the prime $2$ is ramified or inert, and $\mathcal{O}_L = \mathbb{Z}[\sqrt{d}]$ remains "simple".[/guided]