Calculating Square Root of 2

I had so much fun deriving that series which converges to pi the other day that I thought it’d be fun to occasionally whip up such series for other irrational numbers. Today I’ll do \sqrt{2}.

There are many different series that would do the job, the one I’ll derive is found by expanding \sqrt{x} around x=1 as a power series.

Indeed, for x satsfying |x-1| < 1 we have

\begin{array}{ccl} \sqrt{x} & = & 1 + \frac{1}{2}(x-1) - \frac{1}{8}(x-1)^2 + \frac{1}{16}(x-1)^3-\frac{5}{128}(x-1)^4+ ... \\ & = & 1+ \frac{1}{2}\sum_{n=0}^\infty (-\frac{1}{4})^n\frac{(2n)!}{(n!)^2(n+1)}(x-1)^{n+1}\end{array}.

This series is guaranteed to converge for all 0<x<2, and to diverge for all x<0 and x>2.   The number 2 itself sits right on the boundary of the circle of convergence, so although we would like to say

\sqrt{2} = 1 + \sum_{n=0}^\infty (-\frac{1}{4})^n\frac{(2n)!}{(n!)^2(n+1)},

we first need to show that the series is convergent. Consider the sequence a_n = \frac{(2n)!}{4^n(n!)^2(n+1)}. This sequence is monotonically decreasing, and we will show that for all n>0, a_n < \frac{1}{n}. Firstly,

a_1 = \frac{2!}{4\cdot 2} = \frac{1}{4} < 1.

We now assume that a_k < \frac{1}{k} for some integer k and show that a_{k+1} < \frac{1}{k+1}. This is true, since

\begin{array}{ccl}\frac{(2k+2)!}{4^{k+1}((k+1)!)^2(k+2)} & = & \frac{(2k+1)(2k+2)}{4(k+1)(k+2)}\frac{(2k)!}{4^k(k!)^2(k+1)} \\ &=& \frac{(2k+1)(2k+2)}{4(k+1)(k+2)}a_k\\& < & \frac{(2k+1)(2k+2)}{4k(k+1)(k+2)}\\ & = & \frac{1}{4}(\frac{1}{k}+\frac{3}{k+2}) \\ & \leq & \frac{1}{k+1}\end{array},

where the last inequality holds for k\geq1. Thus a_{k} < \frac{1}{k} implies a_{k+1}<\frac{1}{k+1}, and so by induction a_n < \frac{1}{n} for all n.

To show convergence of our series, we note we have shown enough to invoke the alternating series test. So it is true that

1 + \sum_{n=0}^\infty (-\frac{1}{4})^n\frac{(2n)!}{(n!)^2(n+1)}

converges, and by continuity  it must equal \sqrt{2}. Truncating the series at n=10,000,000 gives

\sqrt{2}\approx 1.4142135623775118

which is correct up 11 decimal places.

Happy Belated Pi Day

I didn’t create this blog until after Pi day, so unfortunately I’m a bit late. I celebrate Pi day by deriving the same series expression for pi every year. I’m not sure who to attribute this particular method to, but I definitely learned in from some old calculus book once upon a time. It’s as simple as calculating \int_0^1\frac{1}{x^2+1}dx two different ways and equating the results. First up, we can make the substitution x = \tan\theta and simplify yielding \int_0^{\pi/4}d\theta = \frac{\pi}{4}. On the other hand, if |x|<1 then \sum_{n=0}^\infty(-1)^nx^{2n} converges (uniformly on all intervals |x|\leq r < 1) to \frac{1}{x^2+1}, and so may proceed with

\int_0^1\frac{1}{1+x^2}dx = \sum_{n=0}^\infty(-1)^n\int_0^1x^{2n}dx. Each \int_0^1x^{2n}dx = \frac{1}{2n+1}, and so putting it all together we’re left with

\pi = 4\sum_{n=0}^\infty \frac{(-1)^n}{2n+1} = 4(1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+...)

And there it is!

Generating Function for Fibonacci Sequence

We seek closed form for the power series \sum_{n=0}^\infty F_nz^n, where F_0 = 1, F_1 = 1 and F_{n+2} = F_{n+1} + F_n. First we note that the ratio test yields

\lim_{n\rightarrow\infty}\frac{F_{n+1}}{F_n}|z| = \varphi |z|, where \varphi = \frac{1+\sqrt{5}}{2} is the golden ratio. Thus the series converges on the region of the complex plane where |z| < \frac{1}{\varphi}. Now let the power series be denoted by F(z), and note that

F(z) - zF(z) - z^2F(z) = 1 + \sum_{n=0}^\infty (F_{n+2}-F_{n+1}-F_n)z^{n+2} = 1

and so F(z) = \frac{1}{1-z-z^2}. It seems so unlikely, before you know better at least, that things like that can be done. Why should it be that the nth Fibonacci number is given by \frac{1}{2\pi i}\oint\frac{1}{z^{n+1}(1-z-z^2)}dz, the integral along some closed contour in the complex plane of a function that otherwise seems unrelated. That’s maths!