How does atan(1) * 4 equal PI?

36.6k Views Asked by At

I needed the PI constant in C++, and I was lead to the answer that:

const PI = atan(1) * 4

Note that despite involving code, I'm asking this from a mathematics perspective.

I have 2 questions about this:

  • Is this an estimation of PI, or should it give me a large degree of accuracy?
  • How does this give PI?

On the second point, if I understand atan correctly, it takes a ratio of two sides, and returns the corresponding angle.

That means that atan(1) is referring a situation with 2 equal length sides.

I think I'm misunderstanding something though, as atan(1) gives me 0.7853981633974483, which seems like a very tiny angle.

If anyone can fill in the holes, it would be greatly appreciated.

4

There are 4 best solutions below

4
On BEST ANSWER

The function $\arctan\colon \mathbb{R}\to (-\frac{\pi}{2},\frac{\pi}{2})$ is the inverse of $\tan$. (for the right domain of definition). As $\tan \frac{\pi}{4} = 1$, this means that $\arctan 1=\frac{\pi}{4}$.

Regarding your question about angles: angles are (in mathematics) measured in radians (in $[0,2\pi)$ or $[-\pi,\pi)$), not in degrees: you should expect a value or order $\pi$ or so, not ranging between $0$ and $360$.

0
On

You certainly know that $\sin{\frac{\pi}{4}}=\cos{\frac{\pi}{4}}=\frac{\sqrt{2}}{2}$ so one has $\tan{\frac{\pi}{4}}=1$ and therefore $\pi=4\tan^{-1}{1}$

0
On

I'm including this little gif from Wikipedia as a great way to understand radians.

enter image description here

0
On

This shows geometric explanation for relationship between tan, atan and Pi.

Because horizontal segment AB = 1 and vertical segment BD = 1, angle alpha = 45°. From there you can use atan( BD ) to determine 45° in radiant and take that times 4 to get Pi.

enter image description here