Why don't these different factorizations of $7$ contradict number ring is UFD? I have the following factorizations of $7$ in the number ring of $\mathbb{Q}(\sqrt{-3})$, which is $\mathbb{Z}\left[ \frac{1+\sqrt{-3}}{2} \right]=\mathcal{O}_{\mathbb{Q}(\sqrt{-3})}$
$$7=(2+\sqrt{-3})(2-\sqrt{-3})=\frac{5+\sqrt{-3}}{2}\cdot\frac{5-\sqrt{-3}}{2}$$
I have already checked that all the factors are irreducible elements of $\mathcal{O}_{\mathbb{Q}(\sqrt{-3})}$. However, $\mathcal{O}_{\mathbb{Q}(\sqrt{-3})}$ is a UFD, so I have to find a reason for these two different factorizations not being a contradiction with the UFD status. If the factors were different by a unit, the problem would be solved. Let
$$(2+\sqrt{-3})u_1=\frac{5+\sqrt{-3}}{2} \quad , \quad (2-\sqrt{-3})u_1=\frac{5-\sqrt{-3}}{2}$$
where $u_1, u_2$ are units of $\mathcal{O}_{\mathbb{Q}(\sqrt{-3})}$. I get that
$$u_1=\frac{5+\sqrt{-3}}{4+2\sqrt{-3}}$$
However this isn't a unit. What am I doing wrong?
 A: $$\frac{5+\sqrt{-3}}{4+2\sqrt3}$$ has norm $1,$ but it isn’t in $\mathbb Z[\omega],$ where $\omega=\frac{1+\sqrt{-3}}2.$ You can check this by rationalizing the denominator:
$$ \begin{align} \frac{5+\sqrt{-3}}{4+2\sqrt3}&= \frac{(5+\sqrt{-3})(4-2\sqrt{-3})}{(4+2\sqrt{-3})(4-2\sqrt{-3})}\\&=\frac{26-6\sqrt{-3}}{28}\\&=\frac{13}{14}+\frac{3}{14}\sqrt{-3}\notin\mathbb Z[\omega].
\end{align} 
$$
Instead, try:
$$\frac{5+\sqrt{-3}}{4-2\sqrt{-3}}=\omega$$

This is like $$5=(2+i)(2-i )=(1+2i)(1-2i)$$ in $\mathbb Z[i].$ $$\frac{2+i}{1+2i}=\frac45-\frac35i$$ is not in $\mathbb Z[i],$ so even though the norm is $1,$ it is not a unit in $\mathbb Z[i].$
But $\mathbb Z[i]$ is a UFD, we just need a different quotient. $$\frac{2+i}{1-2i}=i$$ is a unit.
A: Try writing your factors in terms of $\omega=\frac{-1+\sqrt{-3}}2$, where $\omega^2=-\omega-1=\frac1\omega$:
$$7=(3+2\omega)(1-2\omega)=(3+\omega)(2-\omega)$$
Now multiply $3+2\omega$ by the unit $-\omega$ to get $-3\omega-2(-\omega-1)=2-\omega$, and $1-2\omega$ by its inverse $1+\omega$ to get $1-\omega-2(-\omega-1)=3+\omega$. This shows that the factorisations are the same up to units.
