Geometry Calculators

##### Related Content

- 3 4 5 Triangle
- 30 60 90 Triangle
- 45 45 90 Triangle
- 5 12 13 Triangle
- Arc Length Calculator
- Area of a Circle Calculator
- Area of a Hexagon
- Area of a Kite
- Area of a Parallelogram
- Area of a Pentagon
- Area of a Rectangle
- Area of a Rhombus
- Area of a Sector
- Area of a Semicircle
- Area of a Square
- Area of a Trapezoid
- Area of a Triangle
- Center of Mass Calculator
- Circumference Calculator
- Distance Formula
- Distance Formula Calculator
- Geometry Calculators
- How to Find the Height of a Triangle
- Isosceles Triangle Theorem
- Law of Cosines Calculator
- Perimeter of a Circle
- Perimeter of a Pentagon
- Perimeter of a Rectangle
- Perimeter of a Rhombus
- Perimeter of a Semicircle
- Perimeter of a Square
- Perimeter of a Trapezoid
- Perimeter of a Triangle
- Properties of a Parallelogram
- Pythagorean Theorem Calculator
- Side Angle Side Theorem
- Side Splitter Theorem
- Similar Triangles
- Special Right Triangles
- Surface Area of a Cone
- Surface Area of a Cube
- Surface Area of a Cylinder
- Surface Area of a Hemisphere
- Surface Area of a Pyramid
- Surface Area of a Sphere
- Surface Area of a Triangular Prism
- Triangle Inequality Theorem
- Types of Triangles
- Vertical Angles
- Volume of a Cone
- Volume of a Cube
- Volume of a Hexagonal Prism
- Volume of a Pyramid
- Volume of a Sphere
- Volume of Hemisphere
- Volume of Parallelepiped

Programmers and Teachers:

Nikkolas

Tutor and Aerospace Engineer

# Law of Cosines Calculator

Solving for:

Angle unit:

## Law of Cosines Lesson

#### Lesson Contents

### What is the Law of Cosines?

The law of cosines is a set of formulas that relate the side lengths of a triangle with the cosines of its angles. It allows us to solve for unknown side lengths and angles of any triangle if we know two of the side lengths and one of the angles.

The three law of cosines formulas 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 angles opposite of their respective side. For example, angle

*A*is opposite to side

*a*and located between sides

*b*and

*c*

The law of cosines is a one-size-fits-all version of the Pythagorean theorem. The Pythagorean theorem has a much simpler formula but only works with right triangles. The law of cosines works with any type of triangle.

## How the Calculator Works

The calculator on this page is written in the programming language *JavaScript*. When you click the “calculate” button, the law of cosines function is activated. This function is run by your internet browser’s JavaScript engine which allows nearly instant answers.

At the core of the code powering this calculator are the same formulas as given above. Your inputted side lengths and angle are fed into the applicable formula, and out comes the desired side length or angle value. That resulting number is rounded to the 4th decimal place before being displayed as the answer.

The code also checks the side lengths and angles of your triangle to make sure that it follows the triangle inequality theorem and that no internal angles exceed 180 degrees. If the sides and angles do not constitute a possible triangle then no answer will be calculated.