Explorations in math and programming
David Lowry-Duda

1. Introduction

$\DeclareMathOperator{\csch}{csch}$ $\DeclareMathOperator{\sech}{sech}$ $\DeclareMathOperator{\arsinh}{arsinh}$

In many ways, a first semester of calculus is a big ideas course. Students learn the basics of differentiation and integration, and some of the big-hitting theorems like the Fundamental Theorems of Calculus. Even in a big ideas course, students learn how to differentiate any reasonable combination of polynomials, trig, exponentials, and logarithms (elementary functions).

But integration skills are not pushed nearly as far. Do you ever wonder why? Even at the end of the first semester of calculus, there are many elementary functions that students cannot integrate. But the reason isn't that there wasn't enough time, but instead that integration is hard. And when I say hard, I mean often impossible. And when I say impossible, I don't mean unsolved, but instead provably impossible (and when I say impossible, I mean that we can't always integrate and get a nice function out, unlike our ability to differentiate any nice function and get a nice function back). An easy example is the sine integral $$ \int \frac{\sin x}{x} \mathrm d x, $$ which cannot be expressed in terms of elementary functions. In short, even though the derivative of an elementary function is always an elementary function, the antiderivative of elementary functions don't need to be elementary.

Worse, even when antidifferentiation is possible, it might still be really hard. This is the first problem that a second semester in calculus might try to address, meaning that students learn a veritable bag of tricks of integration techniques. These might include ${u}$-substitution and integration by parts (which are like inverses of the chain rule and product rule, respectively), and then the relatively more complicated techniques like partial fraction decomposition and trig substitution.

In this note, we are going to take a closer look at problems related to trig substitution, and some related ideas. We will assume familiarity with ${u}$-substitution and integration by parts, and we might even use them here from time to time.

2. Motivating Trig Substitutions in Integrals

Here is a fundamental theorem, known since antiquity: if ${a,b,c}$ are the sides of a right triangle with ${c}$ as the hypotenuse, then $$ a^2 + b^2 = c^2, $$ known as the Pythagorean Theorem. As ${(\cos \theta, \sin \theta)}$ is the point on the unit circle at ${\theta}$ radians from the positive horizontal axis, the Pythagorean Theorem tells us that $$ (\cos \theta)^2 + (\sin \theta)^2 = 1. $$ We can rewrite this as $$ (\cos \theta)^2 = 1 - (\sin \theta)^2. $$ This might not look like much. But when we're presented with integrals like $$ \int \sqrt{1 - x^2} \mathrm d x, $$ the difficulty is entirely because of that pesky ${1}$ term, and using that trig identity will allow us to get rid of the pesky ${1}$ term.

Performing the substitution ${x = \sin \theta}$ means that ${\sqrt{1 - x^2} = \sqrt{1 - \sin^2 \theta} = \sqrt{\cos^2 \theta} = \cos \theta}$ (here and elsewhere we could pay closer attention to signs, but we don't). And ${\cos \theta}$ is much easier to handle than ${\sqrt{1 - x^2}}$ in an integral. Sure - we also have the contribution from the ${\mathrm d x}$ term in the integral, but overall we've transformed our integral into $$ \int \cos^2 \theta \mathrm d \theta, $$ which we can handle.

So the algebraic intuition is that the relation ${\cos^2 \theta = 1 - \sin^2 \theta}$ suggests a substitution ${x = \sin \theta}$ to let us rewrite ${\sqrt{1 - x^2}}$ as ${\sqrt{1 - \sin^2 \theta} = \cos \theta}$, which is a simpler thing to handle. (Note that when you're actually doing trig substitution, it's far more useful to draw a picture than to proceed entirely algebraically).

Two natural questions should come up. Firstly, it's also true that ${\sin^2 \theta = 1 - \cos^2 \theta}$. What if we used that instead? (Answer: we get the same result - you might try and see, and show that they're the same).

Continuing this line of questioning, what can the other Pythagorean identities give us? We also know that $$ 1 + \tan^2 \theta = \sec^2 \theta, $$ which suggests that we can get rid of the pesky constant term in expressions like ${1 + x^2}$ with the substitution ${x = \tan \theta}$. Or, rewriting the identity as $$ \tan^2 \theta = \sec^2 \theta - 1, $$ we see that we can get rid of the constant term in expressions like ${x^2 - 1}$ with the substitution ${x = \sec \theta}$.

But this isn't the only common relation between something that looks like ${1 - x^2}$ and something that looks like ${x^2}$. Can we use different substitutions to get the same (or maybe better) results? Yes we can! And this is our main interest today.

3. A brief overview of hyperbolic trigonometry

The key property of our normal trigonometric functions ${\cos t}$ and ${\sin t}$ is that the points ${(\cos t, \sin t)}$ trace out the unit circle ${x^2 + y^2 = 1}$.

There are also hyperbolic trigonometric functions ${\cosh t}$ and ${\sinh t}$ (pronounced "cosh" and "sinch"), with key property that ${(\cosh t, \sinh t)}$ trace out the right half of the unit hyperbola ${x^2 - y^2 = 1}$. It just so happens that the hyperbolic sine and hyperbolic cosine can be expressed in terms of exponentials: \begin{align}\sinh x &= \frac{e^x - e^{-x}}{2} \\ \cosh x &= \frac{e^x + e^{-x}}{2} \end{align}

There are many parallels between the hyperbolic trigonometric functions and the regular trigonometric functions. Similar to how ${\frac{\mathrm d}{\mathrm dx} \sin x = \cos x}$ and ${\frac{\mathrm d}{\mathrm dx} \cos x = - \sin x}$, the hyperbolic trigonometric functions differentiate into each other. It turns out (and you can check) that ${\frac{\mathrm d}{\mathrm dx} \sinh x = \cosh x}$ and ${\frac{\mathrm d}{\mathrm dx} \cosh x = \sinh x}$. Very similar, but without needing to remember the minus sign.

We also have that ${\cosh^2 x - \sinh^2 x = 1}$ (since these trace out the right unit hyperbola). Rearranging, we see that $$ \cosh^2 x = 1 + \sinh^2 x. $$ The rest of the hyperbolic trig functions are defined analogously to the regular trig functions: \begin{align} \tanh x &= \frac{\sinh x}{\cosh x} \\ \coth x &= \frac{1}{\tanh x} \\ \sech x &= \frac{1}{\cosh x} \\ \csch x &= \frac{1}{\sinh x} \end{align} A few manipulations show the other hyperbolic identities $$ \cosh^2 x - 1 = \sinh^2 x $$ and $$ 1 - \tanh^2 x = \sech^2 x. $$

Finally, just as with the normal trigonometric functions, there are the inverse hyperbolic trigonometric functions (which should be prefaced with ar instead of arc because they natural definition relates to area instead of an arc length.

4. Hyperbolic Trig Substitution

We see that the nice relations between things that look like ${1 + x^2, 1 - x^2}$ and ${x^2 - 1}$ on the one hand and just something that looks like ${x^2}$ on the other are given by both the regular trigonometric functions and the hypergeometric trigonometric functions. Let's see how that goes with an example.

Example 1 Let's integrate ${\displaystyle \int \sqrt{4x^2 + 25} \mathrm d x}$ in two ways, using both standard trigonometric substitution and hyperbolic trigonometric substitution. First, let's use the standard trig functions. We have an expression that looks like ${x^2 + 1}$ that we'd love to transform into something that looks like ${x^2}$. So we let ${2x = 5 \tan \theta}$, so that ${4x^2 + 25 = 25 \tan^2 \theta + 25 = 25 \sec^2 \theta}$, and ${2 \mathrm d x = 5 \sec^2 \theta \mathrm d \theta}$. This gives $$ \frac{25}{2} \int \sec^3 \theta \mathrm d \theta, $$ which evaluates to $$ \frac{25}{4} \sec\theta \tan \theta + \frac{25}{4} \ln \lvert \sec \theta + \tan \theta \rvert + C.$$ If we think about the substitution in terms of the guiding triangle, then this simplifies to $$ \int \sqrt{4x^2 + 25} \mathrm d x = \frac{1}{2} x \sqrt{4x^2 + 25} + \frac{25}{4} \ln \left \lvert \frac{\sqrt{4x^2 + 25}}{5} + \frac{2x}{5} \right \rvert + C.$$

Implicitly we used a ${u}$-substitution and knowledge of the integral ${\displaystyle \int \sec \theta \mathrm d \theta}$ to perform the above.

How does this compare to doing this with hyperbolic trigonometric functions?

Example 2 Let's integrate ${\displaystyle \int \sqrt{4x^2 + 25} \mathrm d x}$ again, now with hyperbolic trig. We have something of the form ${x^2 + 1}$. Considering our identities above, this suggests that we relate this to ${\cosh^2 \theta = \sinh^2 \theta + 1}$. In particular, we make the relation ${2x = 5 \sinh \theta}$, so that ${4x^2 + 25 = 25 \sinh^2 \theta + 25 = 25 \cosh^2 \theta}$ and ${2 \mathrm dx 5 \cosh \theta \mathrm d \theta}$. (Notice how similar this feels to above so far). This leads to $$ \int \sqrt{4x^2 + 25} \mathrm d x = \frac{25}{2} \int \cosh^2 \theta \mathrm d \theta. $$ We're not as familiar with integrating arbitrary products of ${\sinh \theta}$ and ${\cosh \theta}$, but the thing that makes this reasonable is that behind everything, we just have exponentials – and we completely understand exponentials. Here, $$ \cosh^2 \theta = \left( \frac{1}{2}(e^\theta + e^{-\theta}) \right)^2 = \frac{1}{4} \left( e^{2\theta} + 2 + e^{-2\theta} \right) = \frac{\cosh(2\theta) + 1}{2}, $$ just like the normal cosine! (There are good reasons why these are so parallel). Returning to our integral, \begin{align*} \int \sqrt{4x^2 + 25} \mathrm d x &= \frac{25}{4} \int( \cosh 2 \theta + 1) \mathrm d \theta \\ &= \frac{25}{8} \sinh2 \theta + \frac{25}{4} \theta + C \\ &= \frac{1}{2} x \sqrt{4x^2 + 25} + \frac{25}{4} \arsinh \left( \frac{2x}{3} \right) + C. \end{align*} In many ways, it feels just the same! Right around now, you might be feeling suspicious: why is there an inverse hyperbolic trigonometric function in one and not the other? It turns out that the ${\arsinh}$ expression is equal to the ${\ln}$ expression in the previous answer - something that's easiest checked by plotting their difference in WolframAlpha. An interesting relationship is revealed.

I hope that you now see there are options, and that standard trig and hyperbolic trig are intricately related in thorough and deep ways. More questions should come up. If we can do a problem with normal trig, can we do it with hyperbolic trig? (Answer: yes - maybe you should try a few to see!) Why are these so similar? (Good question, but not something we're going to talk about there). Are there still other ways of doing these problems?

To answer the last one, we're going to deviate from trigonometry, and explore a deeper realm.

5. Euler Substitution

Let me let you in on a little secret: most people don't know what they're doing most of the time. This is true among mathematicians too, leading to something that I like to call 'The Mathematics of Wishful Thinking.' This is when you hope that something is true, or perhaps even start under the assumption that things will work out\dots and they do.

This works far more often then it should. (And perhaps this is why some mathematicians think of math research as exploring a well-defined, beautiful landscape, in a Platonic Form kind of way, as opposed to thinking of math research as building structured complexes on top of models).

Let's consider the phrase ${\sqrt{ax^2 + bx + c}}$. For really large ${x}$, we know that the leading term of the quadratic should dominate, and then since ${ax^2 + bx + c \approx ax^2}$, we would expect that for really large ${x}$, ${\sqrt{ax^2 + bx + c} \approx \sqrt{ax^2} = x\sqrt a}$. You'll notice that I'm implicitly assuming that ${a > 0}$ here.

This might lead you to come up with an implicit substitution. What if we performed the substitution given implicitly by $$ \sqrt{ax^2 + bx + c} = x\sqrt a + t. \tag{1}$$ Squaring (noting that the ${ax^2}$ terms cancel), we can solve for ${x}$ and see that $$ x = \frac{t^2 - c}{b - 2t\sqrt a}. $$ This is the actual substitution corresponding to the implicit substitution above. And most importantly, this is a rational function in ${t}$, as is ${\sqrt{ax^2 + bx + c} = x\sqrt a + t}$. So we've transformed these gross square roots into a rational function, just as with the trigonometric and hyperbolic trigonometric substitutions above!

This is one of the so-called "Euler Substitutions" - which are clever "Mathematics of Wishful Thinking" substitutions. There are a few of them - another is the implicit substitution given by $$ \sqrt{ax^2 + bx + c} = xt + \sqrt c \tag{2}$$ which has the advantage of being defined whenever ${c > 0}$, with no need for ${a > 0}$. You can go and solve for ${x}$ and find the explicit transformation here too.

Example 3 Let's perform the integral ${\displaystyle \int \sqrt{4x^2 + 25} dx}$ again, this time with Euler's First Substitution as in 1. Here, we are interested in writing ${\sqrt{4x^2 + 25} = 2x + t}$, or equivalently (but solving for ${x}$), ${x = \dfrac{t^2 - 25}{-4t}}$. From this last line, we see that $$ dx = \left( \dfrac{2t}{-4t} - \dfrac{t^2-25}{-4t^2} \right)dt = \left( \frac{-1}{4} + \frac{-25}{4t^2} \right)dt $$ Altogether, this gives that \begin{align*} \int \sqrt{4x^2 + 25}dx &= \int (2x + t) \left( \frac{-1}{4} + \frac{-25}{4t^2} \right)dt\\ &= \int \left( \frac{t^2 - 25}{-2t} + t \right)\left( \frac{-1}{4} + \frac{-25}{4t^2} \right)dt\\ &= \int \left( \frac{t}{2} + \frac{25}{2t} \right)\left( -\frac{1}{4} - \frac{25}{4t^2}\right) dt\\ &= \int \left( \frac{-1}{8}t - \frac{25}{4t} - \frac{25^2}{8t^3} \right)dt \\ &= -\frac{1}{16}t^2 - \frac{25}{4}\ln \lvert t\rvert + \frac{25^2}{16t^2} + C \end{align*} Recalling that ${\sqrt{4x^2 + 25} = 2x + t}$, we see that ${t = \sqrt{4x^2 + 25} - 2x}$. So the final answer is $$ \frac{-1}{16} \left( \sqrt{4x^2 + 25} - 2x \right)^2 - \frac{25}{4}\ln \lvert \sqrt{4x^2 + 25} - 2x \rvert + \frac{25^2}{16}\frac{1}{\left( \sqrt{4x^2 + 25} - 2x \right)^2} + C. $$ This is not obviously like the others. Both trigonometric substitutions gave answers with the 'biggest' contribution looking like ${x \sqrt{4x^2 + 25}}$, which is a lot like ${x^2}$ as ${x}$ gets really big. Showing that this is the same in this case is a really good exercise with Taylor series.

While Euler Substitution might seem a bit eccentric, it's also exciting. We did not need to pass through transcendental functions to do this utterly ordinary integral. Perhaps more exciting, we got two expressions that are not obviously equal. This is often a good source of inspiration - why are these the same? What can we discover about one by understanding the other?

6. Concluding Remarks

We've investigated three different techniques of resolving integrals containing problematic square roots of quadratics, like ${\sqrt{ax^2 + bx + c}}$. The techniques we've presented are in some ways similar, and in some ways dissimilar. But something true to all of them is that they are very general.

In fact, given any rational function in ${x, \sqrt{ax^2 + bx + c}}$ for a fixed ${a,b,c}$, we can use any of these three techniques to reduce the problem of finding its antiderivative to finding the antiderivative of a rational function in ${x}$. And in principle, we can find the antiderivative of any rational function in ${x}$ using partial fraction expansions.

So these are three different ways of solving an entire class of functions $$ \displaystyle \int R(x, \sqrt{ax^2 + bx + c})dx $$ for rational functions ${R(u,v)}$. (Here, I'm using rational function to mean a polynomial in ${u}$ and ${v}$ divided by another polynomial in ${u}$ and ${v}$. Yes, these are multivariate polynomials. For example, ${\frac{u^2 + uv + v}{uv + 4uv^3}}$ is a rational function in ${u}$ and ${v}$).

In my math 170 class at Brown, this marks one of the few complete families of functions we can integrate. We can also integrate ${\displaystyle p(x) dx}$ for generic polynomials ${p(x)}$, ${\displaystyle R(x) dx}$ for generic rational functions ${R(x)}$, and ${\displaystyle p(\cos x, \sin x) dx}$ for generic bivariate polynomials ${p(x,y)}$.

For what it's worth, we are only a small step away from the techniques involved in the integrals ${\displaystyle \int R(\cos x, \sin x) dx}$ of generic rational functions ${R(u,v)}$ in ${\sin x}$ and ${\cos x}$. These are also reduced to the evaluation of single variable rational functions, ultimately leading to more partial fractions style integrals. \emph(This is called the Weierstrass substitution, and takes the form ${t = \tan\frac{\theta}{2}}$ if you're interested).

So integration is hard, and there is often not a single, cannonical best way to do integrals. If there are any questions, feel free to comment below. This note was typed in the \TeX typesetting language, hosted on the Wordpress1 1It used to be a Wordpress site site davidlowryduda.com, and displayed with MathJax. This can also be found in pdf note form, and the conversion from note to Wordpress is done using a customized version of latex2wp that I call mse2wp, located at github.com/davidlowryduda/mse2wp.

Leave a comment

Info on how to comment

To make a comment, please send an email using the button below. Your email address won't be shared (unless you include it in the body of your comment). If you don't want your real name to be used next to your comment, please specify the name you would like to use. If you want your name to link to a particular url, include that as well.

bold, italics, and plain text are allowed in comments. A reasonable subset of markdown is supported, including lists, links, and fenced code blocks. In addition, math can be formatted using $(inline math)$ or $$(your display equation)$$.

Please use plaintext email when commenting. See Plaintext Email and Comments on this site for more. Note also that comments are expected to be open, considerate, and respectful.

Comment via email

Comments (1)
  1. 2020-12-23 elio

    For Euler substitutions, do you mind explaining the reasoning for the t term in x*sqrt(a) + t. Is there anywhere else I can read up on this?

    Thanks for this post!