It is a common practice to have students of elementary algebra infer the domain of a function as an exercise. I believe this is contrary to the spirit of the definition of a function as a collection of ordered pairs, no two of which have the same first term. In all serious, set-theoretic presentations of functions, relations, of which functions are a special case, come first, and then the definition of domain and range. So, if any inference is to be done, it would seem like it should be of the “formula”, or explicit rule, if there is one, that defines how the ordinate is obtained from the abscissa.
What the inference amounts to in practice is finding what values of the independent variable would result in either a denominator of 0 or the positive even root of a negative number. This sounds like a made-to-order exercise for students of elementary algebra, and so I can understand the temptation to take this path. Still, it does seem to me to go against the very spirit of the subject. Furthermore, I recall seeing someplace a discussion that ran something like this:
A. Why don’t we just agree that the domain of the function is the set of all values for which the formula is meaningful?
B. We can’t do even that, because such a maximal set of such values is not necessarily unique.
Speaker B then goes on to give an explicit example where there is more than one maximal set of numbers satisfying the formula. If I recall correctly, this diaglog was in a book on complex variables, or within a larger discussion regarding complex variables. Of course, we can easily construct a crude counterexample by citing the function that takes every number to its square root: for real numbers the domain is the set of non-negative real numbers, but for complex numbers the domain is the set of all complex numbers. However, I believe the example given by speaker B had something to do with a tricky denominator. Does anyone know the dialog/example I am referring to?
So, I believe the answer to this question is in the negative, but I wanted to see what the community thinks.
After all, here at MSE, we seem to take such exercises in stride, such as here:
and here:
I'll tackle A and B in reverse order.
For someone in pre-calculus/calculus who has to do these types of problems, there are essentially three restrictions on these sets:
Also, the domains are usually restricted to be subsets of $\mathbb{R}^n$. In that situation, any composition of elementary functions has a unique maximal domain. Now, if we shift the domain to $\mathbb{C}$, then we're stepping out of the box of those courses, and then you can argue about choices of principal branch of logarithm or of principal roots…
I think there's a problem with this, but my primary issue is not that this is at odds with the way domains of functions are usually treated in more theoretical courses. In my opinion, the issue is with how domains end up being used. In calculus especially, the concern is not really about a maximal domain (which may be unique in the expected cases), but about a maximal connected domain, which is certainly not unique in general. It is unique when you require a particular point inside, but this is glossed over.
There is a good reader survey at n-cat cafe discussing the issue of "the general antiderivative of $1/x$" and the fact that when you're working on any given side of zero, $\log\left|x\right|+C$ will suffice, but technically not in general. Wikipedia also brings up the similar issue of antiderivatives of $\tan x$. These sorts of issues also come up when students are asked to solve "fairly straightforward" separable differential equations when case distinctions are swept under the rug.
In short, I think maximal connected domains should be emphasized more, because that's what you care about when you have an initial value problem to solve, etc.