# Example of function with *all* the features of differential calculus at first-year level

I'm teaching a first-year calculus course, that is mid-way between a first intro to university-level calculus, and intro to real analysis (I'm based in Australia, for reference). We assume the intermediate value and extreme value theorems, but do proofs for Rolle's, MVT, l'Hôpital and other elementary theorems. (A slightly less than rigorous definition of limit is given, but I explained the idea of the epsilon-delta definition in words.) I was wondering if anyone has seen examples of a function or functions written down that displays a combination of all the features one might consider illustrating in such a course? A vain hope is that one could have a small collection of functions (no more than two or three) that combine, among them all the features one might want to illustrate over the course.

I'm not sure this would be helpful, but I feel it would be interesting to students to see a more complicated function than familiar elementary functions, but which they gain all the tools to analyse over various intervals in the domain over the course.

EDIT: perhaps I wasn't clear: I would be interested in hearing if people have seen a short list--no more than three or so--of explicit functions displaying as many features that get taught in first-year calculus as possible. I don't mean families or classes of functions. If the answer is no, comments to that effect from people who can say 'I've been teaching for 40 years in country X (and Y and...) and never seen such a thing' would be useful. Or perhaps someone can offer sound grounded and sound practice-driven advice on why such a thing would be useless or even detrimental to students appreciation, even if offered alongside a plethora of small and simpler bite-sized examples.

• The question isn't very clear. A function by itself doesn't illustrate anything.
– user507
Jan 30 '16 at 0:04
• The collection of elementary functions (polynomials, ratios of polynomials, exponentials, logarithms, trigonometric functions) provide plenty of interesting examples of behaviour. Jan 30 '16 at 0:08
• @vonbrand clearly. "a small collection of functions (no more than two or three)" means literally two or three functions, not a small class of functions. We are currently using lots of polynomial to illustrate things, but they are misleading as they are so nice. Jan 30 '16 at 3:24
• The pdfs of probability distributions have good examples for continuity: the uniform distribution is discontinuous, the Laplace distribution has discontinuous first derivative, the split-normal distribution has discontinuous second derivative.
– user173
Jan 30 '16 at 19:57
• @vonbrand oh no, it's not to study such a small collection of examples, but to show that a function can have all the possible behaviours studied, and we don't group functions nicely according to what they do and don't do for each particular subsection of the course. It's hard to tell students that "most" continuous functions (in the sense of Baire category) are nowhere differentiable, when they don't know the topology, or examples. But one can show them that not all functions are as nice as elementary functions. Feb 3 '16 at 14:22

I'm a fan of hidden case-wise formulas. Principle building block in this world is the absolute value function $|x| = \sqrt{x^2}$. Already, we have a function which is continuous, but, not differentiable at $0$. This gives a counter-example for a misuse of the Mean Value Theorem: if $f(x) = \sqrt{x^2}$ then $f(-1)=f(1)=1$ yet, nowhere in $[-1,1]$ do we find zero derivative. Oops, it seems I just gave an example of Rolle's Theorem failing. Not really. Of course $f$ is not differentiable everywhere in $(-1,1)$. The formula seems innocent enough, it's just the square and root function. Differentiation yields another misbehaving function: $$\frac{d}{dx}\sqrt{x^2} = \frac{2x}{2\sqrt{x^2}} = \frac{x}{\sqrt{x^2}}$$ Let $g(x) = \frac{x}{\sqrt{x^2}}$ then this function is discontinuous at $x=0$ but elsewhere constant. Note, $g'(x)=0$ for $x \neq 0$, yet, $g$ is not globally constant. This weirdness is possible since the domain of $g$ is disconnected.

In Penrose's Road to Reality he studies the function $h(x) = x|x| = x \sqrt{x^2}$. This gives us a differentible function which is not twice differentiable at $x=0$. Indeed, the function $f_n(x) = x^n|x|$ is an easy example of the function which has $n$-derivatives at $x=0$, but, the $(n+1)$-th derivative does not exist at $x=0$.

I'm not quite sure what you're after, but, I think I've made the case for the absolute value function. We have a simple formula, but, simple twists on it give rather varied behaviour.

Beyond this, I also think it is interesting to study the interplay between vertical and horizontal behaviour of the function and its inverse function. For example, horizontal tangents of sine translate to vertical tangents of inverse sine. Or, just the simple idea of graphing the same shape horizontally verses vertically. The connection between the slopes, increasing paired with increasing, or decreasing with decreasing. Much to explore here there is.

• Thanks for the example of $x^n|x|$ - I didn't know about that! Jan 31 '16 at 21:08
• The other thing about $x|x|$ is that it tests the student on logic... if $f$ and $g$ are differentiable, then $fg$ is differentiable... but $f$ not differentiable does not imply that $fg$ not differentiable. Feb 1 '16 at 11:43
• Coming back to this, and I should have picked this up earlier, it's not correct that the $n$th derivative of your $f_n$ is discontinuous at 0, since the derivative from first principles of $x|x|$ is $2|x|$ (yes, treating $x>0$, $x<0$ and $x=0$ cases carefully). The correct statement I believe is that $f_n$ has $n$ derivatives at 0, but not $n+1$. Feb 6 '16 at 13:39
• @DavidRoberts that is true, I shall edit accordingly. Feb 6 '16 at 18:14

I guess I'm not going to get get quite a small list as I'd hoped for, but I'm falling in love with the family of functions $f_{p,n}(x) = p(x)e^{-1/x}/x^{2n}$, for $p$ a polynomial and $x>0$, and $f(x) = 0$ otherwise. The case $n=0$ and $p(x)=1$ is the classic example of a smooth but nonanalytic function, and all its derivatives fall in this family. One can ask all sorts of questions about a function from this family (and, I guess, one could replace $p$ by any function that has all derivatives at $0$). Considering even just $f_{1,0}$, it's bounded but has no maximum; has an inflection point, even though $e^x$ doesn't; one can talk about continuity at 0, differentiability at 0 and continuity of the differential; one can consider its Taylor expansions around positive $a$, and at zero, and discuss radii of convergence, and so on. This function is important, looking at higher levels of analysis and geometry, for constructing bump functions, limits of which are indicator functions of intervals, for constructing partitions of unity etc.

A classical example: the functions $f_k$ defined by $f_k(0)=0$ and $f_k(x)=x^k\sin(1/x)$ for non-zero $x$, with $k=1,2,3$.

• Its continuity is easy but not of the "as sum and product and composition of continuous functions" kind, and it is unbounded but has no (even infinite) limit in $\pm\infty$,

• with $k=2$ we get a function that is derivable everywhere but not $C^1$; one can check that the derivative satisfies the conclusion of the intermediate value theorem (as any derivative must!) even if it is not continuous (note that I vaguely remember being told that at some point in history the IVT was taken as the definition of continuity),

• with $k=3$ it is the classical example to illustrate that a continuous function which is $C^1$ outside a point, with derivative converging at that point must be $C^1$; it also yields an example of function having a second-order Taylor expansion without being twice differentiable.

I guess some other stuff can be further illustrated with those, but it feels already good for three functions (four if you include $x\mapsto x\cos(1/x)$ which shows up in the derivative of $f_3$).