Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Number System and Arithmetic
  • Algebra
  • Set Theory
  • Probability
  • Statistics
  • Geometry
  • Calculus
  • Logarithms
  • Mensuration
  • Matrices
  • Trigonometry
  • Mathematics
Open In App
Next Article:
Law of Cosines
Next article icon

Law of Cosines

Last Updated : 03 Oct, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Law of Cosines is the fundamental law of mathematics used to find the angle of the triangle when all three sides of the triangle are given. This law is also called the Cosine Rule Or the Cosine Formula. If in a triangle the sides are a, b, and c, then law of cosine for angle A is given as:

a2 = b2 + c2 – 2bc cos A

Law-of-Cosines

What is Law of Cosines?

Law of cosine is the fundamental law of trigonometry the law of cosine is used to find the relation between sides and the angles of the triangle, suppose we are given sides of the triangle and then the angle of the triangle is found. This formula is used to find the unknown angle of the triangle when all sides are given.

Law of cosine is defined as the law which gives the relation between sides and angles of the triangle. Three laws of cosine are,

  • a2 = b2 + c2 - 2bc cosA
  • b2 = c2 + a2 - 2ca cosB
  • c2 = a2 + b2 - 2ab cosC

where a, b, and c are the sides of the triangle and A, B, and C are the angles of the triangle.

Table of Content

  • Law of Cosines Formula
  • Law of Cosines Proof
  • Why is the Law of Cosines Important?
  • How to Find Angle using Law of Cosines
  • Sine and Cosine Rule
  • Solved Examples Using Law of Cosines
  • Practice Problems

Law of Cosines Formula

Cosine Formula is the formula that gives the relation between the sides and the angles of the triangle. Suppose we are given a triangle in which the sides a, b, and c are given and A, B, and C are angles of the triangle respectively. Then the law of cosine formulas is,

  • a2 = b2 + c2 – 2bc cos A
  • b2 = a2 + c2 – 2ac cos B
  • c2 = b2 + a2 – 2ba cos C

We can also find the angles of the triangle by the formulas,

  • cos A = [b2 + c2 – a2]/2bc
  • cos B = [a2 + c2 – b2]/2ac
  • cos C = [b2 + a2 – c2]/2ab

Law of Cosines Proof

Law of cosine is proved using trigonometric identities. Suppose we are given a triangle ABC and BM is the altitude of the triangle and its height is h and AM is equal to r. Also, sides of the triangle a, b, and c, the image for the same is added below,

Law-of-Cosine-Proof

In ΔABM,

sin A = BM/AB = h/c . . . (i)

cos A = AM/AB = r/c . . . (ii)

From equation (i) and (ii),

  • h = c(sin A)
  • r = c(cos A)

By Pythagoras Theorem in ΔBMC,

a2 = h2 + (b - r)2

Then,

Using h = c(sin A), r = c(cos A) in above equation

⇒ a2 = {c(sinA)}2 + {b - c(cosA)}2

⇒ a2 = c2sin2A + b2 + c2cos2A - 2bc cosA

⇒ a2 = c2(sin2A + cos2A) + b2 - 2bc cosA

⇒ a2 = c2 + b2 - 2bc cosA

This is the cosine formula.

Similarly other two formulas are also proved,

  • b2 = c2 + a2 - 2ca cosB
  • c2 = a2 + b2 - 2ab cosC

Read More about:

  • Cosine Rule
  • Cosine Formulas
  • Law of Sine and Cosine

Why is the Law of Cosines Important?

The Law of Cosines is a powerful tool for solving triangles that are not right-angled. In particular, it helps in situations where the Law of Sines may not be applicable, such as:

  • SAS (Side-Angle-Side): You know two sides and the included angle.
  • SSS (Side-Side-Side): You know all three sides and need to find an angle.

Real-World Applications of the Law of Cosines

  • Navigation and Surveying: It’s used in determining distances and angles in land surveys.
  • Physics and Engineering: In mechanics, it helps calculate forces acting on an object at various angles.

How to Find Angle using Law of Cosines

Law of Cosine is used to find the angles of the triangle when all three sides of the triangle are given. Suppose we are given a triangle with sides a, b, and c and angles of triangle are A, B, and C then angles of the triangle are calculated using the formula,

  • cos A = [b2 + c2 – a2]/2bc
  • cos B = [a2 + c2 – b2]/2ac
  • cos C = [b2 + a2 – c2]/2ab

Example, Find ∠A of triangle ABC, where sides of triangles, a, b, and c, are 1 cm, 1 cm, and √2 cm.

Using cosine rule,

cos A = [b2 + c2 – a2]/2bc

⇒ cos A = {(1)2 + (√2)2 - (1)2}/2(1)(√2) = 2/2√(2)

⇒ cos A = 1/√(2)

⇒ A = cos-1(1/√(2)) = 45°

Sine and Cosine Rule

For a triangle with sides a, b, and c and angles A, B, and C then the Sine Law Formula is,

a / Sin A = b/ Sin B = c / Sin C

Common difference between sine and cosine rule are:

Feature

Law of Cosines

Law of Sines

Applicability

Suitable for solving triangles where you know: 2 sides and the included angle OR 3 sides.

Suitable for solving triangles where you know: 2 angles and 1 side OR 2 sides and the included angle.

Formula

  • a2 = b2 + c2 - 2bc cosA
  • b2 = c2 + a2 - 2ca cosB
  • c2 = a2 + b2 - 2ab cosC

a / Sin A = b/ Sin B = c / Sin C

OR

a : b : c = Sin A : Sin B : Sin C

Also, Check

  • Trigonometric Identities
  • Trigonometric Formulas
  • Trigonometric Table

Solved Examples Using Law of Cosines

Example 1: If two sides of the triangle are 12 cm and 16 cm and the angle between them is 30° then find the third side of the triangle.

Solution:

Given,

  • b = 12 cm
  • c = 16 cm
  • ∠A = 30°

Law of Cosines Formula,

a2 = b2 + c2 - 2bc·cosA

⇒ a2 = (12)2 + (16)2 - 2(12)(16)cos30°

⇒ a2 = 144 + 256 - (384)(1/2) = 208

⇒ a = 14.4 cm

Thus, the third side of the triangle is 14.4 cm

Example 2: If two sides of the triangle are 8 cm, 10 cm, and 6 cm then find the angle 'A' of the triangle.

Solution:

Given,

  • a = 8 cm
  • b = 10 cm
  • c = 6 cm

Using Cosines Law,

a2 = b2 + c2 – 2bc cos(A)

⇒ cos A = (b2 + c2 – a2)/2bc

Substituting the given value,

cos(A) = (102 + 62 – 82)/(2 × 10 × 6)

⇒ cos(A) = (100 + 36 - 64)/120 = 72/120 = 3/5

⇒ A = cos-1 (3/5)

Practice Problems

Probelm 1: If two sides of the triangle are 20 cm and 22 cm and the angle between them is 45° then find the third side of the triangle.

Probelm 2: If two sides of the triangle are 3 cm, 4 cm, and 5 cm then find the angle 'A' of the triangle.

Probelm 3: If two sides of the triangle are 8 cm and 12 cm and the angle between them is 60° then find the third side of the triangle.

Probelm 4: If two sides of the triangle are 12 cm, 18 cm, and 16 cm then find the angle 'A' of the triangle.

Conclusion

The Law of Cosines is a versatile and essential tool in trigonometry. Whether you’re solving for sides or angles, its wide range of applications makes it an important concept to understand for anyone working with triangles. By mastering this formula, you’ll have a deeper insight into how triangles function, both in theory and in practice.


Next Article
Law of Cosines

P

punamsingh628700
Improve
Article Tags :
  • Mathematics
  • School Learning
  • Class 11
  • Trigonometry - MAQ
  • Maths-Formulas
  • Maths-Class-11

Similar Reads

    Law of Sine and Cosine
    Law of Sine and Cosine are the basic laws or rules used in trigonometry that are used to give the relation between sides and angles of the triangle. In this article, we will learn about the Law of Sine (Sine Rule), Sine Rule Formula, Law of Cosine (Cosine Rule), Cosine Rule Formula, and others in de
    6 min read
    Cosine Rule
    Cosine Rule commonly referred to as the Law of Cosines in Trigonometry establishes a mathematical connection involving all three sides of a triangle and one of its angles. Cosine Rule is most useful for solving the unknown information of a triangle. For example, when all three sides of a triangle ar
    14 min read
    What are Cosine Formulas?
    Trigonometry is a discipline of mathematics that studies the relationships between the lengths of the sides and angles of a right-angled triangle. Trigonometric functions, also known as goniometric functions, angle functions, or circular functions, are functions that establish the relationship betwe
    8 min read
    2cosAsinB Formula
    2cosAsinB is one of the important trigonometric formulas which is equal to sin (A + B) - sin (A-B). It is a fundamental identity in trigonometry, often used in simplifying expressions and soving the equations. 2cosAsinB Formula is used in trigonometry to solve various equations and problems more eff
    8 min read
    Law of Sines and Cosines Practice Problems
    The Law of Sines is a fundamental principle in trigonometry that relates the sides of a triangle to the sines of its angles. It is especially useful for solving triangles, whether they are right-angled or not. The Law of Cosines is another important principle in trigonometry that relates the lengths
    8 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences