Triangle solver (JavaScript)
Program
Description
When you give exactly three pieces of information, including at least one side, this JavaScript program calculates the missing sides and angles of a triangle. Notes:
All sides are measured in the same unit. For example, you cannot directly solve a triangle with the sides 3 metres, 5 feet, and 2 yards; you must convert the side lengths to a common unit first.
In a valid solution, all side lengths are positive, and all angles are greater than 0° and less than 180°.
Two sides and one enclosed angle (SAS) always yields one unique solution.
Two angles and one side (ASA, AAS) yields one unique solution, provided that the two given angles add up to less than 180°.
Three sides (SSS) yields one unique solution, provided that the longest side is longer than the sum of the other sides.
Two sides and one non-enclosed angle (SSA) yields zero, one, or two solutions.
In the triangle diagram, click on a letter to jump to that input. When solved, hover over a letter to read its value.
More info:
- Wikipedia: Solution of triangles - Solving plane triangles
- Wikipedia: Law of cosines
- Wikipedia: Law of sines