Deriving a Power Series for π
Today, I want to talk about how you can use a power series to define π. No CS today, all math! My impetus for writing this post was reading through the chapter 11.9 exercises of Stewart Calculus, one of which asks you to prove that a specific infinite series equals π, so I wanted to take it a step further and derive that series from the definitions of trigonometric functions. Hope you enjoy!
Given a right triangle, we define the main trigonometric functions as follows:
where o and a are the opposite and adjacent sides relative to the angle, and the hypotenuse is the side opposite the 90 degree angle. From the definitions of sine and cosine, we derive the tan
, csc
, sec
, and cot
functions. Tangent, in particular, is defined as
The trigonometric functions each have inverses, and we can define them. For arctan
, it is
Using implicit differentiation, we can calculate the derivative of arctan
easily:
If we draw a right triangle with the angle y
, we can see that
which implies that
From the definition of power series and geometric series, we know that
We can derive a series for
by rewriting it as
If we integrate term by term, we can derive the power series for arctan
by integrating term by term like so:
We can evaluate the endpoints (x=±1), but we don’t need to for our purposes. We can just use the fact that
Since π/6 is in the interval of convergence, if we evaluate the series at that value, and multiply the whole thing by 6, we get
which simplifies to
This converges pretty slowly, and isn’t a great approximation, and you probably shouldn’t use it to calculate π. If you’re just a user of pi, just hardcode the value or use your programming language’s hardcoded value. If you actually care about calculating the digits of π, use the Ramanujan-Sato series or the Chudnovsky algorithm. I wrote this post because I think it’s pretty cool that you can define π as an infinite series.
Anyway, till next time, thanks for reading (: