# Why can't calculus be done on the rational numbers?

I was once told that one must have a notion of the reals to take limits of functions. I don't see how this is true since it can be written for all functions from the rationals to the rationals, which I will denote $f$, that $$\forall L,a,x:(L,a,x\in\mathbb{Q})\forall \epsilon:(\epsilon>0)\space \exists\delta:(\delta>0)$$ $$\lim_{x\rightarrow a}f(x)=L\leftrightarrow(\mid x-a\mid<\epsilon\leftrightarrow\mid f(x)-L\mid<\delta)$$ Since, as far as I know, functions like $\mid x\mid$ and relations like $<$ can be defined on the rationals. Is it true you couldn't do calculus on just the rational numbers? At the moment I can't think of any rational functions that differentiate to real functions. If it's true that it isn't formally constructible on the rationals, what about the algebraic numbers?

Edit

Thanks for all the help, but I haven't seen anyone explicitly address whether or not we could construct integrals with only algebraic numbers. Thanks in advance to anyone who explains why or why not this is possible.

• You are right that you can treat $\Bbb Q$ as a metric space, in which case derivatives of rational functions using the limit definition are well-defined. However: you talk about derivatives, but what about integrals? And, rational functions are a very particular class of functions - things like radical, exponential and trigonometric functions are considered in courses even before calculus, and they require real numbers. – arctic tern Aug 4 '16 at 0:52
• Rational number systems have holes. It is incomplete. – P Vanchinathan Aug 4 '16 at 0:53
• Classic differential equations like $f'=f$ become impossible to solve. – GEdgar Aug 4 '16 at 0:57
• The big thing about limits in the rationals is sequences that "should" converge (are cauchy, or bounded and increasing, or whatever) often don't. Indeed if $q_n \rightarrow v \not \in \mathbb Q$ is not convergent in Q. – fleablood Aug 4 '16 at 1:31
• A related question. – J. M. is a poor mathematician Aug 4 '16 at 4:54

## 12 Answers

$\newcommand{\QQ}{\mathbb{Q}}$ Derivatives don't really go wrong, it's antiderivatives. (EDIT: Actually, the more I think about it, this is just a symptom. The underlying cause is that continuity on the rationals is a much weaker notion than continuity on the reals.)

Consider the function $f : \QQ \to \QQ$ given by $$f(x) = \begin{cases} 0 & x < \pi \\ 1 & x > \pi \end{cases}$$

This function is continuous and differentiable everywhere in its domain. If $x < \pi$, then there's a neighborhood of $x$ in which $f$ is a constant $0$, and so it's continuous there, and $f'(x) = 0$. But if $x > \pi$, there's a neighborhood of $x$ in which $f$ is a constant $1$, so it's continuous there too, and $f'(x) = 0$ again.

So the antiderivatives of $0$ can look rather messy. By adding functions like this, you can construct arbitrarily "jagged" functions with zero derivative. As you can imagine, this completely destroys the Fundamental Theorem of Calculus, and any results that follow from it.

This can happen in the real line to some extent, but it's not nearly as bad. The traditional antiderivative of $1/x$ is $\ln|x| + C$. But so is the following function: $$g(x) = \begin{cases} \ln x + C_1 & x > 0 \\ \ln(-x) + C_2 & x < 0 \end{cases}$$

By changing $C_1$ and $C_2$, we can push the two halves of the real line around completely independently. This is only possible because $1/x$ isn't defined at $0$, and so we've "broken" the real line at that point.

If you like dumb physical metaphors, here's one:

The real line is kind of like an infinite stick. If you wiggle a section of it, the whole thing must move.

With the $1/x$ example, you've made a cut at $x = 0$, and now you have two half-sticks. They can be wiggled independently, but each half must still move as a unit.

The rational numbers are more like a line of sawdust. You can't really move one grain by itself, but you can certainly take an interval and move it around independent of its neighbors.

By completing the rationals, you're adding all the glue between the grains to form a stick again. (I hope no one from diy.stackexchange is reading this...)

• I'd personally use tape and say "good enough." Gluing saw dust together is not for the faint of heart. – Axoren Aug 4 '16 at 1:47
• Nice answer, though from another point of view you could say there is an issue with differentiability because the notion of what it means to be differentiable at a point becomes fuzzy. – Kimball Aug 4 '16 at 2:48
• I love your dumb physical metaphor! – Matthew Leingang Aug 4 '16 at 18:43
• @Martin there is no way to extend $f$ to a continuous function on the reals, much less a differentiable one. – Henry Swanson Aug 4 '16 at 18:58
• “adding all the glue between the grains to form a stick again” — this is exactly what's called particle board or fiberboard. – Kevin Reid Aug 6 '16 at 1:03

This is a slightly softer answer.

You can 'do calculus' in-so-far as you can define the derivative and perhaps compute some things. But you'll get no theorems out: the main interval theorems (the Intermediate Value Theorem and the Extreme Value Theorem) rely heavily on the fact that the real numbers are complete, which the rationals aren't. In fact, the 'Intermediate Value Property' is equivalent to the completeness of the reals, and I'm pretty sure the 'Extreme Value Property' is as well.

Going on from there, Rolle's Theorem depends on the Extreme Value Theorem, the Mean Value Theorem depends on Rolle's Theorem, and Taylor's Theorem depends on the Mean Value Theorem.

Going in a different direction, L'Hopital's Rule is typically proven using the Cauchy Mean Value Theorem, which of course depends on the Mean Value Theorem. I don't know if there's some way to prove L'Hopital's Rule without this dependence, but I expect that if it's possible then the proof will depend crucially on completeness.

Above all, much of the usefulness (and beauty) of calculus comes from the theorems mentioned above. So while you can set up the usual definitions in non-complete spaces, and you may even be able to get some partial results, you eventually reach the question: is this really worth calling 'calculus'? It certainly doesn't compare to the real-variable theory.

This is all not-to-mention the lack of a meaningful theory of integrals, which is detailed in other answers.

Addendum: Consider the 'rational complex numbers' $\mathbb{Q}[i]$. If you like, you can extend your rational calculus to $\mathbb{Q}[i],$ but I don't think it will bear much resemblance to complex analysis. As a first example, the fact that satisfaction of the Cauchy-Riemann equations, along with continuity of partial derivatives of real and imaginary parts, implies complex differentiability of a complex function at a point depends, at least in the proof I've seen, on the Mean Value Theorem.

• This pdf is related. ​ ​ – user57159 Aug 4 '16 at 4:58
• @WillR Propp's paper, linked above, proves that the Extreme Value Theorem is equivalent to completeness. (It's a fun paper.) – Patrick Stevens Aug 4 '16 at 13:09
• L'Hopital's rule couldn't possibly work - for instance, the functions defined by the two properties $$x\in (\pi/n,\pi/(n+1)) \Longrightarrow f_{c,\alpha}(x)=c\pi/n + \alpha x$$ $$f(x)=-f(-x)$$ have that $f_{c,\alpha}'(x) = \alpha$ and $\lim_{x\rightarrow 0}\frac{f_{c,\alpha}(x)}x=c$. Being able to shift intervals with irrational endpoints around at will just creates too much looseness. – Milo Brandt Aug 4 '16 at 14:26
• @WillR Actually the extreme value theorem is equivalent to the compactness of a closed interval. Of course $[a,b]\cap\Bbb Q$ is neither compact nor connected. Connectedness immediately implies that the reals are complete, but I don't think the same can be said of compactness. – Mario Carneiro Aug 5 '16 at 21:20
• +1 because relaxing hypothesis is cool but it doesn't mean you'll get something useful out of it – mattecapu Aug 7 '16 at 11:43

It seems like most people are talking about integrals; let me answer with the first thing that popped into my head about derivatives.

$$\lim_{x\rightarrow a}f(x)=L\leftrightarrow(\mid x-a\mid<\epsilon\leftrightarrow\mid f(x)-L\mid<\delta)$$

While this may be a fine definition for rational-restricted limits, it winds up saying nothing about non-rational limits. Which are almost all of them. For example, the sequence {1, 1.4, 1.41...} approaching $\sqrt{2}$ has no limit according to this (rational-restricted) definition.

Likewise if we seek to use the definite integral as the area under some curve, then we find that the rationals are a set of measure zero and therefore the area over that set is automatically zero.

In short, because rationals are a set of measure zero, they account for almost none of the limits on rational functions or sequences, and no area under any curve of interest. I do find that a tiny bit of knowledge of Lebesgue measure theory makes a lot of this stuff immediately clear.

• well, that's assuming that one would define integrals in the exact same way as lebesgue did even when working in $\mathbb Q$, which probably won't be true – Ant Aug 4 '16 at 18:31
• @Ant: I'm skeptical that such a hypothetical, alternative construction would be coherent. – Daniel R. Collins Aug 7 '16 at 14:56
• The area under a curve is the limit of the area of some trapezoids. Surely, rational numbers can define trapezoids. A 1 x 1 square (integer sides) has area 1, not zero. – Kaz Aug 7 '16 at 15:28
• All numerical integration done with machines uses rational numbers. That is to say, floating-point. – Kaz Aug 7 '16 at 15:28
• "The area under a curve is the limit of the area of some trapezoids." But most such limits would not be rational, i.e., would not exist under the proposed alternate definition of limit. – Daniel R. Collins Aug 10 '16 at 4:57

Based on your comments, I think you might be particularly interested in the theory of real closed fields, or more generally, real algebraic geometry.

There is a formal, logical sense in which all real closed fields are the "same", and two prominent examples of real closed fields are the real numbers and the real algebraic numbers.

By leveraging this "sameness", it turns out that a large fragment of calculus still works the same way if you stick to algebraic numbers and algebraically defined functions.

It's mainly notions like continuity, completeness, or differentiation that carry over well; other techniques can be developed too, but I believe they tend to follow more along the lines of algebraic geometry than that of the calculus of real numbers.

The simple answer here is that the Riemann Integral doesn't allow for you to have infinite discontinuities like that; this is a strong motivator for some uses of Lebesgue Integration. However, even if we consider the function $$f(x)=\begin{cases}0,&\text{if }x\in \mathbb{Q}\\ 1,&\text{if }x\notin \mathbb{Q}\;. \end{cases}$$ and we try to integrate over the domain $x \in [0,1]$ we find that $$\int_{[0,1]} f(t) dt = \int_{[0,1] - \mathbb Q} f(t) dt + \int_{\mathbb Q} f(t) dt = \int_{[0,1]- \mathbb Q} dt= 1$$
With measure $0$ the rationals simply aren't strong enough for many uses even in this context... the rationals are countable, and you can imagine an integral over the rationals as being an integral over a real function with infinite holes. This breaks many of the requirements for simple integral and derivative properties, fails to satisfy basic differential equations, etc. Now, you can define your own integral over the rationals and find what properties it satisfies, but you'll soon hit your limitations. Note that the concept of the derivative also gets a little tougher to define at any rational point due to the countability of the set, as a result of having to mess with the standard definition of continuity (again, you could simply take the inverse functional of the integral I said you could design earlier, but you will get a fundamentally different derivative)

• This example, though with Q's =1, is one that most easily satisfies the easy reader. We know that the area will be width times height. And as this is 'rectangular', it should also be height time width, so we turn the 'graph' on its side, slide all the strips down to create a rectangle and see apparent contradictions because, seen on its side the graph has zero area. (mind you, the catch 22 is that we start by assuming there are non rationals that matter, and that they are implicitly more numerous!) – Philip Oakley Aug 7 '16 at 19:39

You can define limits of functions from $\mathbb{Q}$ to $\mathbb{Q}$ and also define limits of sequences with rational values and thus in general any concept based on limit of functions and sequences can be developed easily (almost in line with the way usual calculus is developed with real numbers). In particular it is possible to define derivatives and Riemann integrals.

However such a system of calculus over rationals will be almost totally uninteresting because it will lack all the significant theorems of calculus which are based on completeness property of real numbers. In essence the "calculus over rationals" will be nothing more than just fancy algebra. In general most of the interesting limits will not exist in this system.

It is a rather deep misconception that the power of calculus is because of ideas like derivatives and integrals (differential and integral calculus). The power of calculus comes entirely out of the structure of real numbers and by a sheer act of smartness/shrewdness the importance of real numbers is never emphasized in introductory calculus textbooks and students are left with the feeling that the strange new techniques of derivatives / integrals and their applications are the backbone of calculus.

• @djechlin: Which particular statement you wish justification for? – Paramanand Singh Aug 6 '16 at 8:06
• Calculus with rationals is immensely interesting; it is called numerical analysis, and is of tremendous significance in, oh, engineering and science. – Kaz Aug 7 '16 at 15:29
• @Kaz : calculus with rationnal is very different from calculus on rationnal. If numerical analysis was about calculus on rationnal, you wouldn't try to compute an approximation of $\sqrt{2}$, because such thing doesn't exist. But it makes perfect sense to compute an approximation of $\sqrt{2}$ (a real number) with rationnal numbers. – Tryss Aug 7 '16 at 17:23
• @Kaz : And if you do that, you do "analysis with rationnal numbers", not "analysis on $\Bbb Q$". Your sequence has no limit in $\Bbb Q$, and if you consider it's limit in $\Bbb R$, it cannot be considered analysis on $\Bbb Q$ no? – Tryss Aug 8 '16 at 20:50
• @Tryss I'm not sure. Philosphically, we can ask the question, is there a rational number which, if multiplied by itself, equals two? Whether it exists or not, you can give it the notation $\sqrt 2$ and use that to express the limit. I.e. there is a "hole" in the rationals where this $\sqrt 2$ would otherwise be, and we can approach that hole. – Kaz Aug 8 '16 at 20:58

Something the other answers haven't really brought up is that it is profitable to study rational functions defined over the rationals using (among other things) some techniques from differential calculus. This is done in arithmetic algebraic geometry (also known simply as "arithmetic geometry.")

• Can you give a basic example? What kind of problem might this come up in, and what calculation would need to be done? Obviously you don't need to give full details, but your answer could be made much more helpful with just a few extra pieces of information. – Will R Aug 4 '16 at 1:55
• I'm not sure if I can give a really basic example, but for instance you can take the product rule together with linearity as the definition of the derivative for a polynomial, even in contexts where limits don't make sense. If you want to understand what the set of rational points on a cubic curve looks like, this depends crucially on whether the curve is a elliptic curve or not, or in other words if there are singularities. These singularities can be detected with these limit-free derivatives. – Daniel McLaury Aug 4 '16 at 3:08
• This isn't a representative example, but it takes more than calculus alone to explain the more "normal" applications. – Daniel McLaury Aug 4 '16 at 3:20

Just some warning this answer may contain traces of engineering math.

You clearly can do calculus on rational numbers since

1. Computers and electronics are not able to / focused on representing irrational numbers.

2. There are plenty of useful applications utilizing differential calculus in basically all fields of science and engineering by now.

But one needs to consider at least two facts:

1. You can approximate real numbers as well as you want or need to with rational numbers.
2. Differentiation in practice is never purely infinitesimal. Anything that is measurable in our world is when measured (a.k.a. sampled) in some sense a sum or an integral, so whatever you would hope to calculate a differential on is in fact a differential onto an integral or approximation by finite difference of such sums.
• ...and it is here where the concepts of truncation error and discretization error become relevant. – J. M. is a poor mathematician Aug 4 '16 at 20:30
• Yes, absolutely very important concepts. I also had to truncate my answer somewhere or it would easily turn into half a course or more and that would not be very discrete. – mathreadler Aug 4 '16 at 21:10
• I think it's wrong to suggest that computers can't handle irrational numbers, e.g. here is a Haskell library for dealing precisely with square roots and sines and cosines of rationals. Moreover I'm not really sure what you mean by "differentiation in practice is never purely infintesimal". Once I model some physical process by a mathematical function, I can differentiate that precisely to model its derivative. I don't need to literally divide rise by run. There's some imprecision, sure, but there already is with any model. – Ben Millwood Aug 6 '16 at 14:43
• Yes, any irrational number that we are able to express can be stored as the string that expresses it. There are many symbolic algebra packages which can represent and express numbers that are not rational. I should probably have been more specific and mention commonly used examples like the floating point standards. You can do symbolic algebra on the model with a computer and derive expressions how to choose or measure parameters. But once you need to deal with measurements of some sort in an application you will often need to define some way to approximate the derivative or integral. – mathreadler Aug 6 '16 at 16:46
• @J.M. Truncation error is relevant because of calculations being done with a fixed number of bits. The game changes if you have arbitrary-precision numbers. Man fundamental operations are then exact; addition and multiplication and so on. There are still errors in measurement; but once the inputs are obtained, the machine does exact math. – Kaz Aug 7 '16 at 15:32

By the way, I just recently found that the completeness of the field we're working over is equivalent to the Intermediate Value Theorem for functions over that field. Since the rationals are incomplete, IVT does not apply. I know IVT is necessary with the Extreme Value Theorem to prove the Mean Value Theorem for Integrals, so it would certainly be impossible to prove FTC for the rationals although I don't know that the absence of IVT would have any effect on differential calculus.

• This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – Math1000 Aug 5 '16 at 7:47
• @Math1000 Disagree, this is an okay answer by the OP, even if it is not perfectly complete, and contains points mentioned in the other answers, it is certainly an answer. – Mario Carneiro Aug 5 '16 at 23:13
• I have a hunch that the IVT does apply to a rational function that is approximated by straight line segments, connecting points defined at rational domain values (to as fine a resolution as we care to make the approximation). – Kaz Aug 11 '16 at 0:36

If you handle real-valued functions defined on the rationals, then these functions are obviously not Lebesgue-integrable with respect to the $\sigma$-algebra of $\mathbb{Q}$ inherited from $\mathbb{R}$, except when they vanish outside finite sets. This is because the only sensible measures on the rationals are those that place a weight on each rational number. However, this will guarantee that the traditional derivative and the Lebesgue-antiderivative of a function have completely nothing to do with one another.

On the other hand, there may be some sense in finding the Riemann-integral of such a function, given that it is sufficiently nice. For example, continuous functions (with respect to the topology on the rationals inherited from the reals) may work well. One can simply lend the usual theory and demand that the partitions are done at rational points. Anyhow, I would expect many odd things to happen. Brevan Ellfsen's function would indeed be continuous relative to the rationals, i.e., the zero function, with constant functions as Riemann-antiderivatives, but as Henry Swanson's shows, there are also non-constant functions with this zero derivative.

On the rational numbers you can not really do Algebra, much less Calculus.

Since the rational numbers are not "complete", you can not for instance define the square root function. Similarly you can not define many other functions, e.g. power functions with non-integer exponent, ln(x), log(x), exp(x), sin(x), cos(x) etc.

Even if you restrict yourself only to functions $f:\mathbb{Q}\rightarrow\mathbb{Q}$, you can not always take limits, derivatives, antiderivatives etc. as pointed out in other answers.

So, the problem is a lot more fundamental than "you'll get no theorems out".

Can I give my view? For me, there are many huge distinctions between a "rational analysis" and the real analysis, and few of them are dependent on the concept of integration.

Derivatives and integrals are indeed defined on sets which are very different from the real numbers; the Cantor sets for instance. This means that derivatives and integrals are not what makes real analysis real analysis. The monotone convergence theorem and, equivalently, the fact that every bounded sequence has a convergent subsequence is a point of real calculus which I think is prior to integrals. Riemman integrals, themselves, are defined via supremes and infs, or via limits, which exist thanks to the monotone convergence theorem. So, the difference between rationals and reals comes first from facts relating to sequences and series, and then from antiderivatives.

Before learning about integrals, we learn things like mean value theorem or rolle theorem. Both come from topology of the real number set, which is very different from the topology of reals, thanks to the existence of supremes and infs. Mean value theorem would not hold in the rationals set. For example, the square of x would have values above and bellow 2, without passing through 2.

Of course, all of that also makes us think whether real numbers are something fundamentally necessary, or else a matter of convenience. In fact, thinking about all these examples, one can have the impression that real numbers are a construct which allows us to talk about some limits, even when we can't calculate them. This would, in my opition, be a precise observation, and which takes us to the old criticism of Dedekind to Cantor's theory. In my opinion, Cantor's set theory is much more important from being a huge and ingenious notational aid, than from being a fundamentally and filosofically consistent description of mathematics. The same observation applies to real numbers: they make analysis much easier, as we can talk about limiting values (as pi or e) using a single name, symbol, and thinking of them as numbers like 1 or 0, while without completeness theorem we would have to talk about "aproximate behaviours" in each and every place in mathematics were these numbers appear.

The values of many and many integrals are some of these limiting numbers, about which we can talk naturally in real analysis, but not in "rational analysis". Without completeness, we would not be able to talk about the integral of any continuous function on a closed set; we would have to put the huge restriction that the integration results in a rational number.

But, as I said, calculus is all about limits, and integrals are only one of the examples of limits which are only defined thanks to supremes and infs.