Triangles
Triangle geometry pops up time and time again in engineering, in all sorts of things such as robotics, motors, linkages, maps, and sensing (e.g. GPS or ultrasound). It’s helpful to know how to work with triangles and solve for things like unknown side lengths and angles, areas, e.t.c.
This page will teach you how! If you have a right-angles triangle and what to calculate unknown edge lengths or angles, use the basic trigonometric ratios (SOH CAH TOA). If you have a non-right angled triangle (an oblique triangle) but want to also want to solve for lengths and/or angles, use the Law of Sines and/or Law of Cosines.
Trigonometric Ratios
Trigonometric ratios are the three ratios , , and which are defined using properties of a right-angled triangle (a triangle in which one of the internal angles is ). They are useful for solving for unknown side lengths and angles of right-angled triangles, but they also crop up many other situations such as Fourier Series, AC voltage/current, complex numbers (e.g. Euler’s formula) and oscillators.
The Equations
Given you have a triangle with a right-angle in it, and another angle , then the image below shows the naming of the triangle’s sides when using trigonometric ratios.
It might be obvious from the figure, but the names are because:
- The hypotenuse is the longest side of the right-angled triangle (it is always opposite the right-angle).
- The opposite side is the side opposite angle .
- The adjacent side if the side next to angle (but not the hypotenuse).
Using these names, then the trigonometric ratios , , and are defined as:
There are normally just shortened to:
Given the triangle in image below, calculate the length of side .
Relative to the known angle, we know the value of the opposite side and want to know the length of the adjacent side. The image below shows the values labelled accordingly.
The ratio allows us to use the 2 knowns to solve for the unknown adjacent side length:
Re-arrange to solve for :
Plug in the values and solve:
Law of Sines
The Equation
The Law of Sines is a useful equation for determining unknown lengths and angles of any triangle (not just right-angled triangles) if you know some of the other lengths and angles. Together with the Law of Cosines you can find the lengths and angles of any triangle as long as you know enough values already to fully-constrain it.
If a triangle has lengths of , , and and opposite angles of , , and respectively (as shown in the above diagram), then the Law of Sines is:
This means that the sine of the angle divided by the opposite length is the same value for all three angle/side pairs.
What Are Opposite Angles?
The opposite angle for any side of a triangle is the angle which does not “touch” the side in question. For example, if was a side of a triangle, then it’s opposite angle would be the angle enclosed by sides and . The angle is directly “opposite” the side.
The lengths , , and and opposite angles of , , and may be moved around the triangle, the letters do not have a particular “side” they belong to. What is important is that is always the angle opposite side and so on.
Given the triangle shown below, calculate the length of side .
We’ll flip the Law of Sines equation and just use one equality:
Re-arranging for :
Plugging in the numbers:
Multiple Solutions (Ambiguity)
In certain circumstances, there is more than one possible answer when calculating values using the Law of Sines. This occurs in a specific situation, when1:
- You know the length of two sides of the triangle ( and ) and one opposite angle (and thus are trying to calculate the other opposite angle ).
- Angle is in the range (i.e. is acute).
- Length is greater than but less than , where is the “vertical” height as shown below:
Mathematically this occurs because can give two answers in the range of (a valid angle of a triangle has to be within this range). For example, gives the following values:
Calculators always give you the angle in the range of when using (also called or ). To get the other answer you have to subtract the calculator answer from . The image below explains the situation in visual manner.
Ambiguity is not a problem if A is in the range (i.e. is not acute). In this scenario, There can either be no solution or just 1 solution, but never 2. The image below illustrates this.
If you find yourself in a position with two possible answers, what can you do? If you don’t have any other information about the triangle, then you are out of luck. However, if you know the length of the remaining side of the triangle, you can use the Cosine Law to completely solve for all angles and sides of the triangle. If you know one other angle of the triangle, then you can use the simple fact that all the internal angles sum to to solve for the angle you were interested in.
Given the triangle shown below, calculate the angle of . This triangle has been designed to be ambiguous (two possible answers).
Let’s start with the Law of Sines equation:
Re-arrange to solve for :
Plugging in the values:
The calculator will give us (this is the answer using the solid blue line):
And the other solution is minus this (this is the answer using the dotted blue line):
Law of Cosines
The Law of Cosines (also known as the cosine formula or cosine rule2) is an equation similar to the Law of Sines which lets you calculate unknown sides and opposite angles of any triangle (not just right-angled triangles) if you know some of the others.
The Equation
The Law of Cosines equation is:
where:
, and are side lengths of the triangle
is the opposite angle of side
The image below shows the side and angles involved in the Law of Cosines equation. Knowing all but one of these values, you can calculate the last one by re-arranging the equation.
The law of cosines is useful for solving the sides and angles of a triangle when all three sides are known, or two sides and their included angle are known. If you know two angles and a side, or two sides and an angle other than the included angle, use the law of sines instead.
Here is the Law of Cosines equation rearranged for all sides and angles2:
Because the side and opposite angle pairs can be assigned freely around the triangle, the equation for is essentially the same as for . Note that for both of these sides, there may be 0, 1 or 2 solutions.
The Law of Cosines can be thought of as a generalization of Pythagorean Theorem (the Pythagorean Theorem is the equation that applies to right-angled triangles).
If we start with the Law of Cosines equation and then make the angle it reduces down to the Pythagorean equation:
Given the triangle and known dimensions as shown below, calculate all unknown sides and angles.
Given we know the values of two of the sides and their included angle, the Law of Cosines can help us solve for the remaining dimensions. Let’s assign letters to each of the sides and angles (we assign to the known angle, just so we can use the Law of Cosine equation verbatim without any swapping of the variable names for the first equation):
We can now use the Law of Cosines to solve for side :
Now we can use the Law of Cosines again to solve for angle or . It doesn’t matter which one we pick, so lets go with . We’ll pretend is the in the law of cosines diagram, as we know the length of both sides included in this angle, as well as the length of the opposite side. Swapping the variable names around happens often, just make sure to keep the opposite angles in sync also!
We could use the Law of Cosines again to find the last unknown, angle , but it’s far easier just to use the rule that all the internal angles of a triangle must sum to .
All done!
Multiple Solutions (Ambiguity)
Just like the Law of Sines, the Law of Cosines can also have multiple solutions. And just like with the Law of Sines, multiple solutions can only occur if you know the length of two sides and one opposite angle.
Given the triangle below, calculate the length of side .
We’ll need to re-arrange the Law of Cosines equation to solve for , which has already be done for us above in .
Plugging in the values:
Calculators
Google has handy Law of Sines/Cosines calculators that pops up when you search “law of sines”/“law of cosines”. The image below shows a screenshot of the Law of Cosines calculator.
The eMathHelp Law of Cosines calculator as shown below is different from most and shows you the working to solve the triangle. They also has a Law of Sines calculator.
Footnotes
-
Libretexts: Mathematics. 2.1: The Law of Sines. Retrieved 2023-12-31, from https://math.libretexts.org/Bookshelves/Precalculus/Elementary_Trigonometry_(Corral)/02%3A_General_Triangles/2.01%3A_The_Law_of_Sines ↩
-
Wikipedia (2023, Dec 27). Law of cosines. Retrieved 2024-01-03, from https://en.wikipedia.org/wiki/Law_of_cosines. ↩ ↩2
-
Google. Law of Cosines [Search Results]. Retrieved 2024-01-03, from https://www.google.com/search?q=law+of+cosines. ↩
-
eMathHelp (2024). Law of Cosines Calculator - Solve triangles using the law of cosines. Retrieved 2023-01-06, from https://www.emathhelp.net/en/calculators/geometry/law-of-cosines-calculator/. ↩