Nepedia
Back to Discover
Fluent Reader
🔢

Law of cosines

math Maturity 7-9 Next article →

Imagine you are looking at a triangle. You might know the lengths of two sides and the angle between them. You might also know all three side lengths but none of the angles. The law of cosines is a special math rule that helps you solve these puzzles. It connects the lengths of the sides to the cosine of an angle. This rule is very helpful because it works for every kind of triangle.

Triangle with notations 2
Triangle with notations 2

It is a bigger version of the Pythagorean theorem. That famous theorem only works for right triangles with one square corner. The law of cosines works even if the corners are very wide or very sharp.

triangle-with-an-unknown-angle-or-side
triangle-with-an-unknown-angle-or-side

How does this rule actually work? It uses the sides and an angle to find a missing piece of information. If you have two sides and the angle between them, you can find the third side. You can also use it to find the angles if you already know all three sides.

Obtuse Triangle With Altitude ZP
Obtuse Triangle With Altitude ZP

Sometimes, the math can be a bit tricky. If you are looking for a side, there might be two different possible answers. This happens in certain cases involving the side-side-angle setup. When the triangle has very small angles, computers might even have a hard time calculating the exact numbers.

Law of cosines in plane trigonometry
Law of cosines in plane trigonometry

People have been studying these triangle rules for a very long time. Around 300 BC, a mathematician named Euclid wrote about these ideas in his book called Elements. He did not use modern symbols, but he talked about the areas of rectangles. Later, mathematicians in India developed trigonometry with sines and cosines.

Ptolemy cos
Ptolemy cos

In the 11th century, al-Bīrūnī used these ideas to solve problems about the stars. In the 13th century, a Persian mathematician named Naṣīr al-Dīn al-Ṭūsī showed a systematic way to solve triangles. He used a method of dropping a straight line to create right triangles.

Triangle with trigonometric proof of the law of cosines
Triangle with trigonometric proof of the law of cosines

Many different thinkers added to this math over the centuries. Jamshīd al-Kāshī was a Persian mathematician who lived in the 15th century. He was very good at making accurate math tables. In France, some people call this rule the théorème d'Al-Kashi to honor his work.

Law of cosines following al-Kashi
Law of cosines following al-Kashi

Another mathematician named Regiomontanus wrote about these triangles in 1464. In the 16th century, François Viète began using the algebraic symbols we recognize today. By the 1800s, the law of cosines looked almost exactly like the formula we use in school now.

You can see how this rule links to things you already know. It builds directly on the Pythagorean theorem that you might have learned. If you use the law of cosines on a right triangle, it turns back into that simpler theorem.

Triangle-law-of-cosines-proof
Triangle-law-of-cosines-proof

It also connects to the way we use coordinates to map out points on a grid. By placing a triangle on a coordinate system, we can use the distance formula to prove it works. This shows how many different parts of math all fit together beautifully.

491 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (18)
File:Triangle with notations 2.svg
Triangle with notations 2.svg
File:triangle-with-an-unknown-angle-or-side.svg
triangle-with-an-unknown-angle-or-side.svg
File:SSA triangle ambiguity.png
SSA triangle ambiguity.png
File:Obtuse Triangle With Altitude ZP2.svg
Obtuse Triangle With Altitude ZP2.svg
File:Law of cosines following al-Kashi.png
Law of cosines following al-Kashi.png
File:Law of cosines in plane trigonometry.svg
Law of cosines in plane trigonometry.svg
File:Obtuse Triangle With Altitude ZP.svg
Obtuse Triangle With Altitude ZP.svg
File:Triangle with trigonometric proof of the law of cosines.svg
Triangle with trigonometric proof of the...
File:Triangle-with-cosines.svg
Triangle-with-cosines.svg
File:Triangle-law-of-cosines-proof.png
Triangle-law-of-cosines-proof.png
File:Ptolemy cos.svg
Ptolemy cos.svg
File:law of cosines with acute angles.svg
law of cosines with acute angles.svg

+ 6 more

More to explore

🔬 Go deeper

More advanced topics to explore

🪜 Step back

Simpler topics to build understanding

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.