---
title: "Law of Cosines — AP Precalculus Definition & Exam Guide"
description: "The Law of Cosines (c² = a² + b² − 2ab·cos C) finds missing sides and angles in any triangle. In AP Precalc Topic 4.8, it powers vector addition problems."
canonical: "https://fiveable.me/ap-pre-calc/key-terms/law-of-cosines"
type: "key-term"
subject: "AP Pre-Calculus"
unit: "Unit 4"
---

# Law of Cosines — AP Precalculus Definition & Exam Guide

## Definition

The Law of Cosines states that in any triangle, c² = a² + b² − 2ab·cos(C), where C is the angle included between sides a and b. In AP Precalculus (Topic 4.8), you use it to find the magnitude of a resultant vector or the angle between two vectors after vector addition.

## What It Is

The Law of Cosines is a triangle relationship that works in **any** triangle, not just right triangles. It says the square of one side equals the sum of the squares of the other two sides, minus twice their product times the [cosine](/ap-pre-calc/key-terms/cosine-function "fv-autolink") of the angle between them. Written out, that's c² = a² + b² − 2ab·cos(C). The best way to think about it is as the Pythagorean theorem with a correction term. If C is exactly 90°, then cos(C) = 0, the correction term vanishes, and you're left with plain old c² = a² + b².

In AP Precalculus, this formula lives in [Topic 4.8](/ap-pre-calc/unit-4/vectors/study-guide/E38atN4oigqKq7in "fv-autolink") (Vectors). When you add two vectors tip-to-tail, the two vectors and their resultant form a triangle. That triangle usually isn't a right triangle, so SOH-CAH-TOA won't save you. The Law of Cosines lets you find the [magnitude](/ap-pre-calc/key-terms/magnitude "fv-autolink") of the resultant when you know both vectors' magnitudes and the angle between them, or work backwards to find the angle when you know all three magnitudes.

## Why It Matters

The Law of Cosines directly supports learning objective **[AP Pre Calc](/ap-pre-calc "fv-autolink") 4.8.D**, which asks you to determine angle measures between vectors and magnitudes of vectors involved in vector addition. The CED states it plainly: the Law of Sines and Law of Cosines can be used to determine side lengths and angle measures of triangles formed by vector addition. That makes it one of the main computational tools of [Unit 4](/ap-pre-calc/unit-4 "fv-autolink")'s vector section.

There's one trap worth knowing up front. When you add vectors tip-to-tail, the angle *inside* the triangle is the supplement of the angle *between* the vectors. If the angle between u and v is 60°, the included angle in the addition triangle is 120°. Getting this wrong flips the sign of the correction term and gives a wrong (but tempting) answer choice on multiple choice questions.

## Connections

### [Law of Sines (Unit 4)](/ap-pre-calc/key-terms/law-of-sines)

These two laws are partners on vector problems. The Law of Cosines handles side-angle-side and side-side-side setups, while the [Law of Sines](/ap-pre-calc/key-terms/law-of-sines "fv-autolink") handles cases where you know an angle and its opposite side. The CED names both as tools for triangles formed by vector addition, so know which setup calls for which law.

### [Dot product (Unit 4)](/ap-pre-calc/key-terms/dot-product)

The [dot product](/ap-pre-calc/key-terms/dot-product "fv-autolink") formula u·v = |u||v|cos(θ) is essentially the Law of Cosines rewritten in vector language. Both give you the angle between two vectors. If you're given components, the dot product is usually faster; if you're given magnitudes only, the Law of Cosines is your move.

### [Magnitude of a vector (Unit 4)](/ap-pre-calc/key-terms/magnitude-of-a-vector)

Every Law of Cosines [vector](/ap-pre-calc/unit-4/matrices-as-functions/study-guide/5YRNj78FIP4lmMi9 "fv-autolink") problem is really a magnitude problem in disguise. The 'sides' of the triangle are |u|, |v|, and |u + v|, so being fluent with magnitudes (and computing them from components with √(a² + b²)) is the entry ticket.

### Cosine function and trig values (Unit 3)

The Law of Cosines puts your Unit 3 trig knowledge to work. Knowing exact values like cos(60°) = 1/2 and cos(120°) = −1/2 lets you solve resultant-magnitude problems cleanly without a calculator detour.

## On the AP Exam

Law of Cosines questions in the vectors topic come in two main flavors. First, you're given two vector magnitudes and the angle between them, and you find the magnitude of the resultant. For example, with |u| = 6, |v| = 8, and a 60° angle between them, you build the addition triangle, use the included angle of 120°, and apply the Law of Cosines to get |u + v|. Second, the problem runs in reverse. Given |p| = 5, |q| = 7, and |p + q| = 10, you solve the Law of Cosines for the cosine of the angle, then take an inverse cosine to find the angle between the vectors. Component-form versions also appear, where vectors like 5i + 12j and 8i + 15j require you to compute magnitudes first, then find the angle (here the dot product is often the cleaner path). In every case, draw the triangle, label which angle you actually have, and check whether it's the angle between the vectors or its supplement.

## Law of Cosines vs Law of Sines

Both solve non-right triangles, but they fit different information. Use the Law of Cosines when you have two sides and the included angle (SAS) or all three sides (SSS). Use the Law of Sines when you have an angle paired with its opposite side (AAS, ASA, or SSA). Quick check: if you can't match any known angle to its opposite side, the Law of Sines is useless and you need the Law of Cosines.

## Key Takeaways

- The Law of Cosines, c² = a² + b² − 2ab·cos(C), works in any triangle and reduces to the Pythagorean theorem when C = 90°.
- On the AP exam, it's tested through vector addition (Topic 4.8), where it finds the magnitude of a resultant or the angle between two vectors.
- When vectors are added tip-to-tail, the included angle in the triangle is 180° minus the angle between the vectors, so always check which angle the problem actually gives you.
- Use the Law of Cosines for SAS and SSS setups, and the Law of Sines when you have an angle matched with its opposite side.
- The dot product formula u·v = |u||v|cos(θ) gives the same angle information as the Law of Cosines, and it's usually faster when vectors are given in component form.

## FAQs

### What is the Law of Cosines in AP Precalculus?

It's the formula c² = a² + b² − 2ab·cos(C), which relates the three sides of any triangle to one of its angles. In AP Precalc Topic 4.8, you use it to find resultant vector magnitudes and angles between vectors.

### Does the Law of Cosines only work for right triangles?

No, that's backwards. It works for every triangle. The Pythagorean theorem is actually the special case you get when the angle is 90°, since cos(90°) = 0 wipes out the −2ab·cos(C) term.

### How is the Law of Cosines different from the Law of Sines?

The Law of Cosines needs two sides and the included angle (SAS) or all three sides (SSS). The Law of Sines needs an angle and its opposite side. If no known angle sits across from a known side, reach for the Law of Cosines.

### How do you use the Law of Cosines with vectors?

Adding two vectors tip-to-tail creates a triangle whose sides are |u|, |v|, and |u + v|. Apply the Law of Cosines with the included angle, which is 180° minus the angle between the vectors. For example, if |u| = 6, |v| = 8, and the vectors are 60° apart, you use cos(120°) inside the formula.

### Is the Law of Cosines the same as the dot product formula?

They're closely related but not identical. The dot product u·v = |u||v|cos(θ) is essentially the Law of Cosines translated into vector form, and both recover the angle between two vectors. With components, the dot product is usually quicker; with only magnitudes, use the Law of Cosines.

## Related Study Guides

- [4.8 Vectors](/ap-pre-calc/unit-4/vectors/study-guide/E38atN4oigqKq7in)

## Structured Data

```json
{"@context":"https://schema.org","@graph":[{"@type":"LearningResource","@id":"https://fiveable.me/ap-pre-calc/key-terms/law-of-cosines#resource","name":"Law of Cosines — AP Precalculus Definition & Exam Guide","url":"https://fiveable.me/ap-pre-calc/key-terms/law-of-cosines","learningResourceType":"Concept explainer","educationalLevel":"AP® / High School","about":{"@id":"https://fiveable.me/ap-pre-calc/key-terms/law-of-cosines#term"},"audience":{"@type":"EducationalAudience","educationalRole":"student"},"dateModified":"2026-06-11T05:27:28.409Z","isPartOf":{"@type":"Collection","name":"AP Pre-Calculus Key Terms","url":"https://fiveable.me/ap-pre-calc/key-terms"},"publisher":{"@type":"Organization","name":"Fiveable","url":"https://fiveable.me"}},{"@type":"DefinedTerm","@id":"https://fiveable.me/ap-pre-calc/key-terms/law-of-cosines#term","name":"Law of Cosines","description":"The Law of Cosines states that in any triangle, c² = a² + b² − 2ab·cos(C), where C is the angle included between sides a and b. In AP Precalculus (Topic 4.8), you use it to find the magnitude of a resultant vector or the angle between two vectors after vector addition.","url":"https://fiveable.me/ap-pre-calc/key-terms/law-of-cosines","inDefinedTermSet":{"@type":"DefinedTermSet","name":"AP Pre-Calculus Key Terms","url":"https://fiveable.me/ap-pre-calc/key-terms"}},{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is the Law of Cosines in AP Precalculus?","acceptedAnswer":{"@type":"Answer","text":"It's the formula c² = a² + b² − 2ab·cos(C), which relates the three sides of any triangle to one of its angles. In AP Precalc Topic 4.8, you use it to find resultant vector magnitudes and angles between vectors."}},{"@type":"Question","name":"Does the Law of Cosines only work for right triangles?","acceptedAnswer":{"@type":"Answer","text":"No, that's backwards. It works for every triangle. The Pythagorean theorem is actually the special case you get when the angle is 90°, since cos(90°) = 0 wipes out the −2ab·cos(C) term."}},{"@type":"Question","name":"How is the Law of Cosines different from the Law of Sines?","acceptedAnswer":{"@type":"Answer","text":"The Law of Cosines needs two sides and the included angle (SAS) or all three sides (SSS). The Law of Sines needs an angle and its opposite side. If no known angle sits across from a known side, reach for the Law of Cosines."}},{"@type":"Question","name":"How do you use the Law of Cosines with vectors?","acceptedAnswer":{"@type":"Answer","text":"Adding two vectors tip-to-tail creates a triangle whose sides are |u|, |v|, and |u + v|. Apply the Law of Cosines with the included angle, which is 180° minus the angle between the vectors. For example, if |u| = 6, |v| = 8, and the vectors are 60° apart, you use cos(120°) inside the formula."}},{"@type":"Question","name":"Is the Law of Cosines the same as the dot product formula?","acceptedAnswer":{"@type":"Answer","text":"They're closely related but not identical. The dot product u·v = |u||v|cos(θ) is essentially the Law of Cosines translated into vector form, and both recover the angle between two vectors. With components, the dot product is usually quicker; with only magnitudes, use the Law of Cosines."}}]},{"@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"AP Pre-Calculus","item":"https://fiveable.me/ap-pre-calc"},{"@type":"ListItem","position":2,"name":"Key Terms","item":"https://fiveable.me/ap-pre-calc/key-terms"},{"@type":"ListItem","position":3,"name":"Unit 4","item":"https://fiveable.me/ap-pre-calc/unit-4"},{"@type":"ListItem","position":4,"name":"Law of Cosines"}]}]}
```
