Continued fraction expansion of tan(x)

3 comments

Introduction

One of the most intriguing formulas which I encountered during my 12th grade was the continued fraction expansion of $ \tan x$. It was given in a book on "Numerical Analysis" and was offered as an example of a formula which converges very fast (like something comparable to the Maclaurin series for $ \sin x$ and $ \cos x$). However like the usual practice followed in mathematics textbooks it was offered without any proof or any context. I checked the formula using calculator and was amazed with its speed of convergence. Just 10 terms were enough to give the result with an accuracy up to 10 decimals.

After so much praise and historical context it is now time to display the formula: $$\tan x = \frac{x}{1 -}\frac{x^{2}}{3 -}\frac{x^{2}}{5 -}\frac{x^{2}}{7 -}\cdots = \cfrac{x}{1 - \cfrac{x^{2}}{3 - \cfrac{x^{2}}{5 - \cfrac{x^{2}}{7 - \cfrac{x^{2}}{9 - \cdots}}}}}$$ One simple fact which is clearly visible from the formula is that $ \tan x$ is an odd function (i.e. $ \tan(-x) = -\tan x$). Apart from this I could not think of anything else to infer from this formula. After some more thought I had this two more obvious deductions: $$\lim_{x \to 0}\frac{\tan x}{x} = 1$$ and $$\cfrac{\pi^{2} / 4}{3 - \cfrac{\pi^{2} / 4}{5 - \cfrac{\pi^{2} / 4}{7 - \cdots}}} = 1$$ It should be obvious to the reader by now that I had no idea whatsoever about its proof. I was lucky enough to find the proof of this formula some years later in college in Chrystal's Algebra. Its an old but famous book (especially famous for this particular proof and the proof that $ \pi$ is irrational based on this continued fraction). The remainder of the post provides this very same proof to the readers.

Chrystal's Proof

Let's start with the following series expansion: $$F(n, x) = 1 + \frac{x}{1!(\gamma + n)} + \frac{x^{2}}{2!(\gamma + n)(\gamma + n + 1)} + \cdots$$ Here we assume $ n$ to be a non-negative integer and real number $ \gamma \neq 0, -1, -2, -3, \cdots$). Then the infinite series on the right converges for all real $ x$ and therefore defines a function $ F(n, x)$.

The general $ (m + 1)^{\text{th}}$ term of $ F(n, x)$ is given by $$\frac{x^{m}}{m!(\gamma + n)(\gamma + n + 1)\cdots(\gamma + n + m - 1)}$$ and therefore the $ (m + 1)^{\text{th}}$ term of $ F(n + 1, x) - F(n, x)$ is given by \begin{align} &-\frac{x^{m}}{m!}\left(\frac{\gamma + n + m - \gamma - n}{(\gamma + n)(\gamma + n + 1)\cdots(\gamma + n + m)}\right)\notag\\ &\,\,\,\,= -\frac{x^{m}}{(m - 1)!}\cdot\frac{1}{(\gamma + n)(\gamma + n + 1)\cdots(\gamma + n + m)}\notag\\ &\,\,\,\,= \frac{-x}{(\gamma + n)(\gamma + n + 1)}\left(\frac{x^{m - 1}}{(m - 1)!(\gamma + n + 2)\cdots(\gamma + n + m)}\right)\notag \end{align} Thus it follows that \begin{align} &F(n + 1, x) - F(n, x)\notag\\ &\,\,\,\,= \frac{-x}{(\gamma + n)(\gamma + n + 1)}\left(1 + \frac{x}{1!(\gamma + n + 2)} + \frac{x^{2}}{2!(\gamma + n + 2)(\gamma + n + 3)} + \cdots\right)\notag\\ &\,\,\,\,= \frac{-x}{(\gamma + n)(\gamma + n + 1)}F(n + 2, x)\notag \end{align} Let us now define $ G(n, x) = F(n + 1, x) / F(n, x)$. Upon dividing the above recurrence relation for $ F(n, x)$ by $ F(n, x)$ we get $$G(n, x) - 1 = \frac{-x}{(\gamma + n)(\gamma + n + 1)}G(n + 1, x)G(n, x)$$ i.e. $$G(n, x) = \dfrac{1}{1 + \dfrac{x}{(\gamma + n)(\gamma + n + 1)}G(n + 1, x)}$$ Repeated application of this recurrence relation gives us the following: $$G(0, x) = \dfrac{1}{1 +}\dfrac{x / \gamma(\gamma + 1)}{1 +}\dfrac{x / (\gamma + 1)(\gamma + 2)}{1 +}\cdots \dfrac{x / (\gamma + n - 1)(\gamma + n)}{1 - \left(1 - \dfrac{1}{G(n, x)}\right)}$$ Chrystal goes on to establish in detail that we can continue the continued fraction on the right upto infinity and the resulting infinite continued fraction is convergent for all real values of $ x$. The two ingredients needed to establish this are: first that the resulting infinite continued fraction is convergent, and second that $ \lim_{n \to \infty} G(n, x) = 1$. The second part is easy to see because we have $ \lim_{n \to \infty} F(n, x) = 1$ so that $ \lim_{n \to \infty} G(n, x) = 1$. The convergence part of infinite continued fractions will be covered in a later post and then we will be able to apply the criterion of convergence to this very continued fraction and we will see that it is convergent. In this post we will not go into these details and assume that the following holds for all values of $ x$: $$G(0, x) = \frac{1}{1 +}\frac{x / \gamma(\gamma + 1)}{1 +}\frac{x / (\gamma + 1)(\gamma + 2)}{1 +}\frac{x / (\gamma + 2)(\gamma + 3)}{1 +}\cdots$$ and after slight manipulation we get $$\frac{F(1, x)}{F(0, x)} = \frac{\gamma}{\gamma +}\frac{x}{\gamma + 1 +}\frac{x}{\gamma + 2 +}\cdots$$ Magic happens when we put $ \gamma = 1 / 2$ and then \begin{align} F\left(1, \frac{-x^{2}}{4}\right) &= \frac{\sin x}{x}\notag\\ F\left(0, \frac{-x^{2}}{4}\right) &= \cos x\notag\\ F\left(1, \frac{x^{2}}{4}\right) &= \frac{\sinh x}{x}\notag\\ F\left(0, \frac{x^{2}}{4}\right) &= \cosh x\notag \end{align} It now follows that \begin{align} \tan x &= \frac{x}{1 -}\frac{x^{2}}{3 -}\frac{x^{2}}{5 -}\frac{x^{2}}{7 -}\cdots = \dfrac{x}{1 - \dfrac{x^{2}}{3 - \dfrac{x^{2}}{5 - \dfrac{x^{2}}{7 - \dfrac{x^{2}}{9 - \cdots}}}}}\notag\\ \tanh x &= \frac{x}{1 +}\frac{x^{2}}{3 +}\frac{x^{2}}{5 +}\frac{x^{2}}{7 +}\cdots = \dfrac{x}{1 + \dfrac{x^{2}}{3 + \dfrac{x^{2}}{5 + \dfrac{x^{2}}{7 + \dfrac{x^{2}}{9 + \cdots}}}}}\notag \end{align} Chrystal goes on to prove further that if $ x$ is a non-zero rational number then both the above continued fractions are irrational numbers. This leads to the fact that $ e^{x}$ is irrational if $ x$ is a non-zero rational number and the irrationality of $ \pi$ follows because $ \tan(\pi / 4) = 1$ is rational. We will have occasion to discuss more about this proof of irrationality of $ \pi$ in a later post.

I had tried to start a discussion on NRICH on this topic but did not get much response from the general public in that forum. The thread on NRICH however contains one more elementary formula which leads to a proof of this continued fraction for $ \tan x$ and reader is encouraged to prove the elementary formula (I haven't yet proved it myself).

Note: The entire development of continued fraction expansion of $ \tan x$ as given in Chrystal's Algebra is taken from Johann Heinrich Lambert's classic paper in which he proved that $ \pi$ is irrational. Lambert gives a process through which one can convert the ratio of two convergent series into a continued fraction and applies it to the case of $ \tan x = \sin x / \cos x$ and thereby obtains the given continued fraction. And using a simple criterion of irrationality of continued fractions he proves that $ \pi$ is irrational.

There are two points which are worth mentioning about this proof in contrast to the shorter proof given by Charles Hermite and later simplified by Ivan Niven: 1) this proof is simpler and mostly algebraical in nature if one avoids the issues of convergence of continued fractions and 2) compared to Niven's proof it is much more obvious and direct. This again reiterates my belief in Abel's "Read the masters!" principle. I really don't understand why Lambert's proof is left out in modern texts in preference to Niven's.

P.S. Another simpler proof of the continued fraction expansion of $\tan(x)$ is presented here. However this is specific to the function $\tan(x)$.

Print/PDF Version

3 comments :: Continued fraction expansion of tan(x)

Post a Comment

  1. Thanks for your article. I’m thinking about buying Chrystal’s book to explore this in more detail. Can you please tell me whether it is part 1 or part 2 of “Algebra An Elementary Text” that I need to purchase for this purpose? Many thanks, Ian

  2. @Ian,

    Chrystal's book should be available online free of cost as it is out of copyright now. The continued fraction of $\tan x$ is handled in chapter 34 of part 2.

    Regards,
    Paramanand

  3. I follow your posts on MSE. I am very grateful for this blog and this post in particular! Thank you. Regards, FShrike from MSE