##### Related Content

# Triangle Calculator

## Lesson on Solving Triangles

#### Lesson Contents

### How to Calculate the Sides of a Triangle

If solving for a side length of a right triangle where know two side lengths, we may use the Pythagorean theorem. The Pythagorean theorem is given as:

Where *a* and *b* are the legs and *c* is the hypotenuse.

For non-right triangles, we must know three parameters of the triangle. The three known parameters may either be two side lengths and an angle or two angles and a side length.

There are several formulas we may use for solving side lengths. The most common and versatile are the *law of cosines* and the *law of sines*.

The law of cosines is split into three formulas. They are given as:**a ^{2} = b^{2} + c^{2} – 2bc×cos(A)**

**b**

^{2}= a^{2}+ c^{2}– 2ac×cos(B)**c**

^{2}= a^{2}+ b^{2}– 2ab×cos(C)Where

*a*,

*b*, and

*c*are the side lengths and

*A*,

*B*, and

*C*are the internal angles.

The law of sines is given as:^{sin(A)}⁄_{a} = ^{sin(B)}⁄_{b} = ^{sin(C)}⁄_{c}

Where *a*, *b*, and *c* are the side lengths and *A*, *B*, and *C* are the internal angles.

There are other formulas available for solving triangle sides, but the law of cosines and law of sines may be leveraged in combination to solve any triangle and therefore will most commonly be used.

### How to Calculate the Angles of a Triangle

When solving for a triangle’s angles, a common and versatile formula for use is called the *sum of angles*. It is given as:**A + B + C = 180**

Where *A*, *B*, and *C* are the internal angles of a triangle.

If two angles are known and the third is desired, simply apply the sum of angles formula given above. If three side lengths are known, use the law of cosines. If an angle and two sides are known, use either the law of cosines or the law of sines, depending on the combination of angle and sides.

## How the Calculator Works

The calculator on this page is written in the programming language JavaScript (JS) which allows it to run in your device’s internet browser JS engine. The JS engine running the code allows for instant answers at the click of a button.

When the calculate button is pressed, your selected “solving for” parameter is inputted, and the calculator determines which set of formulas will be used to solve. Then, your inputted side/angle parameters are converted to standard units and fed into the applicable formulas. This calculator is powered by the law of cosines and other basic triangle identities.

Once the desired output parameter has been calculated, the solution’s units are converted if the selected unit requires so. The final answer is rounded and then printed to the applicable output area on the calculator.