183 points · by pseudolus · 1y ago · 129 comments
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.
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.
My favorite counterexamples in analysis were based on the cantor set as it allowed counerexamples for many different scenarios while still producing functions that were “nice” in other respects
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.
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.
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?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
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.
I think the lesson for me is that any part of any line, if you zoomed into it enough, could actually be found to be all wadded up and much longer than you would otherwise expect. A line from point A to point B must be at least as long as the straight line from A to B, but could be any length greater than that.
The only thing that makes your jaggy line special is that the distance from any point along it to the nearest point on the straight (triangle's) line is zero.
Yeah I see it your way. Perimeter doesn't change, but the area does.
But it's not a triangle. For instance, the internal angles don't add up to 180, and they never tend to either as you fold more and more.
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.
The perimeter is equal to the square one at every iteration, thus its limit towards infinity is still the square one.
(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
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));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.
Many mathematicians dismissed the function. It was an anomaly, they said — the work of a pedant, mathematically useless.
This is low-key hilarious given how much of mathematics seems like pedantry to an outsider.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)
E g. an actually consistent and encompassing definition of what a "function" is, is something surprisingly recent. Certainly Euler, Gauß, Leibnitz or Newton did not have one. Only with Cantor's project of set theory did we get something remotely satisfying. Cantor faced significant backlash, which surely would have been much more effective if there weren't examples where actual foundational questions became questions of practical mathematics. And whether Weierstrass had actually found a "function" was one of these questions.
Bernard R.\ Gelbaum and John M.\ H.\ Olmsted, {\it Counterexamples in Analysis,\/} Holden-Day, San Francisco, 1964.\ \
Intuitively, you'd think that the surface area in 3D can be approximated by using a series of converging polyhedra, but that's not the case.
f(x) = a random number uniformly selected from [-1, 1].
(So every real number maps to a distinct random number.)
It's nowhere continuous, nowhere differentiable, yet its integral over any interval is exactly zero.
Which is kind of weird if you think of integrals and derivatives as inverses, because as I understand it the derivative of a constant g(x) = c is g'(x) = 0, yet the integral of the above function is F(x) = 0 yet F'(x) = f(x) = the random nonsense monster. So the derivative of zero can be either zero or random noise? (And while f(x) is not differentiable, its integral surely is.)
That function doesn't actually have an integral in any sense that I know of. The Riemann integral doesn't work because, for every interval in every possible partition, the function's upper bound will be 1 and the lower bound will be -1.
My original intuition is that every value in [0, 1] will be cancelled by a value in [-1, 0].
My updated intuition to make it more Lebesgue-compatible would be to sort the (infinite) set of values in the interval. This will give the everywhere continuous, linear function from -1 at the minimum coordinate of the interval to 1 at the maximum coordinate.
Hm... I notice that when applying Lebesgue to Dirichlet, it uses countability, and reals aren't countable. I have no clue whether that's a problem here or not.
Real numbers and Lesbesgue integration that stem out of 19th c. analysis came before Computability was a thing... and it turns out that all but a measure 0 set of real-numbers are actually computable.
So all these things that we worry about don't even "exist" in a computational sense.
Mathematicians haven't come to terms with this (barring non-standard analysis etc.), and I suspect this is one of the reasons it's losing mind-share.
Note that I don't personally think it's likely that our thinking goes beyond the capabilities of a Turing machine, not at all. But I also think it would be premature to throw out all mathematics that doesn't conform to Turing machine computability before we are more sure that this is the best possible model.
And even if it were, there is also the question of whether physical processes are computable or not. Right now there are plenty of physical processes where our best and only reliable models for predicting their behavior require assumptions from calculus, like the existence of all real numbers. For example, there is no successful formulation of quantum mechanics where the distance between two particles moving relative to each other can be constrained to any subset of the [minDistance, maxDistance] interval of the real number line. Which means that, as the particles move away from each other, at some times the distance between them will have to be an uncomputable number (and given their density in the real number line, this will be approximately all the time).
Plus, rather bizarrely, it helps to understand this area to do actual statistics, in software such as Stan.
This is the wrong way around. The computable numbers have measure 0. In fact, they are countable.
The non-computable real numbers have full measure.
(proof: by definition, computable numbers are generated by a program, which can be represented by a finite number of bits. The set of finite numbers is countable).
But the set of programs that compute real numbers is a subset of all programs, and the set of all programs is countable. Therefore the set of computable numbers is countable.
edit: I think maybe it wasn't clear that I'm talking about cardinality and measure? To be a little clearer - I'm saying that the computable numbers have (standard) measure 0 because they have countable cardinality. Any subset of the real numbers with countable cardinality has measure 0. And the set of all real numbers, of course, has uncountable cardinality.
I suspect some future generation is going to decide that diagonalizaation is based on questionable axioms. It leads to invisible pink elephants.
So even though ZFC talks about uncountable real numbers, there is actually a countable model of ZFC that satisfies the same axioms.
This isn’t an inconsistency, but it really does blur the lines between what we think of as mathematical objects that are “out there” in some sense (like uncomputable real numbers) or whether mathematics is just a game of symbol manipulation that also happens to predict the physical world pretty well.
The same is true even for numbers that have finite predicates defining them — because there’s only measure zero finite predicates.
Most real numbers are indescribable sequences (ie, not finitely describable), so it’s not surprising we can’t describe them. That’s what happens when you construct something by including all possible infinite sequences — almost all of them are total gibberish.
Diagonalization is a consequence of that: we have a schema of descriptions forming our predicate and prove no matter how we index reals by the integers, there’s more stuff out there. To get rid of that, we need to stop completing sequences.
Most people aren’t in favor of that finitism/constructive approach now — so I’m not sure why that would change.
Past generations of course were not always comfortable with it either, but.. No one shall expel us from the paradise that Cantor has created for us.
https://en.m.wikipedia.org/wiki/Cantor%27s_paradise
It’s useful I think to have a conservative impulse somewhere as a counterpoint to wild invention, and math has benefited a lot from the constructivist vs formalist debate.
That said I believe your comments are off the mark in regards to the topic of the Weierstrass function. The Weierstrass function is completely well behaved from a constructive point of view[0]; it is uniformly continuous and everything. In particular we can (constructively) map (constructive) real numbers to (constructive) real numbers via this function.
They directly lead to weak derivatives which have certainly saved 10s of thousand of lives.