# Calculate $\pi$ precisely using integrals?

This is probably a very stupid question, but I just learned about integrals so I was wondering what happens if we calculate the integral of $\sqrt{1 - x^2}$ from $-1$ to $1$.

We would get the surface of the semi-circle, which would equal to $\pi/2$.

Would it be possible to calculate $\pi$ this way?

• Yes, that is precisely correct (although I'm not sure what you mean by "without using pi"). Feb 19, 2011 at 12:23
• Well, I don't know how to calculate the integral of $\sqrt{1-x^2}$, but is calculating the surface possible this way using integrals, instead of using pi itself? So as a workaround, so to say. Feb 19, 2011 at 12:24
• This is not a stupid question at all. First of all, there is no way to "compute $\pi$ precisely". Figuring out approximations for $\pi$, say by estimating the area of a circle, is a famous part of mathematics. See en.wikipedia.org/wiki/Numerical_approximations_of_%CF%80 Feb 19, 2011 at 19:13
• Find Pi using integrals in Geogeobra or Desmos: t.co/b3Cu0FVBYi and t.co/HbNeArfQWP Apr 9, 2017 at 12:26

If you want to calculate $\pi$ in this way, note that the expansion of

$$\sqrt{1-x^2} = 1 - \sum_{n=1}^\infty \frac{(2n)!}{(2n-1)2^{2n}(n!)^2} x^{2n}$$

and so if we integrate term by term and evaluate from $-1$ to $1$ we will end up with the following formula for $\pi$:

$$\pi = 4 \left\lbrace 1 - \sum_{n=1}^\infty \frac{(2n)!}{(4n^2-1)2^{2n}(n!)^2} \right\rbrace .$$

In fact, the indefinite integral of $\sqrt{1-x^2}$ is $\frac12(x\sqrt{1-x^2} + \arcsin{x}) + C$, so you are actually "using" $\pi$ in the arcsine if you solve this somehow symbolically, as

$$\int_{-1}^1 \sqrt{1-x^2}\,\mathrm dx = \arcsin 1 = \frac{\pi}{2}$$

• Or $$\int \limits_{-1}^{1} \frac{1}{\sqrt{1-x^2}}\,{\rm d}x = \pi$$ since the indefinite integral is $\arcsin(x)$ Dec 29, 2016 at 13:37

Yes, this integral converges to $\pi/2$. If you evaluate the integral numerically, with your favorite integration scheme, you can compute digits of $\pi$.

• Thanks. Is it perhaps possible to express $\pi/2$ using square roots or something like that, instead of $\pi$ itself? Feb 19, 2011 at 12:27
• If you mean roots of rational numbers, then no, because pi is transcendental and combinations of roots of rationals are algebraic Feb 19, 2011 at 12:30
• There is the reciprocal of Viète's formula $\frac{\pi}{2}= \frac{2}{\sqrt2}\cdot \frac{2}{\sqrt{2+\sqrt2}}\cdot \frac{2}{\sqrt{2+\sqrt{2+\sqrt2}}}\cdots$ but that is an infinite product. Feb 19, 2011 at 14:03
• There are many formulas shown on en.wikipedia.org/wiki/Pi under the heading Computation in the computer age that involve powers and roots and converge very quickly Feb 19, 2011 at 15:29
• Note that the usual techniques for approximating integrals converge poorly in this example because the derivative is unbounded at the endpoints. So to get a good approximation you have to be careful and deal with the first and last rectangles separately. Feb 23, 2021 at 15:22

You can also refer this thread:

$$\int\limits_{0}^{1} \frac{x^{5}(1-x)^{6}(197+462x^{2})}{530(1+x^{2})} + \frac{333}{106}= \pi$$

There is one more that is not necessarily an integral but is interesting nonetheless $\tan^{-1} x=x-\frac{x^3}{3}+\frac{x^5}{5}...\frac{(-1)^{n}x^{2n+1}}{2n+1}$ so $\pi=4\tan^{-1} 1=4\left (1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}...\right )=$ $4\sum_{n=0}^{\infty}\frac{(-1)^{n}}{2n+1}$ but as an integral... $4\int_{0}^{1}\frac{1}{1+x^2}\text{d}x=\pi$

The answer is more no than yes.

There are plenty definite integrals giving an answer which is a function of $$\pi$$. In particular yours,

$$2\int_{-1}^1\sqrt{1-x^2}\,dx=\left.\left(x\sqrt{1-x^2}+\arcsin(x)\right)\right|_{-1}^1=\pi.$$

But this does not bring you any closer to the numerical value of $$\pi$$.

There are many ways to obtain a desired number of decimals of $$\pi$$, using finite approximations of various sequences, series or integrals (this is a broad topic). In particular, you can estimate the above area using the Newton-Cotes numerical method or similar, but this will be very slow and is not used in practice. You can also evaluate the antiderivative at the bounds (again using a numerical approximation such as a truncated Taylor series) but it is also dead slow in this particular setting.

As others have replied, yes, $$\pi$$ can be calculated that way using numerical integration or from an integrated infinite series. This is to provide a tip to improve the calculation's performance. Both the numerical and series methods suffer from slow convergence toward the correct value if integrated from -1 to 1, perhaps for different reasons. The infinite slopes at -1 and 1 are apparently problematic for the numerical methods and the infinite series, being an expansion around zero, performs poorly at those extremes. Both methods converge much faster if we integrate from 0 to 0.5. Those limits give you a 30 degree slice of the circle plus a 30 degree right triangle below the slice whose area must be subtracted out before multiplying by 12 to get the approximation to $$\pi$$.

The series method performs best. Starting with the series given by Derek Jennings, but integrating the terms only from 0 to 0.5, then doing the subtraction and multiplication, gives the following formula.

$$\pi = 12 \left\lbrace 0.5 - \sum_{n=1}^\infty \frac{(2n)!}{(4n^2-1)2^{4n+1}(n!)^2} - \frac{ \sqrt{3}}{8} \right\rbrace .$$

Sample results follow given as (-1 to 1, 0 to 0.5) carried out to the first incorrect digit. For n=1, (3.3, 3.15). For n=5, (3.17, 3.141595). For n=15, (3.148, 3.14159265359). I believe you will find a similarly dramatic improvement if you try the same approach using a numerical integration formula, such as Simpson's rule.

Yes, this is absolutely correct. In fact, you can expand $$\sqrt{1 + x^2}$$ using binomial theorem. This will give you an infinite series. If you integrate that from 0 to 1, you can calculate $$\frac{\pi}{4}$$ to an arbitrarily high precision simply by adding fractions.

$$(1 + x)^n = 1 + nx + \frac{n(n-1)x^2}{2!} + \frac{n(n-1)(n-2)x^3}{3!} + \frac{n(n-1)(n-2)x^4}{4!} +........$$

$$\sqrt{(1 - x^2)} = (1 - x^2)^\frac{1}{2} = 1 + \frac{-x^2}{2} + \frac{\frac{1}{2}*(\frac{1}{2} - 1)}{2!}(-x^2)^2 + \frac{\frac{1}{2}*(\frac{1}{2} - 1)*(\frac{1}{2} - 2)}{3!}(-x^2)^3 ........$$

$$\sqrt{(1 - x^2)} = (1 - x^2)^\frac{1}{2} = 1 -\frac{x^2}{2} - \frac{x^4}{8} - \frac{x^6}{16} ..........$$

Integrating this seeries from 0 to 1 will give you $$\frac{\pi}{4}$$.

$$\int_0^1 \sqrt{(1 - x^2)} = \int_0^1 1 -\frac{x^2}{2} - \frac{x^4}{8} - \frac{x^6}{16} .......... = [x - \frac{1}{2}*\frac{x^3}{3} - \frac{1}{8}*\frac{x^5}{5} - \frac{1}{16}*\frac{x^7}{7}.....]^1_0$$

$$= [1 - \frac{1}{2}*\frac{1^3}{3} - \frac{1}{8}*\frac{1^5}{5} - \frac{1}{16}*\frac{1^7}{7}.....] - [0 - \frac{1}{2}*\frac{0^3}{3} - \frac{1}{8}*\frac{0^5}{5} - \frac{1}{16}*\frac{0^7}{7}.....]$$

$$= 1 - \frac{1}{2}*\frac{1}{3} - \frac{1}{8}*\frac{1}{5} - \frac{1}{16}*\frac{1}{7}.....$$

$$= 1 - \frac{1}{6} - \frac{1}{40} - \frac{1}{112}..... = \frac{\pi}{4}$$

$$= 4[\frac{1}{6} - \frac{1}{40} - \frac{1}{112}.....] = \pi$$

Want to calculate $$PI$$ through methods of Calculus?

Here are the steps to follow:

• First, we need to calculate the distance of a line
• Then we need to geometrically look at the graph of any arbitrary curve
• From there, we can assign points and derive equations to approximate individual line segments between two points with the same $$dx$$ value.
• After this we will algebraically manipulate the distance formula into a form with respect to $$dx$$.
• Now we need to apply the Mean Value Theorem to our modified distance formula.
• Next we'll use Summations to approximate the length of that curve.
• Once we have our Summation in the form we want; we can replace it with a Riemann Integral.
• After that, we need to gather some information about $$pi$$ and relate it to our Reimann Integral.
• We can find the lower and upper bounds quite easily from the unit circle.
• We can use the general equation of the circle that is fixed at the origin $$(0,0)$$
• Here we need to find $$y$$ then we can convert it to a function $$f(x)$$.
• Before we can use it, we first need to find its derivative.
• Once we have the derivative we can plug it into our Integral.
• Finally, we can go through the steps of Integration and evaluate it and see that we do in fact end up with $$pi$$.

To calculate the length of a line we can use the Distance Formula or basically the Pythagorean Theorem: $$L = \sqrt{\left(x_2 - x_1\right)^2 + \left(y_2 - y_1\right)^2}$$

This is simple for a straight line, so how do we go about finding the length of a curved line?

Take a look at the following graph of an arbitrary curved defined by some function $$f(x)$$. The graph above shows the formula for finding the approximate length of each of the line segments $$P_{i-1}P_i$$. We can approximate the total length of the curve through summation by the following formula.

$$L\approx\sum_{i=1}^n \lvert{P_{i-1}P_i}\rvert$$

We can write the distance formula as:

$$\lvert P_{i-1}P_i\rvert = \sqrt{\left(\Delta x\right)^2 + \left(\Delta y\right)^2}$$

We know that $$\Delta x = x_i-x_{i-1}$$ and $$\Delta y = y_i-y_{i-1}$$.

However, we know that for every $$\Delta x$$ its length doesn't change, but for every $$\Delta y$$ it depends on $$\Delta x$$.

Let $$\Delta y_i = y_i-y_{i-1}$$ and the distance formula now becomes:

$$\lvert P_{i-1}P_i\rvert = \sqrt{\left(\Delta x\right)^2 + \left(\Delta y_i\right)^2}$$

With the distance formula written in this form we can now use the Mean Value Theorem show below: Therefore:

$$f'\left(x_i^*\right) = \frac{\Delta y_i}{\Delta x}$$

$$\Delta y_i = f'\left(x_i^*\right)\Delta x$$

Now the distance formula becomes:

$$= \sqrt{\left(\Delta x\right)^2 + \left(f'\left(x_i^*\right)\Delta x\right)^2}$$ $$= \sqrt{\left(\Delta x\right)^2 + \left[1 + \left[f'x_i^*\right]^2\right]}$$

Since $$\Delta x$$ is positive

$$= \Delta x\sqrt{1 + \left(f'\left(x_i^*\right)\right)^2}$$ $$= \sqrt{1 + \left(f'\left(x_i^*\right)\right)^2}\Delta x$$

Where this calculates the length of a single line segment based on $$\Delta x$$.

Since this summation $$L\approx\sum_{i=1}^n \lvert P_{i-1}P_i\rvert$$ is an approximation of all of the line segments, can we do better than this?

Yes, we can! We can apply limits!

We can now apply limits to the number of line segments $$\left(n\right)$$

By taking the limits we can now write our length formula as:

$$L = \lim\limits_{n \to \infty}\sum_{i=1}^n\sqrt{1 + \left[f'\left(x_i^*\right)\right]^2}\Delta x$$

The above is a Riemann Integral therefore:

$$= \int_a^b\sqrt{1+\left(f'\left(x\right)\right)^2}dx$$

This will give us an accurate length of a curve by a given function $$f\left(x\right)$$ based on its derivative $$f'\left(x\right)$$.

We can use this to accurately calculate $$\pi$$.

Before using the above to calculate $$\pi$$ we need to consider what $$\pi$$ is. We know that the circumference of a circle is defined by $$c = 2\pi r$$. We can let $$r = 1$$. This will simply give us $$2\pi$$ for the circumference of the Unit Circle.

We need a function for the curve to use in our integral above. We know that the arc length of the full circle is $$2\pi$$ so we know that $$\frac{1}{2}$$ of this will be $$\pi$$ which is what we are looking for. The equation of an arc length is $$s = r\theta$$. We know that $$r = 1$$ and $$\theta = \pi$$ radians. This doesn't help us with the above equation. We need two points $$a$$ and $$b$$.

There are two properties about the unit circle that we can use here. First, we know that the diameter of the circle along the $$x-axis$$ contains the points $$\left(1,0\right)$$ and $$\left(-1,0\right)$$. We also know that a straight line has an angle of $$180°$$ which is $$\pi$$ radians.This is nice an all but we need a function.

We know that the general equation of a circle is defined as $$\left(x-h\right)^2 + \left(y-k\right)^2 = r^2$$ where $$\left(h,k\right)$$ is the center point to the circle. We are going to fix the unit circle at the origin $$\left(0,0\right)$$. This will give us $$x^2 + y^2 = r^2$$ which is basically a form of our Distance Formula or the Pythagorean Theorem that we started with. So how does this help us?

It's quite simple, we know that the radius of the unit circle is $$(1)$$.

We can set this in our equation above. $$x^2 + y^2 = (1)^2$$ which simplifies to $$x^2 + y^2 = 1$$. Since we need a function with respect to $$x$$, we can solve this equation for $$y$$.

$$x^2 + y^2 = 1$$ $$-x^2 = -x^2$$ $$y^2 = 1-x^2$$

and since $$y^2$$ will result in a $$+$$ value we can just simply take the square root of both sides $$y=\sqrt{1-x^2}$$ then convert it to a function of $$x$$ $$f(x)=\sqrt{1-x^2}$$

Now we are ready to use it, except for one more step. The integral above requires the derivative of the curve that we need so we need to find the derivative of the above function.

$$f'\left(x\right) = \frac{d}{dx}\left[\sqrt{1-x^2}\right]$$ $$= \frac{1}{2} \left(1-x^2\right)^{\frac{1}{2}-1}*\frac{d}{x}\left[1-x^2\right]$$ $$= \cfrac{\frac{d}{dx}\left[1\right] - \frac{d}{dx}\left[x^2\right]}{2\sqrt{1-x^2}}$$ $$= \cfrac{0-2x}{2\sqrt{1-x^2}}$$ $$= -\cfrac{x}{\sqrt{1-x^2}}$$

Now that we have our derivative with respect to $$x$$ and we know the $$x$$ values from the two points are $$1$$ and $$-1$$ we can use these in our integral.

$$\pi = \int_{-1}^1\sqrt{1+\left(f'\left(x\right)\right)^2}dx$$ $$\pi = \int_{-1}^1\sqrt{1+\left(\cfrac{-x}{\sqrt{1-x^2}}\right)^2}dx$$

Now we can solve - evaluate our integral.

Problem: $$\arcsin(x) + C$$ Rewrite/simplyfy $$= \int\sqrt{\cfrac{x^2}{1-x^2}+1}dx$$ This is standard integral: $$= \arcsin(x)$$ The Problem is solved: $$\int\cfrac{1}{\sqrt{1-x^2}}dx$$ $$i\ln\left(\left|\sqrt{x^2-1}+x\right|\right) + C$$

And this approximates $$\pi$$ with a value of $$3.141592653589793$$

Here's a graph of the approximate integral since computers can not perform infinite limits. • The OP computes the area, not the circumference.
– user65203
Oct 29, 2020 at 9:12
• @YvesDaoust The last graph shown is in terms of area. It is the area under the curve to the derivative of the function that was used between two bounds. Initially, an arbitrary arc was used to derive the Riemann Sum. We're not using it to find arc length, that's why we applied the derivative of a curved function to this Riemann Integral between two bounds. This does result in an area. If we only perform a discrete amount of steps in this Riemann Sum, the value will be approximate, but if you can apply it indefinitely through the use of limits it will give you the accurate value of PI. Oct 29, 2020 at 12:30
• My computer cannot afford an infinite amount of computation. Fortunately, I am not interested to see all decimals.
– user65203
Oct 29, 2020 at 12:47
• And I mean the area under the circle, not under another integrand, don't trick me.
– user65203
Oct 29, 2020 at 12:48
• @YvesDaoust Wasn't trying to trick you. Regardless of the units being to the 1st, 2nd, or 3rd power, etc... units, units^2, units^3, the resulting value is still PI agnostic of the units. The Integral does calculate PI very accurately between those two bounds, it's just that the more iterations you do or the smaller dx is, the more accurate the value will approximate to PI. It is when the number of iterations is at infinity and dx approaches 0, that you will get the true value of PI. This is one of the many reasons why PI is both irrational and transcendental. Oct 29, 2020 at 20:35