I recently came across the notion of a function being "well defined" in some exercises in an abstract algebra book I'm reading. What I could gather about the definition (of which there seems to be some ambiguity) is that a function is well defined if for a function $f: A \rightarrow B$ we have $x = y \rightarrow f(x)=f(y)$. In other words, each argument passed by the function has only one image in the range $B$. No single argument can map to $2$ different images.
My first question about this is, isn't this essentially the definition of a function? I always thought that a function was a specific kind of relation where $\forall a \in A, \exists b \in A \mid f(a,b) \in R \subset A \times A$.
- So, are these $2$ definitions equivalent? Or is there some subtlety I'm missing. For instance, could you have a function which is not well-defined? Or are they inextricably linked such that, if a function was shown to be not well-defined then it would necessarily not be a function?
My second question (and motivating example for seeking clarity regarding the above definitions) is, assuming that's all true, would the function $f: \mathbb{R}_+ \rightarrow \mathbb{R}, f(x) = \sqrt{x}$ not be considered well-defined? Since we can see $x = y$ for $x,y \in \mathbb{R}_+$ does not imply that $f(x) = f(y)$ since, take $x=y=4$ then $f(x) = 2 = -2$ and one argument maps to $2$ separate images. If the $2$ definitions (of well defined and a function) are indeed equivalent then would the square root 'function' not actually be a function at all? In which case, why does it seem to be treated as such?