- Sine θ = opposite/hypotenuse
- Cosine θ = adjacent/hypotenuse
- Tangent θ = opposite/adjacent
In order to calculate the sine or the cosine or the tangent I need to know 3 sides of a right triangle. 2 for each corresponding trigonometric function. How does a calculator calculate the sine, cosine, tangent of a number (that is actually an angle ?) without knowing any sides?

**Answer**

Calculators either use the Taylor Series for sin/cos or the CORDIC algorithm. A lot of information is available on Taylor Series, so I’ll explain CORDIC instead.

The input required is a number in radians θ, which is between −π/2 and π/2 (from this, we can get all of the other angles).

First, we must create a table of arctan2−k for k=0,1,2,…,N−1. This is usually precomputed using the Taylor Series and then included with the calculator. Let ti=arctan2−i.

Consider the point in the plane (1,0). Draw the unit circle. Now if we can somehow get the point to make an angle θ with the x-axis, then the x coordinate is the cosθ and the y-coordinate is the sinθ.

Now we need to somehow get the point to have angle θ. Let’s do that now.

Consider three sequences {xi,yi,zi}. zi will tell us which way to rotate the point (counter-clockwise or clockwise). xi and yi are the coordinates of the point after the ith rotation.

Let z0=θ, x0=1/A40≈0.607252935008881, y0=0. A40 is a constant, and we use 40 because we have 40 iterations, which will give us 10 decimal digits of accuracy. This constant is also precomputed^{1}.

Now let:

zi+1=zi−diti

xi+1=xi−yidi2−i

yi=yi+xidi2−i

di=1 if zi≥0 and -1 otherwise

From this, it can be shown that xN and yN eventually become cosθ and sinθ, respectively.

^{1}: AN=N−1∏i=0√1+2−2i

**Attribution***Source : Link , Question Author : themhz , Answer Author : Rajdeep Sindhu*