Question: What are good examples of functions $f: \Bbb R \rightarrow \Bbb R$ (or $f: D \rightarrow \Bbb R$ with $D \subseteq \Bbb R$) which are not just given by "a formula" (or finitely many formulae on explicitly given intervals), but make sense to a beginner / good high school student?

I know that for a wide enough definition of "formula", that's exactly what a function is. But here, by a formula I mean a finite algebraic expression of real powers of $x$ as well as (inverse) trigonometric functions, exp, logs and absolute values; more or less what one would call elementary functions, and what many students falsely believe to be all functions, which is exactly what I want to counter with such examples.

Background: Teaching a first-year Calculus course (in North America), the first thing I need to make sure is that the students know what a function is. I am aware of the effort pre-calculus teachers put into explaining functions as "input-output-machines", cf. this question. And when talking of functions whose domain and/or range are arbitrary sets, letters, geometric shapes, colours, animals, cars etc., as in those discussions, students know that those functions are not given by an "algebraic formula". However, as soon as we start talking about "real" functions (meaning strictly: those whose domain and range are subsets of $\Bbb R$) I see that, subconsciously, almost every student falls back to the belief that "a function is a formula", in the above narrow sense.

In the first week of such a course one puts in a little (p)review of what functions can be, typically using piecewise defined functions (including ones with some jumps or removable discontinuities). However, these surely feel very artificial to students. Also, even if they quickly take in that information, I fear they now basically believe that a function is a collection of possibly several "elementary formulae", just one at a time / for each "piece".

Obviously I cannot use any of the many non-elementary functions which are given as integrals, power series, or solutions to differential equations, because these are accessible at the end of a calculus lecture (at best).

(Edit: And, cf. discussion in the comments, I should have said that these non-elementary but highly applicable functions are what I eventually want to get at here, and I think every calculus course -- even if it's not aimed at mathematicians -- should care about them. The FT of Calculus (and later, the theories of differential equations and power series) gives us tons of differentiable functions which cannot be expressed by elementary formulae. I firmly believe that many functions encountered in higher engineering and physics are actually of this kind. And students have a very hard time understanding this. Teaching the course before, near the end of the course I have assigned them questions like

What are the zeroes of the function $F(x) = \int_2^x \frac{dt}{\log(t)}$


With the usual curve sketching routine, sketch the graph of the function $G(x) = \int_0^x \frac{\sin(t)}{t} dt$

which should be easy resp. doable for anyone who understands the Fundamental Theorem and the basics of calculus (for the first one, I even give them as hint: there's an obvious one, and then think about whether the function increases). But students struggled a lot with these questions, and I think one of the biggest reasons for that is that they don't "get" what the actual function is; many try to answer the questions for the only functions-given-as-formula they see in there, $1/\log(x)$ resp. $\sin(x)/x$. End Edit)

The best examples I have come up with, which have sort of worked in the classroom, are

  • the prime-counting function $\pi(x)=$ number of primes $\le x$
  • the Dirichlet function $Dir(x) = \mathbf 1_\Bbb Q = \begin{cases} 1 \text{ if } x \in \Bbb Q \\ 0 \text{ if } x \notin \Bbb Q. \end{cases}$

I have also played around with ideas like

  • $f(x) =$ the first decimal place in the standard decimal expansion of $x$ where a 7 appears.

What would you suggest?

  • 3
    $\begingroup$ 2. That said, easy examples are just time series. high temp versus date. closing stock price (or oil price) versus date. $\endgroup$
    – guest
    Sep 15, 2018 at 22:44
  • 1
    $\begingroup$ The two "best examples" you have given can be written as piecewise functions with infinitely many pieces - but, on these infinitely many intervals, their formulae are quite simple. I am not quite sure what you are looking for. $\endgroup$ Sep 16, 2018 at 0:02
  • $\begingroup$ (1) For every polynomial $p$ with real coefficients, let $f(p)$ be the number of its real roots (counting multiplicities). (2) Let $x=(x_n)$ be a sequence of real numbers, $f(x)=1$ or $0$ depending on whether $\sum\limits_{\mathbb{N}} a_k$ converges or diverges. $\endgroup$
    – user5402
    Sep 16, 2018 at 13:19
  • $\begingroup$ @BenjaminDickman: Sure you can go and say that every function is piecewise constant. Although not only the most radical finitists might raise concerns about that as soon as we have infinitely many pieces (and/or, as is the case with the prime-counting function, computing those pieces is what computing the function is actually about). Anyway, I have changed the wording of that bit, does that address your concern and make it clearer? $\endgroup$ Sep 16, 2018 at 17:04
  • 1
    $\begingroup$ @BPP: Your first function does not have a subset of the reals as its domain, and I do not understand the definition of your second function; assuming your $a$'s are supposed to be $x$'s, its domain seems to be $\Bbb R^\Bbb N$. $\endgroup$ Sep 16, 2018 at 20:04

3 Answers 3


How about $f: \mathbb{R} \to \mathbb{R}$ defined by $f(x) = y$ where $y$ is the unique solution to $y^5+x^2y+5=0$? This does not have an elementary formula, but students can understand that for any value of $x$ the function $g(y) = y^5+x^2y+5$ is increasing (and the limits at $\pm \infty$ are $\pm \infty$), so it must have a unique root for each $x$. You could contrast this with $y^5+xy+5$, which does not always have unique solutions, and so does not define a function. Desmos can graph these easily as well.

It might be better to use this example as part of your introduction to implicit differentiation though.

  • 1
    $\begingroup$ Thank you very much. As you suggest, I would not use it as an example at the beginning of the course, but maybe indeed when we do implicit differentiation (which is a good moment to remember which equations define functions anyway). I am delighted to see I can also use it to remind them of the Intermediate Value Theorem then! $\endgroup$ Sep 22, 2018 at 4:32

Consider also very simple piecewise functions, such as the sign function and Heaviside function. Though they are trivially given by formulae, the formulae are so simple (being only constants) that the students are unlikely to think of them as formulae. They can be composed with other functions; of the composite functions of sign and sine, for example, one is more interesting than the other.

The idea here is to try to crate intuition from the direction of very easy examples, which might not fit the intuition the students have of functions. The sign function, for example, has a very nice interpretation and can still be written by using the typical notation for piecewise defined functions.

Also, both the sign function and Heaviside function have applications and might be encountered later by the students. In particular the (surprisingly tricky) absolute value function can be written with the help of a sign function, if one wishes to.

  • 1
    $\begingroup$ Thank you very much. This is a good answer to the question if not literally then certainly in spirit, and in my eyes would deserve more upvotes. The remark that some formulae are so simple they are not perceived as formulae is interesting and worthwhile. $\endgroup$ Sep 22, 2018 at 4:35

I think it is enough to discuss $f(x) = x^2$ and toy around with what happens when different domains are given for $f$. Or, better yet, to discuss the idea of restriction and extension. It is important for them to know the default custom that we take the domain to be as large as the formula allows. For $f(x)=x^2$ that is naturally the whole set of reals $\mathbb{R}$. So, what if $x$ represents something that cannot be negative ? Then we state $\text{dom}(f) = [0, \infty)$ for physical reasons.

A good physical example would be projectile motion where we hit a ball at height $y_o$ above the ground at some angle $\theta$ with speed $v_o$ then $$ y = y_o+tv_o\sin \theta-\frac{g}{2}t^2 $$ what is the domain for $y$ as a function of time ? If we just go by the formula above then the answer would appear to be $\mathbb{R}$. However, the formula fails to be applicable in the time before the ball is thrown or hit. In fact, for time a bit smaller than zero, probably $y = y_o$ is constant. Where the ball was before that is a truly complicated question which no reasonable person would try to find a formula to describe.

My point is simply that formulas for functions are often sensible mathematically far outside their common sense application. Just because the math says something, that doesn't make it so. However, usually the math means something at least hypothetical. In my projectile example, if we solve $y=0$ that gives a quadratic in $t$ with a positive and negative time solution. The meaning of the positive time solution is simply the time it hits the $y=0$ ground. On the other hand, the negative time solution corresponds to the time when a person would have thrown a ball from ground level so that it appears as if you threw it with the given speed and angle at $y_o$. Is that interesting? Perhaps.

I'm not sure I've helped with your quest.

Here's a purely mathematical one. Use the ceiling or floor function followed by keeping the remainder upon division by $n$ of your choosing. Guess you can't write a formula for that without a lot of trouble, but we should understand the rule.

  • $\begingroup$ Thank you very much. I upvoted the answer (someone else must have downvoted), certainly already for the ceiling and floor function. Your main point is a bit beside what I was asking for, but it's certainly worth thinking about as well, and good to raise in class when one does applications and mathematical models. $\endgroup$ Sep 22, 2018 at 4:39
  • 2
    $\begingroup$ No problem, I knew there would be other answers outside the direction of my own and I am content for them to get all the up votes. I'm just happy to have a forum where we can share such ideas when our time and/or interest allows. $\endgroup$ Sep 22, 2018 at 15:11

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.