Home - HomeschoolMath.net      IXL math practice
You are here: HomeArticles → How does a calculator...

How does the calculator find values of sine (or cosine or tangent)?

Here's a question I once received from a reader:

Exactly what happens when I type the sine (or cos or tan etc for that matter) of an angle into my calculator? I type it in and it magically gives me an answer, a number that is essentially unrelated to the angle I inputed. Is the calculator just reading off of a list created from people who used rulers to physically measure the distance on a graph or is there a mathematical function that defines it?

A calculator or computer program is not reading off of a list, but is using an algorithm that gives an approximate value for the sine of a given angle. There are several such algorithms that only use the four basic operations (+, −, ×, /) to find the sine, cosine, or tangent of a given angle.

One way is to take a certain amount of terms (the more terms you take, the more accurate the approximation) from the Taylor series for sine:

sin x = x − x3/3! + x5/5! − x7/7! + ...,

where x is in radians. For example, to find out sine 23, first convert 23 to radians by dividing it by 180 and then multiplying by π. We get 23/180 π = 0.401425727958696 ≈ 0.4014257.

Then use the above formula to get the value of sin 0.4014257:

sin 0.4014257
= 0.4014257 − 0.40142573/3! + 0.40142575/5! − 0.40142577/7!
= 0.4014257 − 0.0107811296737492 + 0.000086864959350 − 0.000000333277256
= 0.390731102008345

Calculator would give sin 23 = 0.390731128489274 so the formula got it right for the first seven decimals (and there even exists an error estimate that tells you the maximum error you make when you use a certain number of terms from the Taylor series).

graph of sine and its Taylor polynomial See how closely the polynomial formed from the first four terms of the Taylor series approximates the sine curve near the origin. In fact, they look identical in the image, but we know they are not exactly the same, just very very close - even the above calculation shows that.

Calculators don't actually use the Taylor series but the CORDIC algorithm to find values of trigonometric functions. The Cordic algorithm is based on thinking of the angle as the phase of a complex number in the complex plane, and then rotating the complex number by multiplying it by a succession of constant values.

In fact, a calculator uses some kind of algorithm based on the basic operations not only to calculate trigonometric values, but also square roots, values of hyperbolic functions and others. The branch of mathematics called numerical methods studies and develops these algorithms. It is an interesting field of mathematics, and one that has lots of applications.

Math Lessons menu