$\require{color}$

# More Pi!

#### February 11th, 2018

Let’s consider the infinite series for $\arctan(x)$

$$\arctan(x) = x -\frac{x^3}{3} + \frac{x^5}{5} -\frac{x^7}{7} + \frac{x^9}{9}\dots$$

$$\frac{\arctan(x)}{x} = 1 -\frac{x^2}{3} + \frac{x^4}{5} -\frac{x^6}{7} + \frac{x^8}{9}\dots$$

$$\frac{\arctan(x)}{x} = 1 -\frac{x^2}{3} + \Big(\frac{x^2}{3}\Big)\Big(\frac{3x^2}{5}\Big) -\Big(\frac{x^2}{3}\Big)\Big(\frac{3x^2}{5}\Big)\Big(\frac{5x^2}{7}\Big) + \Big(\frac{x^2}{3}\Big)\Big(\frac{3x^2}{5}\Big)\Big(\frac{5x^6}{7}\Big)\Big(\frac{7x^2}{9}\Big)\dots$$

Plug in x=1

$$\frac{\pi}{4} = 1 -\frac{1}{3} + \Big(\frac{1}{3}\Big)\Big(\frac{3}{5}\Big) -\Big(\frac{1}{3}\Big)\Big(\frac{3}{5}\Big)\Big(\frac{5}{7}\Big) + \Big(\frac{1}{3}\Big)\Big(\frac{3}{5}\Big)\Big(\frac{5}{7}\Big)\Big(\frac{7}{9}\Big)\dots$$

Now, we are going to do some clever rearranging of the negative signs. This will allow us to more easily see a pattern in the series.

$$\frac{\pi}{4} = 1 +\frac{-1}{3} + \Big(\frac{-1}{3}\Big)\Big(\frac{-3}{5}\Big) +\Big(\frac{-1}{3}\Big)\Big(\frac{-3}{5}\Big)\Big(\frac{-5}{7}\Big) + \Big(\frac{-1}{3}\Big)\Big(\frac{-3}{5}\Big)\Big(\frac{-5}{7}\Big)\Big(\frac{-7}{9}\Big)\dots$$

There is a pattern to the $a_n$. Namely, $a_n$ is the product of the first $n$ terms of another series. Let’s make the following definition

$$r_n = -\frac{2n-1}{2n+1}$$

Then, we can write

$$a_n = \prod_{i=1}^n r_i$$

$$\frac{\pi}{4} = r_o \,+\, r_0r_1 \,+ \,r_0r_1r_2 \,+\, r_0r_1r_2r_3 \dots$$

## Euler’s Formula

Let’s assume that

$$\tag{1}r_o + r_0r_1+ r_0r_1r_2\dots + r_or_1r_2\dots r_n = \cfrac{r_0}{1 – \cfrac{r_1}{1 + r_1 – \cfrac{r_2}{1 + r_2 – \cfrac{\ddots}{\ddots \cfrac{r_{n-1}}{1 + r_{n-1} – \cfrac{r_n}{1 + r_n}}}}}}$$

Then

$$r_o + r_0r_1+ \dots + r_or_1r_2\dots r_n + r_0r_1r_2\dots r_nr_{n+1}=r_o + r_0r_1+\dots + r_0r_1r_2\dots r_n(1+r_{n+1})$$

Since the last $r_n$ is arbitrary, since we just need the last term to be all of $r_n$ multiplied together, we can make the last $r_n$ whatever we want. In this case, we make $r_n = r_n(1+r_{n+1})$

$$= \cfrac{r_0}{1 – \cfrac{r_1}{1 + r_1 – \cfrac{r_2}{1 + r_2 – \cfrac{\ddots}{\ddots \cfrac{r_{n-1}}{1 + r_{n-1} – \cfrac{r_n(1+r_{n+1})}{1 + r_n(1+r_{n+1})}}}}}}$$

Divide both sides of the last fraction by $(1+r_{n+1})$

$$= \cfrac{r_0}{1 – \cfrac{r_1}{1 + r_1 – \cfrac{r_2}{1 + r_2 – \cfrac{\ddots}{\ddots \cfrac{r_{n-1}}{1 + r_{n-1} – \cfrac{r_n}{\cfrac{1}{(1+r_{n+1})} + r_n}}}}}}$$

Reduce the last fraction cleverly

$$= \cfrac{r_0}{1 – \cfrac{r_1}{1 + r_1 – \cfrac{r_2}{1 + r_2 – \cfrac{\ddots}{\ddots \cfrac{r_{n-1}}{1 + r_{n-1} – \cfrac{r_n}{\cfrac{1 +r_{n+1} – r_{n+1}}{(1+r_{n+1})} + r_n}}}}}}$$

$$= \cfrac{r_0}{1 – \cfrac{r_1}{1 + r_1 – \cfrac{r_2}{1 + r_2 – \cfrac{\ddots}{\ddots \cfrac{r_{n-1}}{1 + r_{n-1} – \cfrac{r_n}{1 + r_n – \cfrac{r_{n+1}}{(1+r_{n+1})}}}}}}}$$

If equation $(1)$ holds, for $n$, then it must hold for $n+1$, which means it must hold for $n+2$, and so on. Let’s look at the formula with $n=2$

$$\cfrac{r_0}{1-\cfrac{r_1}{1+r_1 – \cfrac{r_2}{1+r_2}}}= \cfrac{r_0}{1-\cfrac{r_1}{\cfrac{(1+r_1)(1+r_2)}{1+r_2} – \cfrac{r_2}{1+r_2}}}$$

$$= \cfrac{r_0}{1-\cfrac{r_1}{\cfrac{1+r_1+r_2 + r_1r_2 – r_2}{1+r_2}}}$$

$$= \cfrac{r_0}{1-\cfrac{r_1}{\cfrac{1+r_1+ r_1r_2}{1+r_2}}}$$

$$= \cfrac{r_0}{1-\cfrac{r_1+r_1r_2}{1+r_1+ r_1r_2}}$$

$$= \cfrac{r_0}{\cfrac{1+r_1+ r_1r_2}{1+r_1+ r_1r_2}-\cfrac{r_1+r_1r_2}{1+r_1+ r_1r_2}}$$

$$= \cfrac{r_0}{\cfrac{1}{1+r_1+ r_1r_2}}$$

$$= r_0(1+r_1+ r_1r_2)$$

$$=r_0+r_0r_1+ r_0r_1r_2$$

Therefore, since this claim holds for $n=2$, it must hold for $n=3$. Since it holds for $n=3$, it must hold for $n=4$, and so on. Therefore, we have proved Euler’s Formula via induction on $n$.

## Redux

$$\frac{\pi}{4} = 1 +\frac{-1}{3} + \Big(\frac{-1}{3}\Big)\Big(\frac{-3}{5}\Big) +\Big(\frac{-1}{3}\Big)\Big(\frac{-3}{5}\Big)\Big(\frac{-5}{7}\Big) + \Big(\frac{-1}{3}\Big)\Big(\frac{-3}{5}\Big)\Big(\frac{-5}{7}\Big)\Big(\frac{-7}{9}\Big)\dots$$

$$r_o = 1\hspace{10mm} r_1 = \frac{-1}{3}\hspace{10mm} r_2 = \frac{-3}{5}\hspace{10mm} r_3 = \frac{-5}{7}\dots$$

$$\frac{\pi}{4} = \cfrac{1}{1-\cfrac{\cfrac{-1}{3}}{1+\cfrac{-1}{3} – \cfrac{\cfrac{-3}{5}}{1+\cfrac{-3}{5}-\cfrac{\cfrac{-5}{7}}{1+\cfrac{-5}{7}-\dots}}}}$$

This doesn’t look very nice at all. Let’s try to simplify

$$\frac{\pi}{4} = \cfrac{1}{1-\cfrac{\cfrac{-1}{3}}{\cfrac{2}{3} – \cfrac{\cfrac{-3}{5}}{\cfrac{2}{5}-\cfrac{\cfrac{-5}{7}}{\cfrac{2}{7}-\dots}}}}$$

$$\frac{\pi}{4} = \cfrac{1}{1+\cfrac{\cfrac{1}{3}}{\cfrac{2}{3} + \cfrac{\cfrac{3}{5}}{\cfrac{2}{5}+\cfrac{\cfrac{5}{7}}{\cfrac{2}{7}\dots}}}}$$

Here comes the magic. First, I’ll add some parenthesis so we can clearly see the numerator and denominator of one sub-fraction. Sorry, these are the biggest parenthesis I can create in this LaTeX installation.

$$\frac{\pi}{4} = \cfrac{1}{1+\cfrac{\Big(\cfrac{1}{3}\Big)}{\Bigg(\cfrac{2}{3} + \cfrac{\cfrac{3}{5}}{\cfrac{2}{5}+\cfrac{\cfrac{5}{7}}{\cfrac{2}{7}\dots}}\Bigg)}}$$

Multiple both the numerator and denominator by 3

$$\frac{\pi}{4} = \cfrac{1}{1+\cfrac{1}{\Bigg(2 + \cfrac{\cfrac{3^2}{5}}{\cfrac{2}{5}+\cfrac{\cfrac{5}{7}}{\cfrac{2}{7}\dots}}\Bigg)}}$$

I’ll move the parenthesis to repeat the process. Also, I’ll write $1$ as $1^2$, since it makes the formula look nicer

$$\frac{\pi}{4} = \cfrac{1}{1+\cfrac{1^2}{2 + \cfrac{\Bigg(\cfrac{3^2}{5}\Bigg)}{\Bigg(\cfrac{2}{5}+\cfrac{\cfrac{5}{7}}{\cfrac{2}{7}\dots}\Bigg)}}}$$

Multiply the top and bottom by 5

$$\frac{\pi}{4} = \cfrac{1}{1+\cfrac{1^2}{2 + \cfrac{3^2}{\Bigg(2+\cfrac{\cfrac{5^2}{7}}{\cfrac{2}{7}\dots}\Bigg)}}}$$

Then repeat for 7

$$\frac{\pi}{4} = \cfrac{1}{1+\cfrac{1^2}{2 + \cfrac{3^2}{2+\cfrac{\Bigg(\cfrac{5^2}{7}\Bigg)}{\Bigg(\cfrac{2}{7}\dots\Bigg)}}}}$$

Multiply by 7

$$\frac{\pi}{4} = \cfrac{1}{1+\cfrac{1^2}{2 + \cfrac{3^2}{2+\cfrac{5^2}{2\dots}}}}$$

$$\bbox[15px,border:1px solid black]{\pi = \cfrac{4}{1+\cfrac{1^2}{2 + \cfrac{3^2}{2+\cfrac{5^2}{2+\cfrac{7^2}{2\dots}}}}}}$$

You can check the result, sort of… I took (using a computer, of course) the 100 millionth convergent, and I got 3.1415926… This fraction converges REALLY SLOWLY.

———————————————————————————

## Alternate Formula

Alternatively, we can say

$$\pi = 3 + 1 -\frac{4}{3} + \Big(\frac{4}{3}\Big)\Big(\frac{3}{5}\Big) -\Big(\frac{4}{3}\Big)\Big(\frac{3}{5}\Big)\Big(\frac{5}{7}\Big) + \Big(\frac{4}{3}\Big)\Big(\frac{3}{5}\Big)\Big(\frac{5}{7}\Big)\Big(\frac{7}{9}\Big)\dots$$

$$\pi = 3 + \sum_{i=1}^\infty\prod_{n=1}^i r_n$$

$$r_o=1\hspace{10mm} r_1=-\frac{4}{3}\hspace{10mm}r_2=-\frac{3}{5}\hspace{10mm}r_3=-\frac{5}{7}\hspace{10mm}\dots$$

Applying Euler’s formula to this, and then reducing as done before, yields

$$\bbox[15px,border:1px solid black]{\pi = 3+\cfrac{1^2}{6 + \cfrac{3^2}{6+\cfrac{5^2}{6+\cfrac{7^2}{6\dots}}}}}$$

Comment

# Continued Uniform Distributions

#### October 2nd, 2017

Today we are going to work on an interesting probability distribution that I spent some time thinking about recently. The simplest distribution is the uniform distribution. The uniform distribution has equal probability for all numbers in a range. For example, if you have a uniform distribution on $\{1,2,3\}$, then you have a $\frac{1}{3}$ probability of getting each number in that range. It is a little confusing to think about continuous distributions, because each number actually has a 0 percent chance of occurring. If we have a uniform distribution on $[0,5]$, then each individual point has a probability of 0 of occurring, but the probability that we get a number near each number is $\frac{1}{5}$. Make sense? A uniform distribution on $[0,a]$ has probability density function, denoted $f_x$, given by

$f_x= \begin{cases} \frac{1}{a} & 0\leq x\leq a \\ 0 & \text{else} \\ \end{cases}$

I. Our Distribution

So, let’s say we want to generate a number $x$ from a uniform distribution on $[0,a]$, and then we want to generate a number $y$ from a uniform distribution on $[0,x]$. Let’s write down what we are given; we know that $x$ is uniformly distributed on $[0,a]$ and is independent of $y$

$f_x= \begin{cases} \frac{1}{a} & 0\leq x\leq a \\ 0 & \text{else} \\ \end{cases}$

Additionally, if we are given $x$, we know what the distrubution for $y$ is — it’s uniform on $[0,x]$. We denote this as $f_{y|x}$, the probability of $y$ given $x$.

$f_{y|x}= \begin{cases} \frac{1}{x} & 0\leq y\leq x \\ 0 & \text{else} \\ \end{cases}$

II. Manipulation

We start by finding $f_{xy}$, the probability that both $x$ and $y$ occur. We can use the formula

$$f_{xy} = f_{y|x}\cdot f_{x}$$

This gives us

$$f_{xy} = \frac{1}{ax}$$

We know that $x$ will never be more than $a$ or less than 0, and that $y$ will never be more than $x$ or less than 0. So, we can properly define our probability function.

$f_{xy}= \begin{cases} \frac{1}{ax} & 0\leq y\leq x \hspace{3mm}\text{and}\hspace{3mm} 0\leq x\leq a\\ 0 & \text{else} \\ \end{cases}$

This area is shown in the picture below

To find $f_y$, we need to integrate x to remove it from  the equation. If we wanted to integrate over the entire region, we would do

$$\int_0^a\int_y^a f_{xy}\hspace{2mm}\text{d}x\text{d}y \hspace{6mm}\text{or}\hspace{6mm}\int_0^a\int_0^x f_{xy}\hspace{2mm}\text{d}y\text{d}x$$

Since we want to eliminate $x$, we need $x$ to be the interior variable of integration. This will ensure that we have no $x$ term in the integrand for the exterior integral. Therefore, to eliminate $x$, we will use

$$f_y = \int_y^a f_{xy}\hspace{2mm}\text{d}x$$

$$= \frac{1}{a}\int_y^a \frac{1}{x}\hspace{2mm}\text{d}x$$

$$= \frac{1}{a}\ln{x}\hspace{2mm}\Big|_{x=y}^{x=a}$$

$$= \frac{1}{a}(\ln{a}-\ln{y})$$

$$= \frac{1}{a}\ln{\frac{a}{y}}$$

$$\bbox[15px,border:1px solid black]{f_y = \frac{\ln\frac{a}{y}}{a} \hspace{7mm} 0\leq y\leq a}$$