The necessary and sufficient condition for a unit element in Euclidean Domain

Solution 1:

From the text of your question I assume that your $d$ function satisfies $d(x)\le d(z)$ if $x$ divides $z$. (BTW, this is the same as saying that $d(x)\le d(xy)$.)

Since $1$ divides every element, we have $d(1)\le d(x)$ for all $x$. If $u$ is a unit, then $u$ divides $1$ and so $d(u)\le d(1)$. This implies $d(u)=d(1)$.

Conversely, as you have remarked, $1=uq+r$ with $r=0$ or $d(r)< d(u)$. But if $d(u)=d(1)$, then if $r\ne0$ you'd get $d(r)<d(1)$, which contradicts $d(1)\le d(x)$ for all $x$. Hence $r=0$ and $u$ is a unit.