bolt.wickedlasers.com
EXPERT INSIGHTS & DISCOVERY

law of cosines formula

bolt

B

BOLT NETWORK

PUBLISHED: Mar 27, 2026

Law of Cosines Formula: Unlocking the Secrets of Triangles

Law of cosines formula is a fundamental concept in trigonometry that helps us solve triangles when we don’t have all the angles or when the familiar Pythagorean theorem doesn’t apply. Whether you’re a student tackling geometry homework, an engineer working on design calculations, or simply a math enthusiast, understanding the law of cosines can open doors to solving a variety of problems involving non-right triangles. Let’s dive into what this formula is, how it works, and why it’s so useful.

What Is the Law of Cosines Formula?

At its core, the law of cosines relates the lengths of the sides of any triangle to the cosine of one of its angles. Unlike the Pythagorean theorem, which only applies to right-angled triangles, the law of cosines works for all types of triangles—acute, obtuse, or right.

The formula is usually expressed as:

[ c^2 = a^2 + b^2 - 2ab \cdot \cos(C) ]

Here, (a), (b), and (c) are the lengths of the sides of the triangle, and (C) is the angle opposite side (c). The formula can be cyclically applied to find any side or angle by swapping the letters accordingly:

[ a^2 = b^2 + c^2 - 2bc \cdot \cos(A) ]

[ b^2 = a^2 + c^2 - 2ac \cdot \cos(B) ]

This powerful relationship allows you to calculate an unknown side if you know two sides and the included angle or to find an unknown angle if you know all three sides.

How Does the Law of Cosines Work?

Unlike the Pythagorean theorem, which is limited to right triangles, the law of cosines bridges the gap by incorporating the angle between two sides. It’s derived from the properties of triangles and the cosine function, which measures the relationship between an angle and the ratio of two sides in a right triangle.

Imagine you have a triangle with sides (a), (b), and (c), but the triangle isn’t right-angled. If you drop a perpendicular from angle (C) to side (c), you can split the triangle into two right triangles. Using basic trigonometric identities and the Pythagorean theorem on these right triangles, you arrive at the law of cosines formula.

This approach explains why the law of cosines generalizes the Pythagorean theorem: when angle (C) is 90 degrees, (\cos(90^\circ) = 0), so the formula reduces to the Pythagorean theorem:

[ c^2 = a^2 + b^2 ]

Applications of the Law of Cosines

The law of cosines is especially handy in situations where you:

  • Know two sides and the included angle (SAS case) and want to find the third side.
  • Know all three sides (SSS case) and want to find any of the angles.
  • Are working with navigation problems, surveying, or physics where non-right triangles come into play.
  • Need to calculate distances or angles when dealing with vectors or forces at an angle.

Step-by-Step: Using the Law of Cosines Formula

Let’s walk through an example to see the law of cosines in action.

Suppose you have a triangle where sides (a = 7) units and (b = 10) units, and the angle between them, (C), is 60 degrees. You want to find side (c).

  1. Write down the formula:

[ c^2 = a^2 + b^2 - 2ab \cdot \cos(C) ]

  1. Plug in the known values:

[ c^2 = 7^2 + 10^2 - 2 \times 7 \times 10 \times \cos(60^\circ) ]

  1. Calculate the cosine value:

(\cos(60^\circ) = 0.5)

  1. Substitute:

[ c^2 = 49 + 100 - 2 \times 7 \times 10 \times 0.5 ]

[ c^2 = 149 - 70 ]

[ c^2 = 79 ]

  1. Find (c):

[ c = \sqrt{79} \approx 8.89 \text{ units} ]

That’s it! You’ve successfully applied the law of cosines formula to find the unknown side.

Finding an Angle Using the Law of Cosines

Sometimes, you might know all three sides but want to find an angle. Suppose in a triangle, sides are (a = 5), (b = 6), and (c = 7), and you want to find angle (C).

Rearrange the formula to solve for (\cos(C)):

[ \cos(C) = \frac{a^2 + b^2 - c^2}{2ab} ]

Plug in the values:

[ \cos(C) = \frac{5^2 + 6^2 - 7^2}{2 \times 5 \times 6} = \frac{25 + 36 - 49}{60} = \frac{12}{60} = 0.2 ]

Then,

[ C = \cos^{-1}(0.2) \approx 78.46^\circ ]

This method is incredibly useful in triangulation problems or when you need precise angle measures.

Exploring Related Concepts and Tips

Law of Cosines vs. Law of Sines

While the law of cosines is versatile, it’s often used alongside the law of sines, which relates the ratios of sides to the sines of their opposite angles. The law of sines is simpler but only applies when you know either two angles and one side (AAS or ASA) or two sides and a non-included angle (SSA). When you have two sides and the included angle (SAS) or all three sides (SSS), the law of cosines is your go-to tool.

Tips for Remembering the Law of Cosines

  • Think of it as a "generalized Pythagorean theorem" that adjusts for the angle between sides.
  • Remember the minus sign before the cosine term: (c^2 = a^2 + b^2 - 2ab \cos(C)).
  • Use mnemonic devices like “Squares of two sides minus twice their product times cosine of the included angle.”
  • Always identify the side opposite the angle you’re working with, as the formula is structured around this relationship.

Common Mistakes to Avoid

  • Mixing up which side corresponds to which angle. The side (c) is always opposite angle (C).
  • Forgetting to use the angle in radians or degrees consistently with your calculator’s settings.
  • Applying the law of cosines to right triangles without noticing the simpler Pythagorean theorem suffices.
  • Neglecting to check if you have enough information to apply the formula correctly.

Real-World Examples Where the Law of Cosines Shines

The law of cosines isn’t just a theoretical formula in textbooks. It has practical applications across various fields:

  • Navigation and GPS: Calculating distances between points on a map that don’t form right angles.
  • Engineering: Designing components where forces act at angles, requiring precise measurements.
  • Architecture: Determining angles and lengths in irregularly shaped structures.
  • Astronomy: Measuring distances between celestial bodies using triangulation.
  • Physics: Resolving vectors and forces that aren’t perpendicular.

Understanding and mastering the law of cosines formula equips you with a versatile tool to tackle these real-life challenges.

Visualizing the Law of Cosines

Sometimes, a diagram is the best way to grasp the concept. Picture a triangle labeled with sides (a), (b), and (c), and angle (C) opposite side (c). The formula reflects how side (c) depends not only on the lengths of (a) and (b) but also on how “open” or “closed” angle (C) is. When (C) is small, (\cos(C)) is close to 1, and the subtraction term is significant, making (c) shorter. When (C) is large (close to 180 degrees), (\cos(C)) is negative, increasing the length of (c).

This geometric intuition helps deepen your understanding beyond memorizing the formula.


The law of cosines formula is a staple in trigonometry that expands your problem-solving toolkit beyond right triangles. By grasping its structure, derivation, and applications, you can confidently approach complex triangles with ease. Whether you’re solving for missing sides, finding elusive angles, or applying it to real-world contexts, the law of cosines is an invaluable ally in the world of mathematics.

In-Depth Insights

Law of Cosines Formula: A Comprehensive Analytical Review

law of cosines formula stands as a fundamental principle in trigonometry, offering a critical extension to the Pythagorean theorem by addressing oblique triangles. Unlike right-angled triangles, where relationships between sides and angles are straightforward, the law of cosines provides a robust method for calculating unknown sides or angles in any triangle, making it indispensable in fields ranging from engineering and physics to computer graphics and navigation.

Understanding the law of cosines formula is essential for professionals and students alike, as it bridges geometric intuition with algebraic precision. This article delves deep into the formula’s structure, applications, derivations, and comparative advantages over other trigonometric laws, furnishing a comprehensive perspective on its utility and significance.

Fundamentals and Mathematical Expression of the Law of Cosines

At its core, the law of cosines relates the lengths of the sides of a triangle to the cosine of one of its angles. For a triangle with sides (a), (b), and (c), where (c) is the side opposite angle (C), the formula is expressed as:

[ c^2 = a^2 + b^2 - 2ab \cdot \cos(C) ]

This equation generalizes the Pythagorean theorem, which applies only when angle (C) is a right angle (90 degrees), in which case (\cos(90^\circ) = 0), simplifying the formula to (c^2 = a^2 + b^2).

In a similar fashion, the law can be written cyclically for the other sides and their opposite angles:

[ a^2 = b^2 + c^2 - 2bc \cdot \cos(A) ]

[ b^2 = a^2 + c^2 - 2ac \cdot \cos(B) ]

This symmetry makes the law of cosines a versatile tool for solving triangles when side lengths and angles are partially known.

Derivation and Geometric Interpretation

The derivation of the law of cosines typically begins with projecting one side of the triangle onto an axis, using coordinate geometry or vector analysis. By placing the triangle in the Cartesian plane such that one vertex is at the origin and one side lies along the x-axis, the vertical and horizontal components of the remaining vertex can be used to express the distance formula. The result naturally leads to the law of cosines.

Geometrically, the formula can be interpreted as adjusting the sum of the squares of two sides by the cosine of the included angle, hence correcting for the “non-right angle” scenario. This correction term, ( -2ab \cdot \cos(C) ), accounts for the triangle’s shape deviation from a right angle, which is why the law is sometimes referred to as the generalized Pythagorean theorem.

Applications and Practical Significance

The law of cosines formula finds widespread use in various scientific and engineering disciplines. Its ability to solve triangles when two sides and the included angle or all three sides are known makes it invaluable. Below are some salient applications:

Navigation and Surveying

In navigation, particularly in triangulation methods, determining an unknown distance or bearing between two points often involves non-right triangles. Surveyors frequently employ the law of cosines to calculate land plots or elevations where direct measurement is impractical.

Physics and Engineering

When analyzing forces acting at angles, the law of cosines helps determine resultant vectors. For instance, in statics, calculating the magnitude of a force resulting from two non-perpendicular vectors utilizes this formula.

Computer Graphics and Robotics

Rendering three-dimensional models and calculating joint angles in robotic arms require precise trigonometric calculations. The law of cosines aids in inverse kinematics, where unknown joint angles must be solved based on end-effector positions.

Comparison with the Law of Sines

While the law of cosines is powerful, it often works in tandem with the law of sines in triangle problem-solving. The law of sines relates the ratios of sides to the sines of their opposite angles:

[ \frac{a}{\sin A} = \frac{b}{\sin B} = \frac{c}{\sin C} ]

The fundamental difference lies in their preferred use cases:

  • Law of Cosines: Best suited when two sides and the included angle (SAS) or all three sides (SSS) are known.
  • Law of Sines: More efficient when two angles and one side (AAS or ASA) are known.

Choosing between these laws affects computational efficiency and accuracy. For instance, the law of cosines avoids the ambiguous case problem inherent in the law of sines, where two different triangles might satisfy the same set of given data.

Advantages of the Law of Cosines

  • Applicable to any triangle, regardless of angle size.
  • Facilitates direct computation of unknown sides when angles are known.
  • Eliminates ambiguity present in some cases with the law of sines.
  • Extends the Pythagorean theorem to non-right triangles.

Limitations and Considerations

  • Requires knowledge of at least one angle and two sides or all three sides.
  • Involves cosine calculations, which may introduce rounding errors in computational environments, especially for angles close to 0° or 180°.
  • Less intuitive than the law of sines in angle-side relationships.

Implementation and Calculation Tips

In practical problems, the law of cosines formula is often embedded in computational tools or calculators. However, understanding its manual application is critical for troubleshooting and conceptual clarity.

Step-by-step Approach to Using the Law of Cosines

  1. Identify known elements: Determine which sides and angles are given.
  2. Select the appropriate formula: Choose the version of the law of cosines that isolates the unknown side or angle.
  3. Calculate the unknown: Use algebraic manipulation to solve for the missing length or angle. For angles, apply the inverse cosine function.
  4. Verify results: Check if the calculated values are consistent with triangle inequality and angle sum properties.

Example Calculation

Consider a triangle with sides (a = 7), (b = 10), and an included angle (C = 60^\circ). To find side (c):

[ c^2 = 7^2 + 10^2 - 2 \times 7 \times 10 \times \cos(60^\circ) ]

[ c^2 = 49 + 100 - 140 \times 0.5 = 149 - 70 = 79 ]

[ c = \sqrt{79} \approx 8.89 ]

This straightforward calculation demonstrates the formula’s practicality in deriving unknown sides.

Expanding Beyond Triangles: Broader Mathematical Context

Beyond direct triangle measurements, the law of cosines formula has analogues in vector mathematics and higher-dimensional geometry. For vectors (\mathbf{u}) and (\mathbf{v}), the law of cosines corresponds to the dot product relation:

[ |\mathbf{u} - \mathbf{v}|^2 = |\mathbf{u}|^2 + |\mathbf{v}|^2 - 2|\mathbf{u}||\mathbf{v}|\cos\theta ]

where (\theta) is the angle between (\mathbf{u}) and (\mathbf{v}). This connection highlights the formula’s foundational role in linking geometric intuition with algebraic operations.

In navigation algorithms such as the Haversine formula or spherical trigonometry, adaptations of the law of cosines help calculate distances on curved surfaces, emphasizing its adaptability.


The law of cosines formula continues to be a cornerstone in mathematical problem-solving, seamlessly integrating theory with practical application. Its ability to unlock unknown parameters in triangles across various disciplines underscores its enduring relevance in both academic and professional contexts.

💡 Frequently Asked Questions

What is the law of cosines formula?

The law of cosines formula is c² = a² + b² - 2ab cos(C), where a and b are the lengths of two sides of a triangle, C is the angle between those sides, and c is the length of the side opposite angle C.

How do you use the law of cosines to find a side length?

To find a side length using the law of cosines, rearrange the formula to solve for the unknown side. For example, if you know sides a, b and angle C, then c = √(a² + b² - 2ab cos(C)).

When should the law of cosines be applied instead of the Pythagorean theorem?

The law of cosines should be used when you have a non-right triangle and know either two sides and the included angle or all three sides, while the Pythagorean theorem only applies to right triangles.

Can the law of cosines be used to find an angle of a triangle?

Yes, the law of cosines can be rearranged to find an angle. For example, cos(C) = (a² + b² - c²) / (2ab), and then angle C can be found by taking the inverse cosine of that value.

Is the law of cosines formula applicable to all types of triangles?

Yes, the law of cosines applies to all types of triangles, including acute, obtuse, and right triangles.

How does the law of cosines help in solving real-world problems?

The law of cosines helps in navigation, engineering, and physics by allowing calculation of unknown sides or angles in non-right triangles, which is useful for determining distances and directions.

What is the difference between the law of cosines and the law of sines?

The law of cosines relates the lengths of sides of a triangle to the cosine of one of its angles, useful for SAS and SSS cases, while the law of sines relates the ratios of sides to the sines of their opposite angles, useful for ASA and AAS cases.

How do you derive the law of cosines formula?

The law of cosines can be derived using the coordinate plane by placing one side of the triangle along the x-axis and using the distance formula along with the definition of cosine to express the third side in terms of the other two sides and the included angle.

Discover More

Explore Related Topics

#cosine rule
#triangle side calculation
#law of cosines proof
#cosine formula
#triangle angle calculation
#trigonometry law
#SSS triangle formula
#SAS triangle formula
#cosine theorem
#solving triangles