TITLE: well-defined functions
QUESTION [6 upvotes]: I am asked to argue whether or not the following two functions are well-defined (textbook definition: a) define $y$ for all $x$ in domain, and b) any is mapped to exactly one y). Both of the below functions are functions from $\mathbb{Q}$ to $\mathbb{Q}$.
$$f\left(\frac{p}{q}\right) = \frac{p+1}{q}$$
$$g\left(\frac{p}{q}\right) = \frac{p+q}{p-q}$$
My argument is that since $0$ is a rational number, we can take, for $f$, $p=0$ and $q=x$ and the function will not be defined. Similarly, we can take $p=q=0$ for $g$, and the function, again, will not be defined.
But the argument seems to be too easy. Is there something I am missing that won't allow me to use these two counter examples?
Thanks!

REPLY [5 votes]: You might want to think of the question like this, with $r =\frac pq$
For the first case $f(r) = r + \frac 1q$
For the second case note that $q\neq 0 $ if $r$ is rational, and $f(r) = \frac {r+1}{r-1}$
A well-defined function is one for which you can determine a single defined value for each $r$.

REPLY [3 votes]: First note that in the definition of rationals, $q$ is not allowed to be zero i.e the numbers to be consider are of the form $\dfrac{p}{q}$, where $p \in \mathbb{Z}$ and $q \in \mathbb{Z} \backslash \{0\}$.
Consider the first function $$f \left( \dfrac{p}{q}\right) = \dfrac{p+1}{q}$$ Note that $$\dfrac{kp}{kq} = \dfrac{p}{q}$$ where $k \in \mathbb{Z} \backslash \{0\}$. Hence, for the function to be well defined we need $$f \left( \dfrac{p}{q}\right) = f \left( \dfrac{kp}{kq}\right) $$ i.e. $$\dfrac{p+1}{q} = \dfrac{kp+1}{kq}, \text{ for all }k \in \mathbb{Z}$$which is clearly not true. Hence, the first function is not well-defined.
The second function $$f \left( \dfrac{p}{q}\right) = \dfrac{p+q}{p-q}$$ is well-defined except for the rational number $1$ since $$f \left( \dfrac{p}{p}\right) = \dfrac{2p}{0} = \text{ not defined}$$ 
For all other rationals except $1$, note that $f \left( \dfrac{kp}{kq} \right)$ where $p \neq q$ and $k \in \mathbb{Z} \backslash \{0\}$, we get that $$f \left( \dfrac{kp}{kq} \right) = \dfrac{kp+kq}{kp-kq} = \dfrac{p+q}{p-q} = f \left( \dfrac{p}{q} \right)$$
Hence, the second function is well-defined for $x \in \mathbb{Q} \backslash \{1\}$.