Even weirder is the Conway base 13 function, which not only is discontinuous everywhere, but its range when restricted to any interval is the entire set of real numbers (so its graph “fills up” the entire plane).
John Conway was amazing. Such a loss that he died of COVID.
As well as the game of life, surreal numbers and other famous things, he also produced one of my favourite lesser-known proofs ever - the proof that 91 is the smallest number that looks prime, but isn’t https://youtu.be/S75VTAGKQpk?si=IW791RaeCsXSOrrK “This is an important theorem and a discovery that I’m very proud of”.
there is a whole book “counterexamples in analysis”, basically for each theorem they find why every condition is required. these functions and ideas based on them are indispensable.
this weierstrass function is definitely a mind bender I remember from high school.
yup, that's a standard example / counterexample. Called the discrete metric. If you are trying to prove something about metric spaces, you should try your statement on that metric. A lot of things that seem true because they intuitively sound right with Euclidean distance break with the discrete metric.
Because there is no bijection between the rationals and the reals, wouldn't that imply that there are some irrational reals with no rational between them, allowing this function to be continuous, at least in places we can't actually compute?
That doesn't actually follow- even though the reals are uncountable, they're what's called "separable", which means that there is a countable set which is "arbitrarily good at approximating them", basically- the rationals!
So even though there are uncountable reals, for any real number, you can find rational numbers that get arbitrarily close. You can actually see this pretty easily if you think of reals in decimal notation- sqrt(2) is irrational, but
1.4, 1.41, 1.414, 1.4142, 1.41421, 1.414123, ... etc are all rational numbers that get closer and closer to sqrt(2).
So you should think of real numbers as uncountable, but nonetheless surrounded by rationals no matter how close you zoom in.
I'm a bit late to see this comment, but it was disappointing that none of the replies so far show why this is not true.
Take any irrational numbers x and y, and suppose for convenience that x < y.
Let d = y-x i.e. the length of the interval between x and y.
Let b be an integer so large that 1/b is less than d.
Consider fractions of the form a/b. As a increases, a/b will eventually (strictly) exceed the value of x. Suppose we fix a to be the smallest such value, i.e. (a-1)/b < x < a/b.
Adding d to both sides we get:
a/b - 1/b + d < x + d
Using the fact that 1/b < d and x + d = y, we get a/b < y.
> continuous at exactly one place (0) and nowhere else
after a bit of thought, less surprising if we regard g(x) as a function that is defined pointwise as either i(x) = x or z(x) = 0 depending on some highly discontinuous property of x
z(x) = 0 is a pretty good approximation of i(x) = x at x=0
It is unintuitive to me why the rational numbers are dense in the reals, since rational numbers are countably infinite, as opposed to the reals. I think infinity is hard to grasp.
It’s because for every pair of irrational numbers, there is a first place in their decimal representation where their digits differ, which means you can construct a number with finite decimal representation that fits between the two, which thus is rational.
In other words, it’s because while there are uncountably many irrational numbers, their representation is still only countably infinite each.
Or in yet other words, uncountable infinity is only a teensy bit larger than countable infinity, not that much larger. Consider that every prefix of an irrational number is a rational number. ;)
In decimal form, almost every real number between 0 and 1 is zero-point followed by an infinite sequence of random digits. No computer in the universe has enough hard drive space to store an arbitrary fixed real number between 0 and 1. This is of course not true for rationals: any rational number can be saved on a big enough hard drive. In particular, given unbounded resources, we can build a computer that approximates (0,1) by storing a finite set of rational numbers, and reaches a given real number x with arbitrary nonzero error. But we will never get zero error on a physical computer.
Rationals are also dense in the p-adic numbers, which you can think of as the other way to form their completion, if I understand correctly (with a different notion of absolute value.)
I always thought using countable and uncountable was a little confusing and that introducing aleph/beth numbers would have made things clearer when those ideas were introduced.
Introducing a stochastic function is cheating. You expect calculus to break if you just throw in stochastic functions willy-nilly, so that doesn’t challenge my intuition at all.
Some of those are continuous and differentiable everywhere. Examples:
f(x) = 0
f(x) = ½ x²
Also: doesn’t the claim that you can pick such a function require an extreme version of the axiom of choice, where you claim you can pick an element of each set in a set of sets that has uncountably many items?
Well yes. The thing I particularly like about the Dirichlet function is it’s so simple to state and yet just completely breaks my intuition about so many things.
There's a wonderful book on Mathematical counterexamples in French[0], meant for undergrad/engineering school hopefuls.
So many of the continuity counter-examples are throwing Weierstrass at the wall and getting something to stick. It's fun but also feels a bit like cheating.
I do recommend this book for any french-speaking mathematician-adjacent person though. Real great dictionary for remembering why certain things only work in one direction.
It is interesting how France became so focused on analysis and properly proving theorems and stuff, while the applications don't have the same highlight in prépa.
One professor of mine commented that most French engineers are better mathematicians than most mathematicians in Brazil.
It is the opposite of what the linked article mentions that was happening in Weierstrass' time.
When I first learned about limits (my senior year in high school), I visualized a "step" shape graphed (0, 0) to (0, 1) and then to (1, 1). Up one unit, right one unit. (I know, not technically a function since it has a vertical component.)
But now you subdivide both segments and put in an extra step. Up 0.5, right 0.5, up 0.5, right 0.5. Same starting point, same ending point. Even the same length of line segments as before — but the area bounded beneath is 3/4 the original.
I reasoned that if you continued this subdivision, as you approach infinity the area under the "curve" approaches that of a half-unit right triangle (i.e. root-two).
How is it, I asked my math teacher, that this shape can have the perimeter of a square but the area of a triangle?
I don't recall the answer from the teacher. Maybe somewhat hand-wavy; ultimately unsatisfactory to me. I still don't really know the answer. I suppose the answer is that it is not in fact ever a triangle — just a thing with a fat edge.
Nice example. You can avoid the issue with these being non-functions (because of the vertical segments) by rotating the picture so that the (0,0)-(1,1) diagonal is horizontal. That way you are talking about a sequence of continuous functions F_n with slopes alternating between ±1 that approach the constant-zero function F_0=0.
The reason your intuition was confused was that you felt that there was a way in which these functions with ±1 slope converge to zero function (it is called uniform convergence), but were unsure about the way in which their derivatives f_n=(F_n)' (which keep flipping between ±1) converge to zero.
The resolution of the seeming difficulty is that there are different modes of convergence. The ±1 slope functions F_n converge uniformly to zero, but their derivatives f_n, which determine curve length, do not converge uniformly or even pointwise to any limit (uniform convergence is stronger — more restrictive — than pointwise). This is why it is reasonable that the F_n curve length stays 2 throughout the exercise.
Note: if the derivatives f_n were converging to f_0=(F_0)'=0 pointwise while staying bounded, then the curve lengths of F_n would converge to sqrt(2), the curve length of F_0. This is called "dominated convergence theorem" for integrals — point being that the curve length of F_n is an integral of sqrt(1+f_n^2). But there is no pointwise convergence, and no such implication.
Finally, you may be curious as to whether there is a sense in which f_n converge to f_0=0 — does all that flipping back and forth amount to some way of converging to zero? Turns out yes! It is called weak* (weak-star) convergence and it applies to f_n if you think of them as measures (or distributions) — that is, if instead of pointwise evaluation you characterize f_n by the way they act on test functions by integration: instead of computing f_n(x) you multiply f_n * phi and integrate. Phi has to be a continuous function. Under this notion of evaluation, f_n do converge to zero.
You may be referring to the https://en.wikipedia.org/wiki/Staircase_paradox. As for how a shape can have the perimeter of a square and area of a triangle, it just can. As you've identified, it is easy to construct. It might be more interesting to ask what combinations of perimeter and area aren't possible.
You can always add more perimeter, so you want a lower bound on the perimeter given the area. The isoperimetric inequality (https://en.wikipedia.org/wiki/Isoperimetric_inequality) says that the smallest perimeter for a given area is that of a circle.
Yes, this is what I "re-invented" (I didn't know until now that it had a name). I saw it later in a math book that I flipped through on a co-workers bookshelf (but they didn't name it there either).
The perimeter (which is something very close to the derivative) is not continuous.
If you think about it a bit, you can easily change a shape in a way that greatly increases its perimeter but leaves it's area (almost) unaffected. Which means that just because two shapes are extremely close in shape, they can be very different in perimeter.
What is interesting is that it is semi continuous. The limit (this isn't quite correct) of the series is larger than the point. As the limit of the series is 2, but the actual distance is sqrt(2), which is smaller. So if you calculate the limit of the staircase perimeter you only know that it is larger or equal to the perimeter of the limit.
>I suppose the answer is that it is not in fact ever a triangle — just a thing with a fat edge.
It absolutely is a triangle. Because it converges in shape.
The thing is, each time you do a fold, you don't get any more of the triangle's perimeter covered by the staircase.
Not only that, every point that ends up on the triangle's line segment is adjacent to a point that isn't: there's always some little epsilon that you can step along, and you are no longer on an overlapping point. You've made no difference to the perimeter.
When it comes to the area, this is not true. Folding the triangular segments over the smooth line moves an area on which you can slightly move to one side or another, and you are still in an overlap.
Gotta wonder whether the sawtooth is actually a triangle. Each step makes it... not any closer to a triangle. Why would it be a triangle when you keep going to infinity?
> The thing is, each time you do a fold, you don't get any more of the triangle's perimeter covered by the staircase.
Not disagreeing with that.
> When it comes to the area, this is not true.…
Not following your point. And this part is the stickler for me: I believe the area does in fact approach the area of the triangle as the steps approach infinity.
Is this not the case as you see it?
Perhaps my "stickler" is not really one. To your first point, it's not really a triangle in the end, even as you approach infinity (though I still believe the area becomes that of said triangle). And there is nothing in geometry that says you can't have a shape with the area of a triangle but with a different perimeter.
It's just this "shape" looks an awful lot like a triangle but with a much larger perimeter.
>Why would it be a triangle when you keep going to infinity?
Because the difference goes to zero. They are identical, they are equal in the strongest mathematical sense. The sets which make up their shape are the same set. They couldn't be more equal.
The answer is that the perimeter “at infinity” matches the triangle.
There’s nothing that says the perimeter of the final “infinite” shape has to equal the limit of the perimeters as they go to infinity.
In order for this to work, you have to prove that they’re equal. Typically you’d come up with two limits, one which you prove is always greater than the value in question, and one which is always less. Then you show that they’re equal in the limit. That squeezes the number you’re interested in, proving that it’s also equal to that number.
For example, the typical proof of the circumference of a circle involves making two polygons, one inside the circle and one outside. The perimeter of the one inside is always less than the circumference, and the one outside is always greater. Then you take the limit of the polygon perimeters as the number of sides goes to infinity. They converge on the same number, 2 pi r.
function sum(f: (x: number) => number, upper = 500) {
let sum = 0;
for (let n = 0; n < upper; n++) sum += f(n);
return sum;
}
const weierstrass = (x: number, a = 0.5, b = 3) =>
sum(n => a ** n * Math.cos(b ** n * x));
Audio spectrum is bounded, so we are only hearing the first few terms of the series that make up the function (the coefficient under sine grows exponentially with n).
You could even replace the audible part with Chopin (or anything else, even f(x)=0) to get a Weierstrass-like function which sounds like Chopin (or silence) but is still not differentiable anywhere.
Weierstrass function is used prominently in Abbot's (2015) "Understanding Analysis" book. Abbott also relies heavily on three other mind-bending functions - Dirichlet (nowhere continuous), Thomae (discontinuous at every rational and continuous at every irrational point), and Cantor (increasing and continuous on [0, 1], yet constant at [0, 1]\C. where C is the Cantor set that is of measure zero).
Dirichlet, Thomae, and Cantor functions are central in Abbott to introduction and exercises on continuity, differentiation, and integration. I thought that was an interesting pedagogical choice for an undergraduate book, especially when it is used for the very first course in mathematical analysis as in Princeton’s MATH215 (I do think it is a really nice book).
Here’s a really cool thing about continuous-everywhere differentiable-nowhere functions. A consequence of the Baire Category Theorem is that most continuous functions are nowhere-differentiable (in the same sense that “most” real numbers are irrational).
The familiar functions from calculus are the vanishing minority of continuous functions.
Are there any hierarchies in mathematics that aren't like this? It seems like most hierarchies are constructed such that going up one "level" expands your scope so much that the previous rung looks like a drop of water in the ocean.
Examples include, for example: the Chomsky hierarchy of languages, where most context-free languages are not regular; Turing computability/solvability; and so on.
There are also functions that have a first derivate, but no second derivative. Much of my graduate research involved studying these type of functions.
Many of the original ideas came from the paper "The calculus of fractal interpolation functions"
https://www.sciencedirect.com/science/article/pii/0021904589...
I wrote a paper on how to compute the surface normal (for rendering) of related functions:
https://link.springer.com/article/10.1007/PL00013408
Interestingly enough, while you can not differentiate the Weierstrass function, you can integrate it -- i.e. you can treat it like a differential equation that has a set of well defined solutions.
These examples are what caused them to be this way. Hand waving was a lot more acceptable in mathematics while Weierstrass was alive. The discovery of clear counter examples to hand waving arguments lead to the desire to put mathematics on the strong footing it is on today.
It may annoy students today as there is seemingly little utility in these distinctions, but they actually are important. The more complex mathematics becomes, the more important it is to actually be on solid footing.
There was definitely some of that before. Ben Franklin, in his autobiography, writes that his Junto, a group of people devoted to self-improvement, included:
"Thomas Godfrey, a self-taught mathematician, great in his way, and afterward inventor of what is now called Hadley's Quadrant. But he knew little out of his way, and was not a pleasing companion; as, like most great mathematicians I have met with, he expected universal precision in everything said, or was forever denying or distinguishing upon trifles, to the disturbance of all conversation. He soon left us."
f(x) = 1 if x is rational, 0 otherwise.
It is defined over all real numbers but continuous nowhere. Also if you take the Dirichlet function and multiply it by x so you get
g(x) = x if x is rational, 0 otherwise
…then you have something that is continuous at exactly one place (0) and nowhere else, which also is pretty spectacular.
[1] https://mathworld.wolfram.com/DirichletFunction.html
https://en.wikipedia.org/wiki/Conway_base_13_function
As well as the game of life, surreal numbers and other famous things, he also produced one of my favourite lesser-known proofs ever - the proof that 91 is the smallest number that looks prime, but isn’t https://youtu.be/S75VTAGKQpk?si=IW791RaeCsXSOrrK “This is an important theorem and a discovery that I’m very proud of”.
https://en.wikipedia.org/wiki/Thomae%27s_function
It is discontinuous at every rational number, but continuous at every irrational number.
Reminds me of the discrete metric in my Real Analysis course: distance is 0 if it is the same point, 1 otherwise.
We used to joke that it was the perfect metric for finding weird counter examples
this weierstrass function is definitely a mind bender I remember from high school.
h(a/b) = b for rationals a/b (in smallest terms), 0 otherwise
This one has the properties you mention of the Dirichlet function whilst also being unbounded in every non-empty interval of the reals.
I can understand the reactions of the late 19th Century mathematicians, though I suspect much of it was exaggerated rhetoric, not real horror.
So even though there are uncountable reals, for any real number, you can find rational numbers that get arbitrarily close. You can actually see this pretty easily if you think of reals in decimal notation- sqrt(2) is irrational, but
1.4, 1.41, 1.414, 1.4142, 1.41421, 1.414123, ... etc are all rational numbers that get closer and closer to sqrt(2).
So you should think of real numbers as uncountable, but nonetheless surrounded by rationals no matter how close you zoom in.
Take any irrational numbers x and y, and suppose for convenience that x < y.
Let d = y-x i.e. the length of the interval between x and y.
Let b be an integer so large that 1/b is less than d.
Consider fractions of the form a/b. As a increases, a/b will eventually (strictly) exceed the value of x. Suppose we fix a to be the smallest such value, i.e. (a-1)/b < x < a/b.
Adding d to both sides we get:
a/b - 1/b + d < x + d
Using the fact that 1/b < d and x + d = y, we get a/b < y.
Therefore x < a/b < y.
after a bit of thought, less surprising if we regard g(x) as a function that is defined pointwise as either i(x) = x or z(x) = 0 depending on some highly discontinuous property of x
z(x) = 0 is a pretty good approximation of i(x) = x at x=0
In other words, it’s because while there are uncountably many irrational numbers, their representation is still only countably infinite each.
Or in yet other words, uncountable infinity is only a teensy bit larger than countable infinity, not that much larger. Consider that every prefix of an irrational number is a rational number. ;)
the reals are defined as limits of the sequences of rationals, and thus the rationals are dense in reals by that definition.
>since rational numbers are countably infinite
while the set of all the infinite convergent series of rationals happens to be strongly larger than countably infinite.
Deleted Comment
In fact, here is an uncountable family of them :
f(x) = x^2 * rand(0,1)
Where rand(0,1) is a uniform number between 0 and 1, sampled for every x.
So many of the continuity counter-examples are throwing Weierstrass at the wall and getting something to stick. It's fun but also feels a bit like cheating.
I do recommend this book for any french-speaking mathematician-adjacent person though. Real great dictionary for remembering why certain things only work in one direction.
[0] Les contre-exemples en mathématiques: https://www.editions-ellipses.fr/accueil/5328-les-contre-exe...
One professor of mine commented that most French engineers are better mathematicians than most mathematicians in Brazil.
It is the opposite of what the linked article mentions that was happening in Weierstrass' time.
https://www.amazon.com/Counterexamples-Analysis-Dover-Books-...
Weierstrass function is also there, but exactly this one contains an error... :)
https://math.stackexchange.com/questions/1507399/is-the-weie...
There is also
https://en.wikipedia.org/wiki/Counterexamples_in_Topology
But now you subdivide both segments and put in an extra step. Up 0.5, right 0.5, up 0.5, right 0.5. Same starting point, same ending point. Even the same length of line segments as before — but the area bounded beneath is 3/4 the original.
I reasoned that if you continued this subdivision, as you approach infinity the area under the "curve" approaches that of a half-unit right triangle (i.e. root-two).
How is it, I asked my math teacher, that this shape can have the perimeter of a square but the area of a triangle?
I don't recall the answer from the teacher. Maybe somewhat hand-wavy; ultimately unsatisfactory to me. I still don't really know the answer. I suppose the answer is that it is not in fact ever a triangle — just a thing with a fat edge.
The reason your intuition was confused was that you felt that there was a way in which these functions with ±1 slope converge to zero function (it is called uniform convergence), but were unsure about the way in which their derivatives f_n=(F_n)' (which keep flipping between ±1) converge to zero.
The resolution of the seeming difficulty is that there are different modes of convergence. The ±1 slope functions F_n converge uniformly to zero, but their derivatives f_n, which determine curve length, do not converge uniformly or even pointwise to any limit (uniform convergence is stronger — more restrictive — than pointwise). This is why it is reasonable that the F_n curve length stays 2 throughout the exercise.
Note: if the derivatives f_n were converging to f_0=(F_0)'=0 pointwise while staying bounded, then the curve lengths of F_n would converge to sqrt(2), the curve length of F_0. This is called "dominated convergence theorem" for integrals — point being that the curve length of F_n is an integral of sqrt(1+f_n^2). But there is no pointwise convergence, and no such implication.
Finally, you may be curious as to whether there is a sense in which f_n converge to f_0=0 — does all that flipping back and forth amount to some way of converging to zero? Turns out yes! It is called weak* (weak-star) convergence and it applies to f_n if you think of them as measures (or distributions) — that is, if instead of pointwise evaluation you characterize f_n by the way they act on test functions by integration: instead of computing f_n(x) you multiply f_n * phi and integrate. Phi has to be a continuous function. Under this notion of evaluation, f_n do converge to zero.
Edit: typos.
Also, very cool, followed your link and they mentioned a 3D analog of sorts: https://en.wikipedia.org/wiki/Schwarz_lantern
If you think about it a bit, you can easily change a shape in a way that greatly increases its perimeter but leaves it's area (almost) unaffected. Which means that just because two shapes are extremely close in shape, they can be very different in perimeter.
What is interesting is that it is semi continuous. The limit (this isn't quite correct) of the series is larger than the point. As the limit of the series is 2, but the actual distance is sqrt(2), which is smaller. So if you calculate the limit of the staircase perimeter you only know that it is larger or equal to the perimeter of the limit.
>I suppose the answer is that it is not in fact ever a triangle — just a thing with a fat edge.
It absolutely is a triangle. Because it converges in shape.
Not only that, every point that ends up on the triangle's line segment is adjacent to a point that isn't: there's always some little epsilon that you can step along, and you are no longer on an overlapping point. You've made no difference to the perimeter.
When it comes to the area, this is not true. Folding the triangular segments over the smooth line moves an area on which you can slightly move to one side or another, and you are still in an overlap.
Gotta wonder whether the sawtooth is actually a triangle. Each step makes it... not any closer to a triangle. Why would it be a triangle when you keep going to infinity?
Not disagreeing with that.
> When it comes to the area, this is not true.…
Not following your point. And this part is the stickler for me: I believe the area does in fact approach the area of the triangle as the steps approach infinity.
Is this not the case as you see it?
Perhaps my "stickler" is not really one. To your first point, it's not really a triangle in the end, even as you approach infinity (though I still believe the area becomes that of said triangle). And there is nothing in geometry that says you can't have a shape with the area of a triangle but with a different perimeter.
It's just this "shape" looks an awful lot like a triangle but with a much larger perimeter.
Because the difference goes to zero. They are identical, they are equal in the strongest mathematical sense. The sets which make up their shape are the same set. They couldn't be more equal.
There’s nothing that says the perimeter of the final “infinite” shape has to equal the limit of the perimeters as they go to infinity.
In order for this to work, you have to prove that they’re equal. Typically you’d come up with two limits, one which you prove is always greater than the value in question, and one which is always less. Then you show that they’re equal in the limit. That squeezes the number you’re interested in, proving that it’s also equal to that number.
For example, the typical proof of the circumference of a circle involves making two polygons, one inside the circle and one outside. The perimeter of the one inside is always less than the circumference, and the one outside is always greater. Then you take the limit of the polygon perimeters as the number of sides goes to infinity. They converge on the same number, 2 pi r.
Deleted Comment
The perimeter is equal to the square one at every iteration, thus its limit towards infinity is still the square one.
Deleted Comment
(many properties are not preserved under limit but it's still somewhat interesting)
I wonder what they sound like as audio.
Edit: apparently it sounds like this https://youtu.be/vWmZnlPQK14
You could even replace the audible part with Chopin (or anything else, even f(x)=0) to get a Weierstrass-like function which sounds like Chopin (or silence) but is still not differentiable anywhere.
At a lower pitch, with some variation in pitch and amplitude, it probably sounds nicer.
Dirichlet, Thomae, and Cantor functions are central in Abbott to introduction and exercises on continuity, differentiation, and integration. I thought that was an interesting pedagogical choice for an undergraduate book, especially when it is used for the very first course in mathematical analysis as in Princeton’s MATH215 (I do think it is a really nice book).
The familiar functions from calculus are the vanishing minority of continuous functions.
Examples include, for example: the Chomsky hierarchy of languages, where most context-free languages are not regular; Turing computability/solvability; and so on.
It may annoy students today as there is seemingly little utility in these distinctions, but they actually are important. The more complex mathematics becomes, the more important it is to actually be on solid footing.
"Thomas Godfrey, a self-taught mathematician, great in his way, and afterward inventor of what is now called Hadley's Quadrant. But he knew little out of his way, and was not a pleasing companion; as, like most great mathematicians I have met with, he expected universal precision in everything said, or was forever denying or distinguishing upon trifles, to the disturbance of all conversation. He soon left us."
(from Project Gutenberg's online version: https://www.gutenberg.org/files/20203/20203-h/20203-h.htm; written ~1775? about events in ~1730)