# Why is differentiation always doable algorithmically, but integration not?

**URL:** <https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281>\
**Category:** Factual Questions\
**Created:** [January 23, 2021, 12:48pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281 "2021-01-23T12:48:30Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![Ponderoid](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/ponderoid/32/19221_2.png) [@Ponderoid](https://boards.straightdope.com/u/Ponderoid)\
**Post date:** [January 24, 2021, 8:29pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/21 "2021-01-24T20:29:04Z")

</div>

You’re slowing down, dope.

Obigxkcd:

> **[Differentiation and Integration](https://xkcd.com/2117/)**
>
> "Symbolic integration" is when you theatrically go through the motions of finding integrals, but the actual result you get doesn't matter because it's purely symbolic.

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [January 24, 2021, 8:48pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/22 "2021-01-24T20:48:06Z")

</div>

Maybe he or she is talking, not about functions that are not integrable or not differentiable, but about differential fields of functions that may or may not be closed under certain types of extensions. For instance, logicians are able to construct differentially closed fields which already contain the solution to every system of differential equations. And, on the other hand, there are functions like the error function which are not elementary functions as a result of Liouville’s principle. So people do study such classes of functions and there is some differential Galois theory applicable.

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [January 24, 2021, 9:14pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/23 "2021-01-24T21:14:50Z")

</div>

> [@DPRK](#):
>
> for an example of a “problematic” situation, it follows from one of Richardson’s theorems that if you include the absolute-value function along with your exponentials, sines, and rational numbers then it becomes undecidable to figure out whether two expressions are equal or an expression is identical to zero

You can simplify [even further than that](https://en.wikipedia.org/wiki/Richardson%27s_theorem):

> [Miklós Laczkovich](https://en.wikipedia.org/wiki/Mikl%C3%B3s_Laczkovich) removed also the need for π and reduced the use of composition.[[5]](https://en.wikipedia.org/wiki/Richardson%27s_theorem#cite_note-5) In particular, given an expression _A_ ( _x_ ) in the ring generated by the integers, _x_ , sin _x^n_ , and sin( _x_ sin _x^n_ ), both the question of whether _A_ ( _x_ ) \> 0 for some _x_ and whether _A_ ( _x_ ) = 0 for some _x_ are unsolvable.

---

<div class="post-metadata">

**Author:** ![glowacks](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/glowacks/32/5548_2.png) [@glowacks](https://boards.straightdope.com/u/glowacks)\
**Post date:** [January 24, 2021, 9:46pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/24 "2021-01-24T21:46:54Z")

</div>

It’s related to the fact that most integrals are solved via the Fundamental Theorem of Calculus as opposed to derived from the definition of the integral. All derivative rules start with the definition as the limit of the difference quotient, and work out simple results and proceed to work out more difficult results as more rules are proven. I do know that we solved a few definite integrals directly from the limit definition for maybe one day of class, but that approach was abandoned fairly quickly (and wasn’t applied to indefinite integrals) since the FTC was known and makes things much easier. When your primary method of solving integrals is reversing some other process, entropy is definitely going to impede your progress sometimes.

I’m not sure what functions can be analytically integrated directly from one of the integral definitions there are out there, but I imagine it’s much harder since the rigorous definitions of integrals are somewhat abstract and don’t define anything resembling a constructive algorithm like that one you get from the limit of the difference quotient as the definition of the derivative. Sure, in the rigorous definition you get your epsolons and deltas there too, but you’ve got an expression you can evaluate before you apply the e-d definitions, and that’s just not the case for integrals.

---

<div class="post-metadata">

**Author:** ![Napier](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@Napier](https://boards.straightdope.com/u/Napier)\
**Post date:** [January 24, 2021, 11:31pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/25 "2021-01-24T23:31:33Z")

</div>

> [@Hari\_Seldon](#):
>
> I think square roots of some rational functions (quotients of polynomials) are examples, but I am not certain.

sqrt(1 + x^4) would be an example, right?

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [January 25, 2021, 12:55am UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/26 "2021-01-25T00:55:15Z")

</div>

I believe that is a non-elementary elliptic integral; someone who knows what they are doing should be able to prove it is non-elementary by applying Liouville’s theorem plus some complex analysis.

If you start from elementary functions including roots/trigonometric/exponential/logarithmic and compositions of those, you get a bigger class of functions which now includes the error function and elliptic and logarithmic integrals and so on. It does not include things like arbitrary hypergeometric functions, Bessel functions, gamma functions, …

---

<div class="post-metadata">

**Author:** ![Buck\_Godot](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/buck_godot/32/6573_2.png) [@Buck\_Godot](https://boards.straightdope.com/u/Buck_Godot)\
**Post date:** [January 25, 2021, 8:55pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/27 "2021-01-25T20:55:20Z")

</div>

Interestingly, as noted in the OP, for most closed form functions you come across it is easy to close form derivatives but not integrals for many closed form functions, But paradoxically you drop the closed form requirement, the reverse is true. Every function that is bounded on an interval has a anti-derivative over that interval, but not every bounded function is differentiable.

---

<div class="post-metadata">

**Author:** ![Chronos](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/chronos/32/134_2.png) [@Chronos](https://boards.straightdope.com/u/Chronos)\
**Post date:** [January 25, 2021, 10:37pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/28 "2021-01-25T22:37:14Z")

</div>

On thinking some more about it: The integral of a function depends on its values everywhere (at least, as far as the limits of integration), but the derivative only depends on values very close to the point you’re looking at. This certainly explains why integrals more often exist (because defects at individual points are drowned out by the behavior elsewhere), and I think it might also be considered to account for why it’s harder to find integrals.

But back to the problem of determining that two expressions are equivalent: In the real world, given any two expressions that can be evaluated, it’s really easy to determine, to a very high degree of confidence, that the two expressions are equivalent. I get that “sample a bunch of points to high precision” doesn’t constitute proof, but are there any known pairs of expressions that pass the “sample a bunch of points” test (i.e., which are very strongly suspected to be equivalent), but for which the equivalence isn’t proven?

---

<div class="post-metadata">

**Author:** ![Dr.Strangelove](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/dr.strangelove/32/6613_2.png) [@Dr.Strangelove](https://boards.straightdope.com/u/Dr.Strangelove)\
**Post date:** [January 25, 2021, 10:53pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/29 "2021-01-25T22:53:13Z")

</div>

Adapted from a post on [math.stackexchange.com](https://math.stackexchange.com/questions/514/conjectures-that-have-been-disproved-with-extremely-large-counterexamples):  
gcd(n17+9, (n+1)17+9) = 1

Works for all n until you get to 8424432925592889329288197322308900672459420460792433.

Ok, that’s not a real-valued function, but still…

---

<div class="post-metadata">

**Author:** ![Hari\_Seldon](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/hari_seldon/32/5173_2.png) [@Hari\_Seldon](https://boards.straightdope.com/u/Hari_Seldon)\
**Post date:** [January 26, 2021, 3:32pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/30 "2021-01-26T15:32:31Z")

</div>

> [@Napier](#):
>
> sqrt(1 + x^4) would be an example, right?

Certainly an example of what I said. Whether there is a known integral is another question. There are cites that do indefinite integration of any function for which there is a known integral. It might be interesting to try that. But if it fails, that is suggestive, but not proof.

---

<div class="post-metadata">

**Author:** ![Quercus](https://avatars.discourse-cdn.com/v4/letter/q/7ab992/32.png) [@Quercus](https://boards.straightdope.com/u/Quercus)\
**Post date:** [January 26, 2021, 5:33pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/31 "2021-01-26T17:33:59Z")

</div>

> [@Buck\_Godot](#):
>
> Interestingly, as noted in the OP, for most closed form functions you come across it is easy to close form derivatives but not integrals for many closed form functions, But paradoxically you drop the closed form requirement, the reverse is true. Every function that is bounded on an interval has a anti-derivative over that interval, but not every bounded function is differentiable.

You don’t even need to drop the closed-form requirement.  
consider f(x) = |x| [That’s absolute value]  
There’s a closed form, always-defined integral of f(), but it’s differential is not defined at zero.

Though, I guess you could argue that absolute value isn’t really a closed form; it’s one of those bastard heretical functions with special cases and ‘if’ in the definition.

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [January 26, 2021, 6:43pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/32 "2021-01-26T18:43:15Z")

</div>

> [@Hari\_Seldon](#):
>
> > [@Napier](#):
> >
> > sqrt(1 + x^4) would be an example, right?
> 
> Certainly an example of what I said. Whether there is a known integral is another question. There are cites that do indefinite integration of any function for which there is a known integral. It might be interesting to try that. But if it fails, that is suggestive, but not proof.

Elliptic integrals are hardly a mysterious unknown case, as we saw. But, in general, the practical answer seems to be that there are computer implementations of algorithms where you type in your function and the _claim_ is that either you get a proof that your integral is or is not elementary, or you get an error message and still do not know. Example: [http://fricas-wiki.math.uni.wroc.pl/RischImplementationStatus](http://fricas-wiki.math.uni.wroc.pl/RischImplementationStatus)  
But I would not say you get “suggestions”, assuming of course there are no nasty bugs somewhere (could always try a couple of other programs)

---

<div class="post-metadata">

**Author:** ![DPRK](https://avatars.discourse-cdn.com/v4/letter/d/4491bb/32.png) [@DPRK](https://boards.straightdope.com/u/DPRK)\
**Post date:** [February 3, 2021, 8:30pm UTC](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281/33 "2021-02-03T20:30:53Z")

</div>

> [@Hari\_Seldon](#):
>
> > [@Napier](#):
> >
> > sqrt(1 + x^4) would be an example, right?
> 
> Certainly an example of what I said. Whether there is a known integral is another question. There are cites that do indefinite integration of any function for which there is a known integral. It might be interesting to try that. But if it fails, that is suggestive, but not proof.

I meant to write this earlier, but it is instructive to try to evaluate this integral. Or, let’s begin with integrating x sqrt(1 + x^4) for comparison. To get rid of the radical, let u^2 = x^4 + 1 and work on the compact Riemann surface corresponding to u^2 = x^4 + 1.

We want to integrate ux dx, so expand that around its poles which are off at infinity. (Namely, one pole is at x → infinity, u/x^2 → 1, and the other is x → infinity, u/x^2 → -1.) Letting t = 1/x, so dx = (-1/t^2) dt and expanding around the two poles we get  
x = 1/t  
u = ±(t^(-2) + (1/2)t^2 + …)  
ux dx = ∓ (t^(-5) + (1/2)t^-1 + (1/8)t^3 + …) dt

So if we did this right we have two poles of order 5; now to integrate the ±t^(-5) we have to find an appropriate rational function with poles of order at most 4 at infinity; in this case  
ux^2 = ±(t^-4 + (1/2) + …)

So (1/4)ux^2 is the desired function. As for the ±(1/2)t^-1 dt, we see from the expansions above that  
u + x^2 = 2 t^-2 + (1/2)t^2 + …  
around one of the points, and  
= -(1/2)t^2 + … around the other, a double pole and a double zero.  
So its logarithmic derivative d(log(u + x^2)) = (2x/u) dx has residues ∓2, so divide it by 4.

Check: d(ux^2 + log(u+x^2)) = 4ux dx  
i.e. an antiderivative of x sqrt(x^4 + 1) is  
(1/4)(x ^2 sqrt(x^4 + 1) + log(x^2 + sqrt(x^4 + 1)).  
This integral turns out to be really easy; we did not have to do any serious linear algebra or even deal with complex numbers.

Now let’s try the original sqrt(x^4 + 1), which is u dx .

Expanding at the poles,

u dx = ∓(t^-4 + 1/2 + …), so there will be no logarithm and we just need a linear combination of x, u, x^2, ux with the desired principal parts. This is again not hard, obviously ux works, but this time  
u dx - d(ux/3) is a nonzero holomorphic differential, which cannot be the differential of some function.

So we are starting to see the source of the impossibility of finding an elementary integral: before we could do it since we were lucky enough that ux dx - d(ux^2/4) was just a logarithmic differential, but that won’t work to integrate the elliptic integral dx/u.

[Previous page](https://boards.straightdope.com/t/why-is-differentiation-always-doable-algorithmically-but-integration-not/931281.md?page=1)
