Math is hard. But also fun. I think?
I went to office hours for my math class today with a few of my friends, and somehow we went from talking about taking 2 dimensional limits to weird functions to quaternions. I understood maybe half of it and yet somehow, it still gave me a migraine for the rest of the day. But at the very least, I got a cool math book (Counterexamples in Analysis by Bernard R. Gelbaum and John M. H. Olmsted) so I really can’t complain too much.
Quoting my math professor, “There are two types of mathematicians – ones who love counterexamples, and ones who hate them.” I’m pretty sure I fall into the first category. I’m not the biggest enthusiast of death by proofs, but I can appreciate the endeavor of creatively breaking the foundations of everything we thought was true, making us question reality and ruining everyone’s day in the process. I’m mostly kidding. But counterexamples do expose the limitations of our theorems and definitions, which can often be contradictory to our intuition. It gives us a glimpse of what can go wrong if we aren’t careful with our assumptions, and the reasons behind why simple ideas can be seemingly overcomplicated. That’s why I love counterexamples so much, so I’m going to share a few of my favorite ones from both the book and my prior knowledge.
Conway’s Base 13 Function
The intermediate value theorem (IVT) states that given a continuous function f(x), for any value N such that f(a) ≤ N ≤ f(b), there exists a point c such that a ≤ c ≤ b and f(c) = N. In other words, if we have a continuous function called f(x) and we choose 2 points on its domain called a and b, any number between f(a) and f(b) will correspond to a point c that lies between points a and b.
Now the question to ask is, “Is the converse true?” If we have two points on a function called f(a) and f(b) and all of the values between f(a) and f(b) correspond to a point between a and b, does this mean the function is continuous? Here’s how John Conway disproved that statement:
Convert a number from its decimal representation into base-13 (digits 0-9, A,B,C). Substitute in “+” for A, “-” for B, and “.” for C. This will give you something like 8–94.2+2.304, which of course is not a valid number. However, we define the function output to be the very end of that sequence that still looks like a valid number. In our example, it would be 2.304. If no such number exists, then the output is 0.
This crazy function is nothing like any function you’ll have seen in a high school math class. Like, can this even be considered a valid function? A quick check tells you that every input maps to exactly one output, therefore passing the vertical line test. But how does this act as a counterexample to the converse of the IVT? Well, let’s pick a random output between f(a) and f(b). What we can then do, is selectively choose which digits/symbols to add in front of that output such that when we convert it to base 13 and then back to base 10, our output will be some number in between a and b. Since this holds true for any value in between f(a) and f(b), it satisfies the converse of the IVT despite being a discontinuous function everywhere. You may feel rather dubious about this function, and I can’t blame you. This is really weird stuff. But somehow, things get crazier.
Not only does this function hit every real number in between f(a) and f(b) in the interval [a,b], but it actually hits every single real number in between any interval [a,b], no matter how small you make it. It takes advantage of the fact that infinitesimals (infinitely small numbers) don’t exist within our standard number system, and so you can keep adding digits after the decimal point infinitely many times to obtain all real numbers within the interval [a,b], no matter how close a and b are to each other. Pretty weird, huh?
Raindrop Function
Continuing off of the idea of continuity, there exists a function that is continuous at all irrational numbers, but not continuous at all rational numbers. The function is defined as such:
- If the input is a rational number in the form of p/q, where both p and q are integers, the output is 1/q. If the input is an irrational number, then the output is 0.
That function might look something like this:
So first of all, how do we define continuity? Well, we say that a function is continuous if the function is continuous at every single point along its domain. Well, that’s obviously not true. But are there intervals within this function that are continuous? I mean, the picture just makes it seem like a bunch of dots. To answer that question, we have to examine continuity at a given point. That’s simply defined as if a function is continuous at a point c, then f(c) and the limit as x approaches c of f(x) must both be defined and equal to one another. We can think of the limit existing when the limit from the left matches with the limit from the right (there is a more rigorous definition of a limit called the epsilon-delta definition, but that’s for a later day. You pretty much think of epsilon and delta as “tolerance ranges” along the y and x values that allows you to zoom in infinitely close at a point).
The domain is conveniently split into two sections, so might as well take advantage of that. First, let’s look at if the function is continuous at a rational point. What happens when we take an infinitesimally small step to the left and the right? Well, we fall into the irrational domain, which gives us an output of 0. Since the limits from the left and the right are both 0, the limit at the rational point should also be 0. But that’s not what the function outputs. It outputs 1/q. Therefore, the function is not continuous at rational numbers.
Next, we consider irrational numbers. An infinitesimally small step in the left and right direction still gets us to an irrational number, so we can say the limits from the left and the right are both 0 (This is quite an oversimplification, but rigorously defining the limits is too bothersome for me). Since the output is 0, we say the function is continuous at all irrational numbers.
A big picture way of thinking about it is as such: there are infinitely many rational numbers, but between each rational number are infinitely many irrational numbers. It gets at the idea that the set of rational numbers is smaller than the set of irrational numbers (Cantor’s Theorem!).
Devil’s Staircase
If a function has derivative 0 at every single point along its domain, does it mean that the function is constant? In other words, if the slope at any given point of a function is 0 (horizontal), does the function have to be equal to a single constant? Our gut reaction tells us yes, but the answer is not what you think.
Let’s define a function as such:
Consider the domain [0,1] and range [0,1]. For the middle third of the interval (aka [⅓,⅔]), draw a straight line at y=½. Now you’re left with 2 empty intervals with length ⅓ on both the left and right of the line. For the interval on the left, draw a line at y=¼ along its middle third of the interval (so along [1/9, 2/9]). Repeat this for the interval on the right, but at y=¾. You do this infinitely many times for each of the empty intervals, which eventually will fill up the entire domain. You can check this by calculating the sum of the lengths of the lines:
1/3 + 2/9 + 4/27 + … = (1/3) / (1 – 2/3) = 1 (sum of geometric series formula)
Because the function is composed only of horizontal lines, the derivative at any point will always be 0. However, this function is by no means constant because it takes up several y values along its domain. It’s nicknamed the devil’s staircase because supposedly, “no one but the devil can climb it.”
Conclusion
Hopefully all of the math didn’t bore you too much, and I explained everything with enough detail for you to understand most of it. I struggled a bit with math notation because I don’t think the site supports Latex (as far as I know), but hopefully the notation doesn’t play that integral a part in the explanations. Researching more into these functions really made me appreciate how deep the rabbit hole of math is, and how much there still is to learn. It makes me sad that the high school curriculum doesn’t allow you to explore these fun things in a classroom setting and instead forces you to memorize formulas. My love for math has always been driven by a curiosity and fascination with weird things like these functions, and I hope I’ve been able to impart on you that calculus doesn’t have to be as boring as it’s taught in classrooms.