June 3, 2010

A symmetry trick for integration

Filed under: Tricks of the Trade — Adam Glesser @ 9:00 am

Tricks of the Trade

(with Professor Glesser)

Parentheses in mathematics never fails to impress me. Take, for instance, the freshman dream:

(x + y)^2 = x^2 + y^2


Not only do the parentheses matter, but in nontrivial way. Another of my favorite examples is the difference between \sin(x)^2 and \sin(x^2). Just a teeny little difference that makes all the difference in the world. You see, the first function is always greater than or equal to 0. Here are their graphs:



Outside of (-2,2), they aren’t even close. Of course, this suggests that if you integrate them, you expect to get wildly different answers (there are some exceptions to this: try integrating both from 0 to \pi/4). Ah, but there is a little problem when you try to integrate, isn’t there? You can probably handle (possibly with a great deal of effort) finding an antiderivative for \sin(x)^2, but more about that in a bit. Rather oddly, there is no elementary antiderivative for  \sin(x^2). Integrating it from 0 to x gives an example of a Fresnel integral, but already this is beyond what most of my students want to hear in calculus. So, let’s talk about what we can actually do.

C’mon, Get to the Trick

I’ve seen two reasonable ways to find the antiderivative of \sin(x)^2 = \sin^2(x): integration by parts and trig identities. The former method is actually used twice along with a little trick (I’ll get back to this later in the summer when I have a four-part series on integration by parts), while the latter requires you to remember how to convert products of sines into the cosine of a sum. I tend to use the former since I don’t have to remember anything, but the latter is probably a bit easier.

Using either method, we get \sin^2(x) = -\dfrac{1}{2} \sin x \cos x + \dfrac{x}{2} + C. Now, say that we want to compute \displaystyle\int_0^{2\pi} \sin^2(x)\ dx (this is a rather common integral that seems to show up quite a bit in integral calculus and, especially, in multivariable calculus when you start doing coordinate changes). Using the fundamental theorem of calculus, we have:

\displaystyle\int_0^{2\pi} \sin^2(x)\ dx = -\dfrac{1}{2} \sin x \cos x + \dfrac{x}{2} \bigg\vert^{2\pi}_0

= \left(-\dfrac{1}{2}\sin(2\pi)\cos(2\pi) + \dfrac{2\pi}{2}\right) - \left(-\dfrac{1}{2}\sin(0)\cos(0) + \dfrac{0}{2}\right)

and after realizing all the terms but one are 0, we see that the integral evaluates as \pi.

Some trick. I already knew how to do that.

Here is the trick. Notice that \sin(x) and \cos(x) have nearly identical graphs on [0, 2\pi], the only difference is a shift. This implies that if you integrate them on [0, 2\pi], you should get the same answer, i.e., \displaystyle\int_0^{2\pi} \sin(x)\ dx =\displaystyle\int_0^{2\pi} \cos(x)\ dx. If we square both functions, the same result holds: \displaystyle\int_0^{2\pi} \sin^2(x)\ dx = \displaystyle\int_0^{2\pi} \cos^2(x)\ dx ( you better convince yourself of this before moving on).

From here, we get \displaystyle\int_0^{2\pi} \sin^2(x)\ dx = \dfrac{1}{2}\displaystyle\int_0^{2\pi} \sin^2(x) + \cos^2(x)\ dx.

Why did we clutter up our integrand? Because, of course, we didn’t. The integrand is 1 and hence the integral evaluates to the length of the interval. In particular, \displaystyle\int_0^{2\pi} \sin^2(x)\ dx =\dfrac{1}{2}(2\pi) = \pi.

Cool, no?

But that is just one integral

True, but it is an important one. False, because obviously we can use it to compute \displaystyle\int_0^{2\pi} \cos^2(x)\ dx = \pi. Okay, that is cheating a bit. But we can actually go a little further. First, we really didn’t think hard enough about the last example. Consider the graph of \sin^2(x) on [0, \pi]:

Notice that we get a full period of \sin^2(x). Therefore, the reason what we did above worked on [0, 2\pi] is that it works on [0, \pi] and we just repeated it.  Instead of the observation about \cos^2(x) , we could also draw a rectangle with height 1 and width \pi and remark that the area under the graph makes up precisely half the area of the rectangle, i.e., \displaystyle\int_0^{\pi} \sin^2(x)\ dx = \dfrac{1}{2}(\pi) = \dfrac{\pi}{2}. The graph makes it obvious that we could also look at only [0, \pi/2].

Before you get too excited, though, this will not work on any interval. We don’t get \displaystyle\int_0^{\pi/4} \sin^2(x)\ dx = \dfrac{1}{2}(\pi/4). Generally speaking, you want the interval to consist of integer multiples of \pi/2.

Is that it?

Not quite. Roger Nelsen, in a paper entitled Symmetry and Integration described the following Putnam problem:

\displaystyle\int_0^{\pi/2} \dfrac{dx}{1 + \tan(x)^{\sqrt{2}}}

This problem is absolutely ridiculous. Wait—did I say ridiculous? I meant ridiculously easy!!! Consider the graph of \dfrac{1}{1 + \tan(x)^{\sqrt{2}}}:

It appears to have the same sort of symmetry as before. In fact, if we draw in few lines and do some shading, we get:

With just a modicum of thought, we see that \displaystyle\int_0^{\pi/2} \dfrac{dx}{1 + \tan(x)^{\sqrt{2}}} = \dfrac{1}{2}\left(\dfrac{\pi}{2}\right) = \dfrac{\pi}{4}.

Whoa! What is going on here?

Actually, a lot. But let me keep it simple (there are nice generalizations of what I’ll write here); I’ll give a heuristic argument for why these things work. The key is that the functions we’ve been dealing with are symmetric about a point. Without going into too much detail, let’s just say that a function f(x) is symmetric about a point (a, f(a)), which is the midpoint of an interval (c,d), if for any x such that a+x is still in the interval (c,d), the average of f(a+x) and f(a-x) is f(a), i.e., \dfrac{f(a+x) + f(a-x)}{2} = f(a). Truly, then, the average value of the function on (c,d) is f(a). However, we also know that the average value of any continuous function on an interval (c,d) is given by \dfrac{1}{d-c}\displaystyle\int_c^d f(x)\ dx. Therefore, f(a) = \dfrac{1}{d-c}\displaystyle\int_c^d f(x)\ dx or, equivalently, \displaystyle\int_c^d f(x)\ dx = (d-c)f(a).

In our case, (c,d) = (0, \pi/2), a = \pi/4, f(x) = \dfrac{1}{1 + \tan(x)^{\sqrt{2}}} and we get \displaystyle\int_0^{\pi/2} \dfrac{dx}{1 + \tan(x)^{\sqrt{2}}} =(\pi/2 - 0)\dfrac{1}{1 + \tan\left(\dfrac{\pi}{4}\right)^{\sqrt{2}}} = \dfrac{\pi}{4}. Well, except for one thing. We still need to show the averaging property. This is just a little bit of algebra, thankfully. First, I leave it as an exercise to show that \tan\left(\dfrac{\pi}{4} + x\right) = \dfrac{1}{\tan\left(\dfrac{\pi}{4} - x\right)} (try converting things into sines and cosines and using the angle addition formulas). Now, for simplicity, we write t = \tan\left(\dfrac{\pi}{4} + x\right). The average is now given by

\dfrac{1}{2}\left(\dfrac{1}{1+t^{\sqrt{2}}} + \dfrac{1}{1 + t^{-\sqrt{2}}}\right), where the negative exponent comes from \dfrac{1}{\tan\left(\dfrac{\pi}{4} - x\right)} = \dfrac{1}{t}.

Using our fraction addition trick, this becomes {\dfrac{1}{2}\left(\dfrac{2 + t^{-\sqrt{2}} + t^{\sqrt{2}}}{2 + t^{-\sqrt{2}} + t^{\sqrt{2}}}\right) = \dfrac{1}{2}} which is the required value.


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: