# Functions, Domains, and Ranges in Precalculus

Possibly related, though of a different flavour.

### Background

In most of the precalculus texts with which I am familiar, readers/students are given a crash course in set theory, handed the definition of a relation, then told that a function is a special kind of relation that associates only one element of the codomain to each element of the domain. For example, a relevant screenshot from Sullivan's Precalculus: This is, of course, entirely correct. A function is defined by its domain, its codomain, and how it associates elements of the domain with elements of the codomain.

The problem I have with this standard approach is that students are often asked to answer questions of the type

Let $f(x) := \sqrt{x+3}$. What are the the domain and range $f$?.

It seems that students are meant to implicitly understand that $f$ is a real-valued function of a real variable. However, as neither is actually specified, there are two reasonable answers:

1. The domain is $\mathbb{R}$. In this case, the codomain is $\mathbb{C}$, at which point the question of the range becomes quite difficult, as I imagine we don't want to talk about branches of complex functions in a precalculus class. Unfortunately, most of my college freshman precalculus students have been exposed (if only briefly) to complex numbers in their high school algebra classes, so they often want to argue that $\sqrt{-4} = -2i$, and therefore there is no issue with negative real numbers.
2. The domain is $[-3,\infty)$, in which case I would argue that the question is ill-posed, and might better be written

Let $f(x) := \sqrt{x+3}$. What is the largest set of real numbers on which this formula defines a function with codomain $\mathbb{R}$? What is the range of this function?

This seems reasonable, but there is something about it that just "tastes" off to me. I can't really put my finger on the discomfort, but I feel like this approach causes some confusion when we describe restricting domains in order to define inverse functions.

I am also concerned that this approach elides the importance of specifying the domain before defining a function---a function without a specified domain doesn't even make sense, so what is the notation $f(x)$ meant to represent?

### My Solution

Instead of taking the traditional route, I am considering the introduction of a slightly modified definition of a function:

A function $f : X \to Y$ is a relation that associates to each element of $X$ at most one element of $Y$. The set $X$ is called the natural domain, and the set $Y$ is called the natural range (or codomain). If $x\in X$ and there is some $y\in Y$ such that $f$ associates $y$ to $x$, then we write $x\mapsto y$ and say that $y$ is the image of $f$ at $x$. The set of all $x\in X$ such that $x\mapsto y$ for some $y\in Y$ is called the domain of $f$, and the set of all $y$ such that $x \mapsto y$ for some $x\in X$ is called the range of $f$.

Here the question of the domain and range of $f(x) := \sqrt{x+3}$ becomes straightforward:

Define a function $f : \mathbb{R} \to \mathbb{R}$ by $f(x) := \sqrt{x+3}$. What are the domain and range of $f$?

Additionally, we continue to emphasize the fact that the collection of possible inputs and outputs is specified in advance, thus dealing with the potential observation that imaginary numbers exist---we've already ruled them out as outputs by specifying the codomain.

I don't think that this approach is entirely unreasonable, and it even has some moderate precedent. For example, when dealing with unbounded operators on Banach spaces, we understand that the operators naturally live on the Banach space, but must be restricted to the domain where they actually make sense.

### Questions

1. In writing $f : X \to Y$, we are saying that $X$ is the largest set of values that we want to consider as inputs, rather than the actual set of inputs. The emphasis is on first determining the universe of possible inputs, then deciding on which inputs are actually valid (as opposed to the reverse). Does this seem like a reasonable approach?

2. This is nonstandard, and actively conflicts with the usual notation. However, most of my precalculus students are unlikely to take higher math (indeed, for many of them precalculus is a terminal math class), and I think that those going on to calculus or even proofs-based math classes should be just fine. As such, am I causing any harm if I introduce the concepts in this way?

3. Am I missing anything important? Is there any obvious drawback to this approach?

• for some folks, me usually, writing $f: A \rightarrow B$ a function indicates that $A$ is the domain of $f$. That said, I feel your pain... – James S. Cook Aug 13 '17 at 18:23
• Another twist of language which would allow you the same discussion: say $f$ is a real valued function of a real variable with formula $f(x) = \sqrt{x+3}$. Then, the customary domain is the greediest one possible. In particular, $dom(f) = [-3, \infty)$. On the other hand, $f: [0,1] \rightarrow \mathbb{R}$ s.t. $f(x) = \sqrt{x+3}$ defines a different function with the same formula. We should remember, it took professional mathematicians a long time to sort this stuff out in a standard fashion... – James S. Cook Aug 14 '17 at 1:05
• I think you're leaving out the fact that two sections later Sullivan writes, "Often the domain of a function $f$ is not specified; instead, only the equation defining the function is given. In such cases, we agree that the domain of $f$ is the largest set of real numbers for which the value $f(x)$ is a real number." I think this makes the meaning of those questions sufficiently well-defined, and is common in books at that level (e.g., Ratti/McWaters Precalculus highlights it as the "Agreement on Domain"). Beyond that I think people are quibbling over phrasing. – Daniel R. Collins Aug 14 '17 at 4:54
• Don't overthink it. At this level, a function essentially is a formula for computing with real numbers. Some formulas involve division, square roots, or (later in the course) logarithms. You can't divide by 0, take the square root of a negative number, or take the logarithm of a non-positive number. The domain is where such bad things don't happen. Math or CS majors will eventually develop a more sophisticated understanding of functions, but precalc isn't the place. Just get them to the point where they can do basic calculus without committing major algebraic or trigonometric blunders. – John Coleman Aug 14 '17 at 13:19
• I personally think that the most important thing for a Calculus student to understand about domains is that, for example, $\frac{x^2-1}{x-1}$ is equal to $x+1$ on their common domain, but that they are not the same function because their domains differ. This is very important distinction to make when thinking about limits. – Steven Gubkin Aug 14 '17 at 18:34

The notion you are considering is called a partial function. When working with such things, ordinary functions are called total functions.

(aside: the category of sets and partial functions turns out to be equivalent to the category of pointed sets and point-preserving functions)

You should probably emphasize that you are not teaching the ordinary notion of function, but instead a generalization.

As a mathematician who has no experience teaching this stuff (aside from being on mse and the like) but has spent some amount of time thinking through what doing math with partial functions rather than functions would be like, I think there are two features that probably make this a bad idea for an isolated introductory class. (which is a shame, because I think many low level classes really want to work with partial functions instead of functions)

The first is that, IMO, it strongly engenders a subtly different notion of what an "object" is. Probably the simplest way to put it is as follows.

Let $I$ be a set with one element. The notion of "an element of the set $X$" is basically the same thing as "a (total) function $I \to X$"

When doing algebra in terms of partial functions, one should be working with what I would call "a partial element of the set $X$", which is basically the same thing as "a partial function $I \to X$".

While this has some appealing features — e.g. we could introduce the term "undefined element" to mean the partial element corresponding to the partial function with empty domain — my impression is that its nuances would be extremely difficult to teach to someone who didn't already have a good grasp of functions and mathematical grammar.

The question then, I suppose, is how confused a student that doesn't grasp the nuances between the two notions of element will be if they learn one way and everything else they encounter is the other way.

The other is an ambiguity in basic logic. Suppose we define the square root as a partial function from the reals to itself; in particular, negative numbers are not in its domain. Consider the equation

$$\sqrt{-1} = 1$$

Is this false? Or does it have an undefined truth value?

And consider

$$\sqrt{-1} = \sqrt{-2}$$

I could plausibly argue all three possibilities of true, false, and undefined.

The problem is, I think, that there isn't a right answer: there are at least two good answers. And I think you need both of these subtly different notions of what an equation means in order to reason properly.

• Ah ha! I figured that someone with better knowledge of algebra and/or category theory could point me in the right direction! Thanks! I'll have to look into partial functions a bit more. – Xander Henderson Aug 15 '17 at 2:31

This is bit too long for a good comment so I'll add it as an answer. When I teach this material to calculus students, many of whom are not math majors, I take the following approach:

If we are given $f(x)$ as some formula in $x$ then we define the $\text{dom}(f)$ to be the largest set of real numbers for which the evaluation of $f$ returns a single value. Or, in other words, make the domain of $f$ as greedy as possible in real terms.

For example, $f(x) = \ln(x)$ has $\text{dom}(f) = (0, \infty)$ or $f(x) =1/ \sqrt{1-x}$ has $\text{dom}(f) = (-\infty, 1)$. Then I warn them that we have the freedom to make the domain smaller than this greedy choice. We can always make it smaller. How? Well, just state it directly. This gives me a chance to remind them that proper mathematics is about more than mere formulas. We need sentences and logic to communicate the structure we wish to analyze. Hopefully this discussion then naturally feeds into our discussion of inverse functions where the idea of local inverse demands some discussion of restriction. For example, we start with $f(x) = \sin(x)$ (so, the greedy domain is $\mathbb{R}$ as $\sin(x)$ makes sense for any real $x$). But, $\sin(x)$ is not one-to-one (it fails the horizontal line test) if our domain includes more than one cycle of sine. So, to obtain an inverse we restrict sine to $[-\pi/2, \pi/2]$... I think Hurkyl is right, we do think about partial functions in such courses without admitting it.

I say yes reasonable approach. Stewart-Redlin-Watson write "We usually consider functions for which the sets A and B are sets of real numbers." in their precalculus text. In a footnote on page 46 of 10th edition Sullivan writes the same:

The sets X and Y will usually be sets of real numbers, in which case a (real) function results. The two sets can also be sets of complex numbers, and then we have defined a complex function. In the broad definition (proposed by Lejeune Dirichlet), X and Y can be any two sets.

Also, you are reasonable because on page 52 of 10th edition Sullivan writes (as Daniel R. Collins mentions above):

Often the domain of a function f is not specified; instead, only the equation defining the function is given. In such cases, we agree that the domain of f is the largest set of real numbers for which the value f(x) is a real number.

In short, your approach is consistent with the approach of your text. Perhaps you could give a similar speech to the effect of "hey, when we math people ask each other questions, sometimes there's a lot going on behind the scenes, like assumptions that we are all making together, maybe we could talk about that for a few minutes." I've always lectured "First of all, functions in this class will have real inputs because you are preparing to take calculus of a single real variable. Calculus with complex variables is a thing, but don't worry about that right now. That means your response to solving x^2+1=0 should be 'no real solutions' instead of plus or minus i. Second, the domain of a function is what I say it is. I get to pick it. If you write a function, you get to pick the domain, every single time. If I fail to pick a domain or don't say anything, you must assume that it's the natural domain, or the largest possible domain."

Let $f(x) := \sqrt{x+3}$. What are the the domain and range $f$?

You are right to be concerned about such questions. Technically, you cannot define a function without specifying its domain and codomain. And if you haven't specified the domain, you cannot determine the range. The domain in this case could be $[-3,+\infty)$. Or it could be $[0,1]$. Such questions should probably be banned from the curriculum. There must be other ways to test students' understanding of the terminology.