How does a calculator determine $\sin(x)$? [duplicate]

I've been wondering this for a while and it may be obvious but I can't think of how it works. From my understanding, to calculate the sine you'd do opposite side length/hypotenuse side length, but the calculator doesn't know these side lengths.

This may sound really dumb to you guys but I'm kinda new to trigonometry so I'd appreciate any help I can get with this.

Thank you!

marked as duplicate by Namaste, Hans Lundmark, Xander Henderson, JMoravitz, Parcly TaxelJul 19 '18 at 1:25

• I think a calculator will use a Taylor series to determine particular values of sin(x). This is something you will learn about if you take calculus – gd1035 Jul 18 '18 at 18:53
• Actually, the $\sin$ and $\cos$ function require knowing the ratio of two sides, which is only one number. It doesn't necessarily (atan2 being an exception, but that is an inverse trig function) have to know the length of each side separated out. – Adrian Keister Jul 18 '18 at 19:10
• – cgiovanardi Jul 19 '18 at 18:57

One marvelous idea you'll no doubt encounter later on in your studies of math is that of a series approximation.

Long story short, a series approximation is a way of representing a more complicated function, like $f(x)=\sin(x)$, as an infinitely long polynomial. What your calculator is doing when you try to calculate the sine of an angle is taking the first few (loosely speaking) terms of that series and just approximating the value you're looking for. But since it's a calculator, it can approximate the value you're looking for very, very well.

For example, the first few terms of the Taylor series (one particular kind of series approximation) of $\sin(x)$ are: $$\sin(x)=x-\frac{x^3}{3\cdot2\cdot1}+\frac{x^5}{5\cdot4\cdot3\cdot2\cdot1}$$ Your calculator knows more terms than that, but it's a good approximation of the approximation. Let's say you wanted to calculate the value of $\sin(\pi/2)$ (have you learned about radians yet?). The exact value is $1$, but that very rough approximation I gave would return $1.0045$, which is already pretty close to the exact value.

• Ah, thank you. I know the basics about radians, but not a lot. 1 more question, how is the number returned by the sine function useful and how can it be used? Thank you a lot! – Indir Jul 18 '18 at 19:52
• Happy to help! Have to confess I'm not entirely sure what you're asking here, though. – Robert Howard Jul 18 '18 at 19:59
• Is what you state the Taylor series of $sin(x)$? Wouldn't that contain a series of $n$th derivatives of $sin(x)$? – Isky Mathews Jul 18 '18 at 20:12
• @IskyMathews Good point. It's a Taylor series of $\sin(x)$, but it's the Maclaurin series of $\sin(x)$. – Robert Howard Jul 18 '18 at 20:15
• I mean, I don't really understand how that ratio is really useful for finding more things about the triangle. – Indir Jul 18 '18 at 20:42

The opposite side and the hypotenuse define a ratio between them, and similar right triangles will have the same ratios of opposite to hypotenuse for a marked angle, thus the same sine of that angle. In this way, the sine depends on only the angle; any requirement of knowing the lengths of the sides is removed.

A calculator therefore approaches the sine in some way that does not require constructing any right triangle – even one of hypotenuse 1 with the required angle. The most common method is through its Taylor series, where some values may be cached for lookup and interpolation if efficiency is critical. In the past, other methods like CORDIC were used, but those have now fallen out of favour.

• This is what, I believe, actually answers the OP's question. You could additionally show that if dividing one given length by another length yields a certain result, multiplying both lengths bythe same factor does not change that result, because one can simply cancel the factor out (German "wegkürzen"). (If that had been obvious to the OP s/he would probably not have asked the question.) – Peter A. Schneider Jul 18 '18 at 20:49

Here though the sides are of different length but their ratio remains same because of the angle. And while calculating the sine value the thing that only matters is the ratio of height and hypoteneus. So the lengths are not needed.

The main issue here is the notion of angle, resp., the measure of angles. The axioms of euclidean geometry (about intersections, parallels, congruences, etc.) do not involve the measure of angles. But in high school geometry we have a clear feeling that there is such a measure, being in degrees or radians. On the other hand, sines and cosines can easily be computed from the given data (coordinates of points, lengths of sides, etc.), and similarity axioms then guarantee that equal angles lead to equal cosines and sines.

There is a lot of analytical (calculus 101) work needed to establish the exact analytical or numerical relation between $\alpha$ and $\cos\alpha$ or $\sin\alpha$. Your pocket calculator has implemented the results of this work, hence can upon typing in $\alpha$ give you $\cos\alpha$ within milliseconds. When I was a boy we had a fifty page book with tabulated values of these trigonometric functions.

There are four main definitions of "sine": the right triangle definition (which is defined for angles between 0 and $\pi/2$ radians, not inclusive), the unit circle definition, the complex exponentiation definition, and the Taylor Series definition.

For the right triangle definition, "sine" of $\theta$ is defined in terms of a right triangle where one of the angles has measure $\theta$: $sin(\theta)$ is equal to length of the side opposite that side divided by the hypotenuse of that triangle. For this to be well-defined, this must be equal to some number that is always the same, given any fixed $\theta$, regardless of what triangle you use (as long as it is a right triangle with angle $\theta$).

Thus, implicit in stating that this is the definition of "sine" is the assertion that this ratio is a fixed amount, given a particular $\theta$. This can indeed be proven, given the axioms of Euclidean geometry (but is not necessarily true for non-Euclidean geometry). Suppose you have two triangle that both have one angle that's 90 degrees, and another that is $\theta$. Then the third angle in each triangle has to be 90-$\theta$. Thus, the two tirangles have all their angles congruent, and are therefore similar, and ratios of corresponding elements of similar triangles are equal.

This means that you don't need to know the side lengths, because you don't need to know what triangle you're dealing with; every triangle that satisfies the requirements gives you the same answer.

From a practical point of view, a calculator isn't going to using the triangle definition; a calculator isn't going to take out a protractor, draw a triangle, and find the ratio (and note that if you want the sine of 90 degrees, then you have two angles that are both 90 degrees, so it's not really a "triangle" in the normal sense, so the triangle definition of sine doesn't apply, yet your calculator will still return an answer). This question has answers that discuss how it can be calculated ib practice.