Question about the formal definition of a domain of a function. The following formal definitions of domain and $f(a)$ are given in my textbook 

If $f$ is a function, the domain of $f$ is the set of all $a$ for which there is some $b$ such that $(a,b)$ is in $f$. If $a$ is in the domain of $f$, it follows from the definiition of a function that there is, in fact, a unique number $b$ such that $(a,b)$ is in $f$. This unique $b$ is denoted by $f(a)$.

This is probably very nitpicky, but why do we start off by saying that "the domain of $f$ is the set of all $a$ for which there is some $b$ such that $(a,b)$ is in $f$?" Would it be incorrect to say "the domain of $f$ is the set of all $a$ for which there is a unique $b$ such that $(a,b)$ is in $f$? Would this latter definition possibly allow for multiple domains of a function, since $f$ doesn't necessarily have to be a one-to-one function?
 A: Let me respond to your nitpicky question with an even more nitpicky commentary.
I assume your working definition of function is something like this:

A function is a set $f$ of ordered pairs such that if $(a, b_1) \in f$ and $(a, b_2) \in f$ then $b_1 = b_2$.

This definition allows for a function to not be one-to-one (i.e., injective): It's possible to have $(a_1, b) \in f$ and $(a_2, b) \in f$ with $a_1 \ne a_2$. However, this definition does not allow us to speak formally about a function being onto (i.e., surjective), because it does not mention the target (codomain) of the function. Here's a more thorough definition:

A function is an ordered triple $f = (A, B, \Gamma)$ where $A$ (the domain of $f$) and $B$ (the codomain of $f$) are sets, and $\Gamma$ (the graph of $f$) is a subset of the cartesian product $A \times B$ (that is, $\Gamma$ is a set of ordered pairs $(a, b)$ with $a \in A$ and $b \in B$), such that for every $a \in A$, there exists a unique $b \in B$ such that $(a, b) \in \Gamma$.

With this definition in hand, we may say that $f$ is surjective (aka. onto) if for every $b \in B$ there exists some $a \in A$ such that $(a, b) \in \Gamma$.
If $f$ is a function in the sense of definition 2, then its graph $\Gamma$ is a function in the sense of definition 1. Conversely, if $f$ is a function in the sense of definition 1, and we define $A = \{a \mid (a, b) \in f \text{ for some } b\}$ and  $B = \{b \mid (a, b) \in f \text{ for some } a\}$, then $(A, B, f)$ is a surjective function in the sense of definition 2. But other choices for the codomain $B$ are possible: we can pick a bigger set $B$, and still get a definition-2 function (but it will no longer be surjective).
In other words, if we have a definition-1 function, we may "recover" its domain and its image:
$$\operatorname{dom} f := \{a \mid \exists b : (a, b) \in f\}, \qquad \operatorname{im} f := \{b \mid \exists a : (a, b) \in f\}.$$
(Please excuse the sloppy notation -- I know that applying the axiom of comprehension in this way is not quite kosher. But let's not worry about that for now.) I prefer the term image here instead of range, because range is ambiguous: It may refer to either image or codomain, depending on who you ask.
Definition 1 is preferred by books on elementary set theory. Definition 2 is more compatible with modern mathematics, so in any other context you should think of functions as objects satisfying definition 2. I like to call the former object an untyped function and the latter object a typed function: if you like, the type of $f$ is "function with domain $A$ and codomain $B$". 
The definition as an ordered triple is slightly artificial, and nobody really thinks of functions this way. The important point is that the domain and codomain are actually part of the function itself, as opposed to being vague, ambient entities. Incidentally, functions may also be defined as basic "first-order" objects if you're willing to abandon standard set theory: see Tom Leinster's Rethinking set theory.
Now, to answer your original question about untyped functions: It doesn't matter, the two definitions are precisely equivalent. Because suppose $f$ is an untyped function, and $a$ is an element such that there exists $b$ with $(a, b) \in f$. Then, by definition 1, there can be no other such element $b$. In other words, $a$ is an element such that there exists a unique $b$ with $(a, b) \in f$. So the two characterizations/definitions of domain that you give are equivalent when $f$ is a function. The reason they gave the first and not the second is because the word unique is superfluous: If the word was present, it would not change anything technically, but it might be misleading because it would suggest without that word the definition wouldn't be the same. Also, when choosing between two equivalent definitions, we usually prefer the one which requires us to verify less (when e.g. we want to show that a given set is indeed the domain of a given function).
A: How about this:
Let $f(x)$ be a function that maps elements from a set $A$ into a set $B$. Then, the domain of $f$ is the set of all $x \in A$ that gives a real (i.e., real number) corresponding value of $f(x)$ in $B$.  
Incidentally, the collection of all such $f(x)$ values is the range of $f$.
