<s>[INST] Prove this formula for $\pi$ I have to use a certain approximation for $\pi$ for my computer science class, but I don't really understand what's going on, other than that this is related to the Taylor polynomial for arctangent. Could someone please prove that this is equal to $\pi$? 
It's on the first formula under the subsection "Middle Ages" on this page: Approximations of π:
$$ \pi = \sqrt{12}\sum^\infty_{k=0} \frac{(-3)^{-k}}{2k+1} = \sqrt{12}\sum^\infty_{k=0} \frac{(-\frac{1}{3})^k}{2k+1} = \sqrt{12}\left(1-{1\over 3\cdot3}+{1\over5\cdot 3^2}-{1\over7\cdot 3^3}+\cdots\right)$$
 [/INST] To give an explanation:
It is well known that $\tan'(x)=1+\tan^2(x)$. By deriving $\tan(\arctan(x))=x$ we get: $$\arctan'(x)\cdot\tan'(\arctan(x))=\arctan'(x)\cdot\left(1+(\tan(\arctan(x)))^2\right)=\arctan'(x)\cdot\left(1+x^2\right)=1\iff\arctan'(x)=\frac{1}{1+x^2}$$ and by the standard formula of geometric series we have $\arctan'(x)=\sum_{k=0}^{\infty} \left(-x^2\right)^k$ for $|x|<1$. Therefore we have:
$$
\arctan(x)=\int_{0}^{x}\left(\sum_{k=0}^{\infty} \left(-t^2\right)^k\right)dt=\sum_{k=0}^\infty \left(\int_{0}^x \left(-t^2\right)^k dt\right)=\sum_{k=0}^\infty \left((-1)^k\int_{0}^x t^{2k} dt\right)=\sum_{k=0}^\infty \frac{(-1)^kx^{2k+1}}{2k+1}={x\sum_{k=0}^\infty \frac{(-1)^kx^{2k}}{2k+1}}=x\sum_{k=0}^\infty \frac{\left(-x^2\right)^k}{2k+1}
$$
And therefore:
$$
\arctan\left(\frac{1}{\sqrt3}\right)=\frac{1}{\sqrt3}\sum_{k=0}^\infty \frac{\left(-\frac{1}{3}\right)^{k}}{2k+1}
$$
Taking a look at the basic definitions of the trigonometric functions on the unit circle we see that $\tan\left(\frac{\pi}{6}\right)$ is a leg of the right triangle which is the half of a regular triangle, while the other leg is $1$. Since $\tan\left(\frac{\pi}{6}\right)$ is the half of the sides of the regular triangle, the hypothenuse is $2\tan\left(\frac{\pi}{6}\right)$. So by the Pythagorean theorem we have:
$$
1+\tan^2\left(\frac{\pi}{6}\right)=4\tan^2\left(\frac{\pi}{6}\right)\iff\tan\left(\frac{\pi}{6}\right)=\frac{1}{\sqrt3}\iff 6\arctan\left(\frac{1}{\sqrt3}\right)=\pi
$$
And therefore:
$$
\pi=6\cdot\frac{1}{\sqrt3}\sum_{k=0}^\infty \frac{\left(-\frac{1}{3}\right)^{k}}{2k+1}=\sqrt{12}\sum_{k=0}^\infty \frac{\left(-\frac{1}{3}\right)^{k}}{2k+1}
$$
</s>