Integration trick

Here’s a clever example from Paul Nahin’s new book Inside Interesting Integrals. Suppose you want to evaluate

\int_{-1}^1 \frac{\cos(x)}{\exp(1/x) + 1}\,dx

Since the range of integration is symmetric around zero, you might think to see whether the integrand is an odd function, in which case the integral would be zero. (More on such symmetry tricks here.) Unfortunately, the integrand is not odd, so that trick doesn’t work directly. However, it does help indirectly.

You can split any function f(x) into its even and odd parts.

f_e(x) = \frac{f(x) + f(-x)}{2} \\ f_o(x) = \frac{f(x) - f(-x)}{2}

The integral of a function over a symmetric interval is the integral of its even part because its odd part integrates to zero. The even part of the integrand above works out to be simply cos(x)/2 and so the integral evaluates to sin(1).

6 thoughts on “Integration trick

  1. Neat trick. Using the same basic trick it follows that for any even function g_e(x) and any odd function g_o(x) that:
    $\int_{-1}^{1} \frac{g_e(x)}{\exp(g_o(x)) + 1} \, d x = \frac{1}{2} \int_{-1}^{1} g_e(x) \,d x$

    (Which looks hard to believe).

  2. Hi John. I had already spotted that book on Amazon! Sounds interesting…is it worth buying?! Best, Marco

  3. Hey John,

    Thanks for mentioning “Inside Interesting Integrals”… Bought it for Christmas. :)

    Do you know any book like that about differential equations?

  4. Thanks. Unfortunately I don’t know of such a book for differential equations. If you write one, let me know. :)

Leave a Reply

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