Let's start out with the definition of pi.
pi is the ratio of the circle's circumferance to its diameter, d. I'm sure everyone here is familiar with what a degree measurement is. A degree is easier for us humans to work with. What a degree isn't is natural. Nature isn't really accustomed to whole units the way we are. Nature's measurement is the radian. The conversion between the two is 180 deg=pi rad. Ok. You may accept that just because I said it, but lets look into why that is. A commonly known formula for the circumference of a circle is 2*pi*radius. If the radius is 1 then that becomes 2*pi. What we can then do is look at that as if it were a rotation of 2*pi units that is the length of the circumference. Half of 2*pi is going to be pi and a semicircle has 180 degrees! Now the next thing we need to look at is the tangent function.
The tangent of angle A is side y divided by side x. The tangent of A is written as tan(A). When A is 45 degrees, or pi/4 radians, x and y will be equal. In that case, no matter what x and y are, y/x is going to be 1. So, we know that the triangle whose tangent is 1 has an angle with measurement of pi/4 radians. Lucky for us, there is a function called inverse tangen, which finds the angle if you give it y/x. There is a few ways of writing it, but I'll write the inverse tangent of n as atan(n). We could now say:
pi/4=atan(1)
pi=4*atan(1)
Now what we need to do is compute an inverse tangent. Lucky for us, there is a formula:
atan(x)=x-x3/3+x5/5-x7/7+x9/9-x11/11+x13/13-....... {-1<=x<=1}
If we put substitute 1 in for x, we get:
atan(1)=1-1/3+1/5-1/7+1/9-.......
We can carry this out as far as we want and then multiply it by 4 to get pi. While this works, it is extremely slow. There are much quicker methods that involve much more complicated formulas. Another formula is pi=16*atan(1/5)-4*atan(1/239). It is much quicker. Look at the formula for inverse tangent and see if you can figure out why.