Associated Topics || Dr. Math Home || Search Dr. Math

### Continued Fraction for Tan(x)

```
Date: 11/03/2000 at 09:56:45
From: Joseph
Subject: "Continued Fraction" for the Tangent Function

Dear Dr. Math,

I was reading about pi on a math site. I saw something that blew my
mind! They said that the first argument that pi has to be irrational
was based on this formula (I've copied it down so I can type it out
exactly):

1
tan x = ----------------------------
1              1
- + -----------------------
x    3           1
- + ------------------
x    5         1
- + -------------
x    7      1
- + --------
x    9
- + ...
x

Can you give me a hint as to why this formula is true? They called it
an "infinite continued fraction representation." I know about
convergent series and infinite products, so I think I understand how
you would define this. But how on earth did they get this particular
formula? I can follow the rest of the argument from there. Thanks!
```

```
Date: 11/03/2000 at 11:24:36
From: Doctor Rob
Subject: Re: "Continued Fraction" for the Tangent Function

Thanks for writing to Ask Dr. Math, Joseph.

The above formula is erroneous. You have written the continued
fraction for tanh(x), the hyperbolic tangent of x. Correct is:

1
tan x = ----------------------------
1              1
- - -----------------------
x    3           1
- - ------------------
x    5         1
- - -------------
x    7      1
- - --------
x    9
- - ...
x

This can be rewritten in the form

x
tan x = -----------------------------
x^2
1 - ------------------------
x^2
3 - --------------------
x^2
5 - ----------------
x^2
7 - ------------
x^2
9 - --------

11 - ...

Define

infinity
Psi(c;z) =   SUM    1/[c*(c+1)*...*(c+k-1)] * z^k/k!
k=0

where c is a complex constant but not a nonpositive integer, and z is
a complex variable. Sometimes this is denoted by 0F1(c;z). Observe
that

sin(x) = x*Psi(3/2;-x^2/4)
cos(x) = Psi(1/2;-x^2/4)

Let {a(n)} be a sequence of complex numbers defined by

a(n) = 1/[(c+n-1)*(c+n)],  n = 1, 2, 3, ...
Let
P(n) = Psi(c+n;z),  n = 0, 1, 2, 3, ...

Then it is easily shown that the power series P(n) satisfies the
3-term recurrence relation

P(n) = P(n+1) + a(n+1)*z*P(n+2),  n = 0, 1, 2, ...

Divide both sides by P(n+1), and rearrange to get

P(n)/P(n+1) = 1 + a(n+1)*z/[P(n+1)/P(n+2)]

Thus, starting with n = 0 and doing chain substitution, you'll see
that

a(1)*z
P(0)/P(1) = 1 + ------------------------
a(2)*z
1 + --------------------
a(3)*z
1 + ----------------
a(4)*z
1 + ------------
a(5)*z
1 + --------

1 + ...

I leave the matter of convergence aside, but it does work for all
complex numbers z. Now when c = 1/2, P(0)/P(1) is just

P(0)/P(1) = Psi(1/2;z)/Psi(3/2;z)
and
a(n) = 4/[(2*n-1)*(2*n+1)]

so you get the equation

4*z/(1*3)
Psi(1/2;z)/Psi(3/2;z) = 1 + --------------------------
4*z/(3*5)
1 + ----------------------
4*z/(5*7)
1 + ------------------
4*z/(7*9)
1 + --------------
4*z/(9*11)
1 + ----------

1 + ...

Now substitute z = -x^2/4, and you get

-x^2/(1*3)
cos(x)/[sin(x)/x] = 1 + ---------------------------
-x^2/(3*5)
1 + -----------------------
-x^2/(5*7)
1 + -------------------
-x^2/(7*9)
1 + ---------------
-x^2/(9*11)
1 + -----------

1 + ...

From here it is not too difficult a rearrangement to get the continued
fraction first mentioned in my answer above.

- Doctor Rob, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory
High School Trigonometry

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search