How Real Functions Can Fool You

Let’s look at two functions that my calculus book says are pretty different.

$$f(x)=\frac{1}{1-x^2}$$ and $$g(x)=\frac{1}{1+x^2}$$.

 

tworealfunctions

Their graphs sure look different, and finding antideriatives requires completely different techniques.  For f(x), I’m supposed to use partial fractions:

$$\int \frac{dx}{1-x^2}= \int \frac{1}{2}(\frac{1}{1-x}+\frac{1}{1+x}) dx$$
$$= \frac{1}{2} (\log|1+x|-\log|1-x|).$$
On the other hand, g(x) requires a trigonometric substitution of x=tan t to give a very different-looking result.
$$\int\frac{dx}{1+x^2}= \int\frac{dt/\cos^2 t}{1+\tan^2 t} $$
$$=\int\frac{dt/\cos^2 t}{1/\cos^2 t}=\int dt=t=\arctan x.$$
We are of course exploiting a trigonometric identity here, $$1+\tan^2 t = 1/\cos^2 t$$ which is obtained by dividing the identity $$\sin^2 t +\cos^2 t = 1$$ by the square of cosine. (My calculus book also says I’m supposed to write ln for log, secant for the reciprocal of cosine, and stick a bunch of +C’s at the end of everything, but I’m a grown-
up and this is my post, so thppppt.)

Did the minus sign in the denominator really make these functions so different? After doing these two standard examples, students could easily be left with the impression that they are. They are not. Let’s integrate each of these functions using the “correct” method for the other function and see what my calculus book is not telling me.

First we will integrate f(x) with substitution. The sign is wrong to use the same trig identity as g(x), but not if we introduce the hyperbolic trig functions$$\sinh x = \frac{e^x-e^{-x}}{2},$$ $$\cosh x = \frac{e^x+e^{-x}}{2},$$ and $$\tanh x = \frac{\sinh x}{\cosh x}.$$

hyberbolictriggraphs

The following properties are easy to verify from the definitions.

$$\cosh^2 t – \sinh^2 t = 1$$
$$1-\tanh t = 1/\cosh^2 t $$

$$\frac{d}{dx}\cosh x = \sinh x$$

$$\frac{d}{dx}\sinh x = \cosh x$$
$$\frac{d}{dx}\tanh x = \frac{1}{\cosh^2 x}$$

The first identity is worth a thought. Look at the curve x=cosh t, y=sinh t parameterizes: $$x^2-y^2=1.$$ The hyperbolic trig functions parameterize a hyperbola in exactly the same way the standard trig functions x=cos t, y=sin t parameterize a circle. Hence the name.

hyperbolacircle

Anyway, that identity lets us integrate f(x) with the substitution x=tanh t. The calculation is nearly identical to how we did g(x).
$$\int\frac{dx}{1-x^2}= \int\frac{dt/\cosh^2 t}{1-\tanh^2 t} $$
$$=\int\frac{dt/\cosh^2 t}{1/\cosh^2 t}=\int dt=t=\mathrm{arctanh }\ x$$.

“But wait,” you say, “that’s not what we got before!” It is, because $$\mathrm{arctanh }x = \frac{1}{2} (\log|1+x|-\log|1-x|).$$ You can check that from the definition of hyperbolic tangent with some careful execution of logarithm and exponent rules, or you can simply note that by showing their derivatives are the same and observing that they agree at x=0, we just proved it using one of the most powerful techniques in mathematics: doing a problem two ways.

Now we will integrate g(x) with partial fractions. The obstruction seems to be that $$1+x^2$$ does not factor, but it does if we allow complex numbers. Those are numbers of the form a+bi where a and b are real and i is a magic new number with the property that $$i^2=-1.$$ In fact, every polynomial of degree n factors into exactly n linear terms with complex numbers. This is a property of the complex numbers called algebraic closure, and it is one of many reasons why complex numbers are in many ways more natural than real numbers. (Unfortunately, don’t hold your breath on modern high school curricula figuring that out.)
Here we go. You do need to trust me that calculus work just fine in the complex plane.  You also need to trust me that it is alright to drop the absolute values inside the logarithm (defining the logarithm in the complex plane is actually a bit subtle because it really should take on multiple values, but trust me, this can all be sorted out).
$$\int \frac{dx}{1+x^2}= \int \frac{1}{2}(\frac{1}{1-i x}+\frac{1}{1+i x}) dx$$
$$= \frac{1}{2i} (\log(1+ix)-\log(1-ix))$$
$$= -\frac{i}{2} (\log(1+ix)-\log(1-ix)).$$
That last bit uses the handy identity 1/i = -i (to see that, multiply by i/i=1). Now we have some horrible mess with complex numbers all over the place, but we can get
rid of those fairly easily. First, remember the identity $$\mathrm{arctanh }\ x = \frac{1}{2} (\log|1+x|-\log|1-x|)$$ we proved above. This tells us that
$$\int \frac{dx}{1+x^2}= -\frac{i}{2} (\log(1+ix)-\log(1-ix)) = -i\ \mathrm{arctanh }\ ix.$$ What happens with those i’s now?

This gives me an opportunity to show off one of the most beautiful formulas in mathematics, $$e^{it}=\cos t+ i\sin t.$$  You can prove this with basic calculus using power series. You may have noticed that if you ignore the signs, the even coefficients of the exponential function are the terms of cosine and the odd terms are sine. The i‘s make the signs all match up. In real functions, exponential and trigonometric functions could not look more different. As complex functions, they are the same thing. In fact, the hyperbolic trig functions are the bridge between them:
$$\sinh ix = \frac{1}{2}(e^{i x}-e^{-i x}) = \frac{1}{2}(\cos x+ i\sin x – \cos(-x) -i\sin(-x))= i\sin x$$
Similar calculations give cosh ix = cos x and tanh ix = i tan x. From there, we can deal with our arctanh problem: if y=arctanh ix, then tanh y =ix, so x=-i tanh y=-tanh iy. Finally, -arctanh x =iy and so y = i arctanh x. We are using 1/i=-1 and that tanh is odd. We have now shown
$$\int \frac{dx}{1+x^2} = -i\ \mathrm{arctanh }\ ix=-i\times i\ \mathrm{arctan }\ x=\mathrm{arctan }\ x$$ with partial fractions.

A few pedagogical take-aways here:

  • Some may complain that arctanh is unfamiliar and they’d prefer $$\frac{1}{2} (\log|1+x|-\log|1-x|)$$ because it just has logarithms. But once you spend five minutes looking at tanh x, you see it is an entirely reasonable function with easy-to-prove properties. I see arctanh x and I understand it completely because I can flip the graph of tanh x and see everything I need. When I see the logarithm expression, I want to go home. Don’t blame hyperbolic arctangent just because it is not on your calculator.
  • This is an example of how you can solve some problems in real functions by briefly visiting them in the complex plane.
  • Seriously, the complex numbers are just beautiful. Lots of geometry and everything’s easier.
  • Go easy on your calculus teacher if you feel cheated. I teach lots of calculus and don’t usually get far into this, and I care enough to write a big blog post about it. Calculus is packed with content, and you really need to go back and smell some of the roses you barreled past the first time.

(Edits:  Took care of some typos and a touch of sloppiness.  Thanks Manan and Erik for catching them.)


Thank you for reading! I want to keep in touch with my readers. If you are interested, click here to sign up!

Do you enjoy this blog?
Consider supporting with a contribution!



6 thoughts on “How Real Functions Can Fool You

  1. Steve Lucas

    A very nice reminder about the beauty of doing work with complex numbers. Unfortunately, modern US high schools have moved to teaching a “plug and chug” version of calculus instead of beefing up the pre-calculus with topics like complex numbers. I saw them in high school, but that was more than 30 years ago in Australia!

    If you want an alternative and can put it off till after Taylor series, one interesting approach is to integrate the Taylor series of your two functions term by term. That way you get the correct solutions and they look really similar. Going back to the original functions fro the Taylor series is instructive, and you can again bring in the e^{ix} result when talking about the Taylor series of sin versus sinh etc.

    Minor comments:
    * Yes the complex plane makes everything easier, but I really wouldn’t want to mix a complex analysis course into my calculus sequence, which is over-full as it is.
    * Arctanh is on any standard high school calculator, but may be hidden in the more extensive list of functions.
    * Using log instead of ln is typical in complex analysis, and most computer programming languages, but you will be confusing your students if you don’t use standard notation.
    * And I’m sorry, but you can’t just drop the +C! There are enough times when different integration techniques lead to answers that differ by a constant that you should always include it, especially as an adult. You got lucky here that the answers were the same.

    Reply
    1. Bill

      You’re right about the Taylor series — I would actually prefer a model of calculus where the course starts with Taylor series rather than ends with them — but the point here is to address something that comes up specifically in the “stupid integral tricks” part of the course. A lot of derivative and integral results are more satisfying when you look at the series, but students are usually pretty calculused out by the time you can get to them.

      Actually, part of the reason I wrote this is so that when I show these standard examples in my class I can say, “By the way, we could have switched the techniques here and it would be perfectly fine, but some more tools are required to make it all work out.” Then send interested students here. Because you’re right, calculus is overstuffed with content as is. Although we should be teaching kids complex numbers in grade school, we don’t, so we’re stuck not doing it here.

      Log is standard for natural log in almost every setting except for calculus books. But you’re right, one is always best to use the notation of the text to avoid confusion. Authors just need to start adjusting to the fact that the “common log” is no longer common and does not deserve default status.

      And you’re right about the +C thing, of course. I just didn’t want to make that point for every calculation and assumed the reader could verify the initial values him or herself.

      Reply
  2. Jim Friess

    I remember learning hyperbolic trigonometry way back in the dark ages when I took calculus, but not teaching it when I was teaching at university years later (also 20 years ago). It always struck me as funny.
    Is this a part of the standard curriculum these days?

    Reply
    1. Bill

      It is still in most of the books but it gets skipped or skimped a lot. I think the geometry is rarely covered. I did get to teach a differential equations oriented Calc 2 once where they were featured players.

      Reply
  3. Sue VanHattum

    This is beautiful! I just tested my Calc II students on techniques of integration. I will show them this post.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *