# An Amazing Formula

Generalizing Leibniz' formula for π, the alternating harmonic series, and the Basel problem

A couple of years ago I was thinking about how to generalize many of the infinite series that we know so well. It was clear to me that it was possible to generalize them since some of my studies into the field of Fourier series had led me to some of these generalizations in the past. But it was clear that I needed another way - a more controlled way to generate such formulas.

Not long ago, I found a method and I couldn’t sleep that night because I was calculating like crazy in my head. The next morning, I wrote the proof down and that journey is exactly what I want to share with you today.

# A Simple Idea

Recall the geometric series:

This series only converges for |x| < 1.

Also note that if we subtract 1 on both sides, we get:

Let 0 < r < 1, then we can substitute in the complex exponential as follows:

Now here’s the idea. If we integrate with respect to *x* on both sides, we will get series on the right-hand side that generalizes the harmonic series except for the r that is only present because we need the series to converge. We will deal with that shortly, for now just hold on tight and enjoy the ride.

If we use Euler’s formula we can transform the complex exponential into its trigonometric real and complex parts, the usual trick is to multiply the numerator and the denominator by the complex conjugate of the denominator to separate the real and complex parts.

When we do that, we get

If we integrate that with respect to x and do the same to the series, we get the following:

Now for the interesting part. Note that if we let r → 1 on the left-hand side, and split it up in the real and complex parts, then for certain values of *x*, we have our convergence!

Therefore, letting r → 1 and multiplying by 2πi on both sides, gives us:

This holds when *0<x<1*.

Here we have used the double angle formula for *sine.*

and the evenness of the numeric brackets.

Let’s expand the series on the left by using Euler’s identity. Then we have two formulas. For the *sine *series, we get

and by setting *x=1/2* into the formula we find the constant term to be π/2. We can now state our newly found formulae:

In the *sine *formula, if we set *x = 1/4, *we get that the alternating series 1 - 1/3 + 1/5 - 1/7 + ⋅⋅⋅ = π/4, which is a very famous formula (*wrongly* credited to Leibniz). It lets us approximate π in an astonishingly simple manner and of course, and it is surprising since no circles seem around in this series.

In the *cosine *formula, if we set x = 1/2, we get 1 - 1/2 + 1/3 - 1/4 +⋅ ⋅ ⋅ = ln(2). This is another famous result! This series is called the alternating harmonic series.

What if set x = 1/4 in the cosine series? Then we get

Let’s see if our formula agrees.

If we plug in x = 1/4 in the expression on the right-hand side we get:

which of course agrees with the above.

We can put the two formulas in one formula by again using Euler’s identity. We have:

which is - in my opinion, a pretty amazing formula!

Now, this is not all.

If we integrate the sine series with respect to x then something interesting happens.

Let’s try it.

Note that this is a generalization of the famous *Basel problem* posed about 1650 and solved by Leonhard Euler in 1734.

To summarize the result:

Note that this is true even if x = 0 or x = 1 (Notice that now the series converges in those cases). However, it does not hold outside that interval.

Also, note the symmetry of the cosine function is displayed in the symmetry of the parabola x(x-1) from 0 to 1.

This approach can be used to generalize other particular values of the Riemann zeta function at least with natural number argument.

Unfortunately, it is a little harder to integrate the right-hand side of the cosine series formula but that doesn’t mean that we can’t do analysis by this approach.

You can try to take this generalization further. If you make progress, I would like to know…