In high school (in the US, at least), it is common to define the domain of a function as the set of real numbers for which the function is well-defined and returns a real result. Then students are asked questions like, "What is the domain of $f(x) = x^2$?"

In most university-level classes, the domain and codomain of a function are simply part of the definition of a function. When I define a function $f$, I write "Let $f : A \to B$ be the function given by $f(x) = \ldots$" In this context, the question of what the domain of a function becomes trivial.

It's my opinion that the second approach is superior, as we don't always want the domain to be the largest set possible, nor do we always deal with only functions of real numbers. And of course changing the domain and codomain can change properties of the function (e.g., injectivity).

My question is: why, historically and pedagogically, do we teach domain this way in high school?

  • $\begingroup$ While I am maybe slightly embarrassed to link to this question, I think that it is relevant (or, at least, tangentially related). I also linked to this question in my question. $\endgroup$
    – Xander Henderson
    Commented Nov 24, 2021 at 21:41
  • 7
    $\begingroup$ For what it is worth, I have seen this referred to as the "implied domain" (Paul Sisson, Precalculus) and the "natural domain" (Thomas' Calculus, 13th ed). In the 2nd edition of Stewart's Calculus, he does not comment about this potential ambiguity, and asks questions like "What is the domain of $f(x) = 1/x$?" $\endgroup$
    – Xander Henderson
    Commented Nov 24, 2021 at 21:46
  • 7
    $\begingroup$ I've seen worse. Some high school teachers insist on the importance that the domain is part of the definition of a function, during the theory part of the class; then during the exercises session, they give an expression and ask "what is the domain of ...?". This left students confused because the two conflicting definitions were used alternatively by the same teacher without any explanation. $\endgroup$
    – Stef
    Commented Nov 25, 2021 at 14:27
  • 1
    $\begingroup$ Not to answer in a comment, but just a thought here - could it be as simple as "almost all of those students will never use higher mathematics?" $\endgroup$
    – corsiKa
    Commented Nov 26, 2021 at 6:27
  • 1
    $\begingroup$ Because not all of your high-school math students are going to major in theoretical math in college (I was one of the few from my class). And if they become engineers, chemists, physicists, etc. they will still be using those same kind of definitions from high-school math, and occasionally, they will still have to look at such a function "definition" and answer the question "what's the domain for this function". $\endgroup$ Commented Nov 26, 2021 at 17:08

5 Answers 5


In real-world applications, the typical case is that the domain is neither implicit in an expression we write down, nor explicitly stated along with the expression. Rather, one uses knowledge of the real world to decide what numbers make sense as inputs to the function. So for example, if $x$ represents an investment, and $f(x)=x-3$ represents the profit on that investment, then we need to look at the business context to decide what values of $x$ make sense. If we're selling short in the stock market, then $x<0$ could make sense. If we're buying a fast-food franchise, then the domain is something like $x>a$, where $a$ is some fairly large, positive amount of money.

In applications, it's sort of a modern mathematical lie-told-to-children that one variable is a function of the other. In the era of Gauss and Euler, there was no such notion of a function, just relations between variables. In physics, there are typically no cause-and-effect relationships. For example, in Newton's second law $a=F/m$ the acceleration is often thought of as an effect due to the force, but in reality, there is no such cause-and-effect relationship mathematically inherent in Newton's laws. Laws of physics are typically just differential equations, and they have time-reversal symmetry. Often we solve an entire problem and find a relationship between $x$ and $y$, and only then do we worry about what's a function of what or what parts of the $(x,y)$ plane are meaningful in the real world. So for example, if a weight $w$ is hung from the middle of a cord, which is slanted at an angle $\theta$, it's not true that $w$ causes $\theta$ or that $\theta$ causes $w$. And only at the end of solving the problem would we be likely to be able to clarify for ourselves that $\theta=0$ is not physically possible.

An obvious disadvantage of always stating domains explicitly is that it would be a pain. For instance, if a calculus textbook has 100 exercises in which students differentiate given functions, we just want to be able to write something like $\sin(x^2)$, without having to write a lot of irrelevant words. What would be the point here of restricting the values of $x$? When we calculate the derivative, we get an expression that is some function that, even if restricted to some smaller domain, could be analytically extended in a unique and natural way to the whole real line. And of course, we're doing freshman calculus, so the domain of discourse is the real line. It's very normal to do mathematics with an implied domain of discourse, e.g., every axiomatic presentation of Euclidean plane geometry is going to have an implied domain of discourse which is the plane.

  • 4
    $\begingroup$ Also in higher mathematics it is often useful to let the function determine the domain, and not the other way around. For example, Riemann surfaces in complex analysis, and unbounded operators in functional analysis. $\endgroup$
    – Nick Alger
    Commented Nov 26, 2021 at 11:24
  • $\begingroup$ @NickAlger: I think it's an oversimplification to say that one lets "the function determine the domain" for unbounded operators: for many differential operators on function spaces there is indeed somekind a maximal domain in the sense that the operator a priori acts on distributions, and its part in the function space under consideration then gives us the maximal domain on this function space. However, this maximal domain is typically too large and needs to be restricted further (by taking boundary conditions into account) in order to obtain well-posedness of the associated PDE. $\endgroup$ Commented Nov 27, 2021 at 22:21
  • $\begingroup$ @JochenGlueck Sure. I guess the wording "determine" is the issue, because even more information may be needed to fully determine the domain of an unbounded operator. But this further strengthens the point that it can be be useful to view the domain of a function as a fluid thing. $\endgroup$
    – Nick Alger
    Commented Nov 28, 2021 at 0:04
  • $\begingroup$ As @JochenGlueck notes, it is not the case in general that an unbounded operator naturally determines a "maximal" domain: for example, in the von Neumann classification, a (naturally defined) symmetric operator may have a continuum of not-mutually comparable self-adjoint extensions... or may have none. The tangible illustration is in $Tu=u''$ on a finite interval, where the different extensions correspond to different boundary conditions. $\endgroup$ Commented Nov 21, 2022 at 20:09

We give high-schoolers many different explanations of the word "function." Here are a few that are either implied or outright stated at various points in a student's education:

  1. A function is an expression in terms of $x$. This is pretty unusual all by itself, but it may appear in conjunction with (2) or (3) (i.e. students may reason that $f(x)$ or $y$ is the function, and since $f(x)$ equals some expression, therefore the expression is the function too). Students may become uncomfortable if the variable is not $x$.
  2. A function is an equation of the form $f(x) = \mathrm{[something]}$, where [something] is in terms of $x$. Students may believe that the function can be subsequently "abbreviated" as $f(x)$. If there is also a $g(x)$ and you're teaching function compositions, then there will often be confusion about how $x$ can have "multiple different values" (i.e. when you write $f(g(x))$, the value that is given to $f$ is "not the same" as the value that is given to $g$, but some students may believe that both values are $x$ because that's how $f(x)$ is written); students may reconcile this by blindly applying the correct substitution without understanding what they are doing. But it gets them points on the exam or homework, so the student thinks they are learning.
  3. A function is an equation of the form $y = \mathrm{[something]}$, where [something] is in terms of $x$. Students may believe that it specifically has to be $x$ and $y$, in the right order, rather than any other pair of variables.
  4. A function is a set of ordered pairs $(x, y)$, such that no two (distinct) pairs have the same $x$. The word "distinct" is often omitted from this definition, but it probably doesn't matter in practice because students are generally going to assume that's what it means anyway.
  5. As in (2), but allowing for piecewise notation. Students may believe that piecewise functions are somehow "less valid" than "regular" functions, and/or try to rewrite piecewise functions as non-piecewise functions. For that matter, students believe that there is a such thing as "a piecewise function" in the first place.
  6. As in (3), but allowing for implicit functions. Again, students may resist implicit functions, but solving an implicit function for $y$ is at least a useful activity some of the time.

All of these definitions are at best incomplete and at worst outright wrong. (4) is somewhat close to being right, but like all of these definitions, it does not supply a codomain and therefore cannot explain the concept of a surjective function (for example, if you take the floor function over $\mathbb{R} \rightarrow \mathbb{R}$, it is not surjective, but if you take it over $\mathbb{R} \rightarrow \mathbb{Z}$, it is surjective, yet both of these functions contain exactly the same set of ordered pairs in their respective graphs). Unlike the other definitions, (4) does imply a specific domain - the domain is just the set of $x$ coordinates. However, students might not notice this subtlety, and the existence of the other (wronger) definitions tends to deemphasize the idea that the domain can be chosen arbitrarily. (4) is also incompatible with algebraic and (for the most part) analytic manipulation, so students will have to work with the other definitions regardless of what they think of (4).

There is one exercise at the high-school level that does describe functions more or less correctly, but it tends to get neglected in favor of the definitions given above. It usually looks like this: Students are shown a diagram with two adjacent ellipses or circles, each containing a small number of labeled points, and arrows from points in the left ellipse to points in the right ellipse. Students are then (correctly) told that these diagrams show (binary) relations, and are typically asked to identify which relations are functions, one-to-one, etc. These diagrams contain all of the required elements of a function, including the codomain. However, this visualization is usually dropped in favor of the so-called "vertical line test" (i.e. draw vertical lines through the graph of a function, and make sure that each line intersects the graph at most once) and "horizontal line test" (the same, but with horizontal lines), which can be used on infinite relations/functions (unlike drawing out an explicit relation diagram one point at a time). I suspect that many students prefer the vertical/horizontal line tests, because they are specific "recipes" that students can use to "get the right answer" and do well on exams or homework (whereas trying to visualize infinitely many arrows between points is going to be difficult at best).

The other serious problem at the high-school level is that most students don't properly appreciate the distinction between $f$ and $f(x)$. Of course, mathematicians often ignore this distinction as well, because it's a rather fine and technical distinction which only sometimes matters, but many students are not even aware that there is a distinction to be drawn in the first place. If you cannot even write $f$ by itself without confusing half the class, how do you expect them to understand $f: A \rightarrow B$?

TL;DR: We don't give students a proper explanation of "domain" because we don't give them a proper explanation of "function," and that in turn is because of high-school's emphasis on algebra, graphing, and other specific ways of applying the math, rather than on a broader conceptual foundation.

  • 5
    $\begingroup$ This isn’t universal. In high school I was taught that a relation is any subset of a Cartesian cross product between two sets, and that a function is a special kind of relation. $\endgroup$ Commented Nov 25, 2021 at 17:21
  • 2
    $\begingroup$ Some of the confusion of what a function is has crept into your answer: you refer to a "piecewise function", There's no such thing as a "piecewise function". The correct term is "piecewise defined function"; "piecewise" is a property of how the definition of a function is expressed, not the function itself. $\endgroup$ Commented Nov 25, 2021 at 22:55
  • 1
    $\begingroup$ Great answer BTW. I remain convinced that the solution to the conundrum would be to teach lambda calculus in primary school, but somehow doubt that will ever happen. $\endgroup$ Commented Nov 25, 2021 at 23:19
  • 1
    $\begingroup$ @ToddWilcox: A "subset of a Cartesian product" does not tell you what the original sets were, so the definition you describe is equivalent to (4) (just with fancier vocabulary). You need additional structure, on top of the graph of the function, in order for it to really qualify as a function. $\endgroup$
    – Kevin
    Commented Nov 26, 2021 at 23:33
  • 1
    $\begingroup$ In some formulations of mathematics, a function is defined in terms of its graph. I.e as a particular kind of relation. The "original sets" are part of the definition (a function f from A->B is a subset of A x B such that for all t1, t2 in f, t1_1=t2_1 => t1 = t2). No additional structure is needed. I am not saying this is "right" just that it is entirely adequate and (1) the version I was taught aged 12 at school and (2) the version used in my mathematics degree. $\endgroup$ Commented Nov 27, 2021 at 9:47

In my high school days (1970s), the set of all numbers for which an expression is defined (and, implicitly, real) was called the “natural domain” of the function defined by the expression. The domain of a function with an unspecified domain was to be understood to be its natural domain, a convenient assumption. I’m not sure this is an accurate answer to why pedagogically it was done, but it seemed important that we be able to determine when an expression is defined. We also had to determine the domain of a composition, a somewhat complicated process that required patience and care and was easy (for me) to blunder through.


At A-level (16+ in the UK) students are never asked questions such as "what is the domain of $f(x)=x^2$ in formal examination questions. In my teaching I mention that such a question is meaningless, the domain is part of the definition of the function and the function isn't fully defined until a domain is given.

Question papers are careful always to state the domain - a matter of confusion when students are answering questions in which the domain is not very relevant: "What are we supposed to do with the $x\in \mathbb{R}$?" is a fairly common question (and in many cases the answer is "nothing, its just there ensure the function is fully defined".

The only context in which students are asked for a domain is when they are defining a function themselves, generally as an inverse or composition of functions. So it would be a valid question to state

$f(x) = 2x +1, x\in\mathbb{R}\ x>2$. Find the inverse function $f^{-1}$.

Students would then only be awarded full marks if they gave both a formula for the inverse and its domain. The domain is required, even when it is not explicitly asked for.

The disconnect with higher maths is that a co-domain is never mentioned, so questions of a function being "onto" can't be considered.


At the secondary level, students tend to think of "real numbers" as being literal: any number that isn't in the real number system isn't a "real number", and any time you're given a variable, the default is that it can be any real number, and the default is that a function applies to all real numbers. The idea of a function that takes positive $x$ to $2x$, and simply isn't defined on nonpositive numbers, is hard to grasp; why would it also take negative $x$ to $2x$? Unless there's some reason why it can't be defined in a region, they will take it as defined in that region. And the idea of, say, a function from the equivalence classes of $(x-y \in \mathbb N)\rightarrow x \sim y$ to points on a circle is going to make them very confused.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.