This post started out as a Twitter thread. The text below is the same as that of the thread after correcting an error in the first part of the thread. I also added a footnote on a theorem the thread alluded to.
***
The following approximation for sin(x) is remarkably accurate for 0 < x < π.
The approximation is so good that you can’t see the difference between the exact value and the approximation until you get outside the range of the approximation.
Here’s a plot of just the error.
This is a very old approximation, dating back to Aryabhata I, around 500 AD.
In modern terms, it is a rational approximation, quadratic in the numerator and denominator. It’s not quite optimal since the ripples in the error function are not of equal height [1], but the coefficients are nice numbers.
***
As pointed out in the comments, replacing x with π/2 − x in order to get an approximation for cosine gives a much nicer equation.
***
[1] The equioscillation theorem says that the optimal approximation will have ripples of equal positive and negative amplitude. This post explores the equioscillation theorem further and finds how far Aryabhata’s is from optimal.
The cosine version (shifting it over by π/2 so the peak is at zero) is much prettier:
(π^2 – 4x^2) / (π^2 + x^2)
That is prettier. Thanks!