### Trigonometry Problems

#### Using HTML5 Canvas to solve trigonometric problems

#### 1.0 Description

From the origin of the circle, line *h* — the hypotenuse — stretches upwards at an angle *θ* of 30°. The lenght of the line is equal to the radius of the circle (in this case 90px).

#### 1.1. Finding The Adjacent

Based on the previous information we will find how long cathetus A — the adjacent — is on the X-axis until it reaches cathetus B.

To find the adjacent cathetus, you need to do this formula: cos(*θ*) = adjacent (*x*) / hypotenuse (*h*)

*θ* stands for the angle

x stands for the unknown length of the adjacent cathetus

...and h stands for the hypotenuse.

Just fill inn some blanks: cos(30) = adjacent (*x*) / hypotenuse (90)

Then calculate sin(30): `Math.cos(30*Math.PI / 180.0) = 0.86602540378443864676372317075294`

And you get: 0.866 = *x* / 90

Then use algebra and switch sides: *x* / 90 = 0.866

Use algebra again and move a number away from the unknown so it is possible to calculate, however according to the rules of algebra it means the division operator must also change to a multiplication operator (the opposite operator), so we get: *x* = 0.866 * 90

Then calculate, and you find that *x* = 77.942286340599478208735085367764

#### 1.2 Finding The Opposite

Based on the previous information we will find the height of cathetus B — the opposite — on the Y-axis.

To find the opposite cathetus, you need to do this formula: sin(*θ*) = opposite (*y*) / hypotenuse (*h*)

Just fill inn some blanks: sin(30) = opposite (*y*) / hypotenuse (90)

Then calculate sin(30): `Math.sin(30*Math.PI / 180.0) = 0.5`

And you get: 0.5 = *y* / 90

Then use algebra and switch sides: *y* / 90 = 0.5

Use algebra again and move a number away from the unknown so it is possible to calculate, however according to the rules of algebra it means the division operator must also change to a multiplication operator (the opposite operator), so we get: *y* = 0.5 * 90

Then calculate, and you find that *y* = 45

And there you have it!