Posted by: Dave Richeson | February 18, 2010

## More about the neat calculator trick

Yesterday I wrote about a neat calculator trick that I had just learned.

We saw that if the calculator was set to degree mode, then ${\displaystyle \sin(\frac{1}{555\cdots 5})}$ times a high enough power of 10 is approximately ${\pi}$.

A commenter named Robert suggested looking at the difference between this approximation for ${\pi}$ and ${\pi}$ itself. He remarked that the error is also approximately ${\pi}$ too (when multiplied by a sufficiently high power of 10)!

For example,

$\displaystyle \sin(1/5555555555)=3.14159265390395250385303346595\ldots\times 10^{-12}.$

If we shift the decimal point over we get an approximation of ${\pi}$:

$\displaystyle 10^{12}\sin(1/5555555555)=3.14159265390395250385303346595\ldots$

Now we look at the error

$\displaystyle 10^{12}\sin(1/5555555555)-\pi=3.1415926539039008267\ldots\times 10^{-10},$

which if we shift again is

$\displaystyle 10^{10}(10^{12}\sin(1/5555555555)-\pi)=3.1415926539039008267\ldots$

Wow! Now why is this true?

The key observation is that

$\displaystyle \frac{1}{180}=0.00\bar{5}=0.00555555+00000000\bar{5}=555555\cdot10^{-7}+10^{-5}\frac{1}{180},$

or in general,

$\displaystyle \frac{1}{180}=n_{k}\cdot10^{-k-2}+10^{-k}\frac{1}{180},$

where ${n_{k}}$ denotes the ${k}$-digit integer of all 5′s. With a little algebra we see that

$\displaystyle \frac{1}{n_{k}}=10^{-k-2}\cdot\frac{180}{1-10^{-k}}.$

As I mentioned last time, if the calculator is in degree mode and ${x\approx 0}$, then ${\sin(x)\approx \pi x/180}$. So,

$\displaystyle \sin\Big(\frac{1}{n_{k}}\Big)\approx\frac{\pi}{180}\cdot 10^{-k-2}\cdot\frac{180}{1-10^{-k}}=\frac{\pi10^{-k-2}}{1-10^{-k}}.$

This implies that

$\displaystyle 10^{k+2}\sin\Big(\frac{1}{n_{k}}\Big)\approx\frac{\pi}{1-10^{-k}}\approx \pi.$

Now, the error in this approximation is

$\displaystyle 10^{k+2}\sin\Big(\frac{1}{n_{k}}\Big)-\pi\approx\frac{\pi}{1-10^{-k}}-\pi=\frac{10^{-k}\pi}{1-10^{-k}}.$

We can rewrite this as

$\displaystyle 10^{k}(10^{k+2}\sin\Big(\frac{1}{n_{k}}\Big)-\pi)\approx\frac{\pi}{1-10^{-k}}\approx \pi.$

## Responses

1. Thanks for providing the explanation!

2. [...] The math behind a neat calculator trick [Update: after you read this post, read my follow-up post.] [...]

3. Instead of remembering the decimal expansion for 1/180, I usually just remember that .kkkkkk… is k/9 (where k is any single digit). .1111… is 1/9, from which it follows that .222… is 2/9, etc.

The analogous statement is true in other numerical bases; for example, .222222… in base 3 is 2/3.

All of which follows trivially from the formula for infinite geometric sums, but remembering it this way is sometimes useful.

For example, 555555 is approximately 5/9 times 10^6.

4. “The analogous statement is true in other numerical bases; for example, .222222… in base 3 is 2/3.”

Shouldn’t that be 2/3 for base _4_, ie, the denominator is base – 1? To state it a different way, .22222… in base 3 is like .99999… in base 10 = 1.