Solution to Abstract Algebra by Dummit & Foote 3rd edition Chapter 0.1 Exercise 0.1.5
Determine whether the following functions are well defined.
$f : \mathbb{Q} \rightarrow \mathbb{Z}$ given by $f(a/b) = a$.
This relation is not well defined since, in particular, $1/2 = 2/4$ but $$f(1/2) = 1 \neq 2 = f(2/4).$$
$f : \mathbb{Q} \rightarrow \mathbb{Q}$ given by $f(a/b) = a^2/b^2$.
This relation is well defined. Note that $$\frac ab = \frac cd \Longrightarrow \frac{a^2}{b^2} = \frac{c^2}{d^2},$$ and hence $f(a/b) = f(c/d)$.