# Proof of the law of cosines | Trig identities and examples | Trigonometry | Khan Academy

Articles, Blog 100 Comments

In the last video, we had a

word problem where we had– we essentially had to figure out

the sides of a triangle, but instead of, you know, just

being able to do the Pythagorean theorem and because

it was a right triangle, it was just kind of a normal triangle. It wasn’t a right triangle. And we just kind of chugged

through it using SOHCAHTOA and just our very simple trig

functions, and we got the right answer. What I want to do now is to

introduce you to something called the law of cosines,

which we essentially proved in the last video, but I want to

kind of prove it in a more– you know, without the word

problem getting in the way, and I want to show you, once you

know the law of cosines, so you can then apply it to a problem,

like we did in the past, and you’ll do it faster. I have a bit of a mixed opinion

about it because I’m not a big fan of memorizing things. You know, when you’re 40 years

old, you probably won’t have the law of cosines still

memorized, but if you have that ability to start with the trig

functions and just move forward, then you’ll

always be set. And I’d be impressed if

you’re still doing trig at 40, but who knows? So let’s go and let’s

see what this law of cosines is all about. So let’s say that I

know this angle theta. And let’s called this

side– I don’t know, a. No, let’s call this side b. I’m being a little

arbitrary here. Actually, let me stay in

the colors of the sides. Let’s call that b and let’s

call this c, and let’s call this side a. So if this is a right triangle,

then we could have used the Pythagorean theorem

somehow, but now we can’t. So what do we do? So we know a– well, let’s

assume that we know b, we know c, we know theta, and then

we want to solve for a. But, in general, as long as you

know three of these, you can solve for the fourth once you

know the law of cosines. So how can we do it? Well, we’re going to do

it the exact same way we did that last problem. We can drop a line

here to make– oh, my God, that’s messy. I thought I was using

the line tool. Edit, undo. So I can drop a line like that. So I have two right angles. And then once I have right

triangles, then now I can start to use trig functions and

the Pythagorean theorem, et cetera, et cetera. So, let’s see, this is a right

angle, this is a right angle. So what is this side here? Let me pick another color. I’m probably going to get too

involved with all the colors, but it’s for your improvement. So what is this side here? What is the length of that

side, that purple side? Well, that purple side is just,

you know, we use SOHCAHTOA. I was just going to write

SOHCAHTOA up here. So this purple side is adjacent

to theta, and then this blue or mauve side b is the hypotenuse

of this right triangle. So we know that– I’m just

going to stick to one color because it’ll take me forever

if I keep switching colors. We know that cosine of theta–

let’s call this side, let’s call this kind of subside–

I don’t know, let’s call this d, side d. We know that cosine of theta

is equal to d over b, right? And we know b. Or that d is equal to what? It equals b cosine theta. Now, let’s call this

side e right here. Well, what’s e? Well, e is this whole c

side– c side, oh, that’s interesting– this whole c side

minus this d side, right? So e is equal to c minus d. We just solved for d, so

side e is equal to c minus b cosine of theta. So that’s e. We got e out of the way. Well, what’s this magenta

side going to be? Well, let’s call this magenta–

let’s call it m from magenta. Well, m is opposite to theta. Now, we know it. We’ve solved for c as well, but

we know b, and b is simple. So what relationship gives us

m over b, or involves the opposite and the hypotenuse? Well, that’s sine:

opposite over hypotenuse. So we know that m over b is

equal to sine of theta. We know that– let

me go over here. m over b, right, because this

is the hypotenuse, is equal to sine of theta, or that m

is equal to b sine of theta, right? So we figured out m, we

figured out e, and now we want to figure out a. And this should

jump out at you. We have two sides of

a right triangle. We want to figure

out the hypotenuse. We can use the

Pythagorean theorem. The Pythagorean theorem tells

us a squared is equal to m squared plus e squared, right? Just the square of

the other two sides. Well, what’s m squared

plus e squared? Let me switch to another

color just to be arbitrary. a squared is equal

to m squared. m is b sine of theta. So it’s b sine of theta

squared plus e squared. Well, e we figure out is this. So it’s plus c minus b

cosine theta squared. Now, let’s just chug

through some algebra. So that equals b sine– b

squared sine squared of theta. Sine squared of theta

just means sine of theta squared, right? Plus, and we just foiled

this out, although I don’t like using foil. I just multiply it out. c squared minus 2cb cosine

theta plus b squared cosine theta, right? I just expanded this out

by multiplying it out. And now let’s see if we can

do anything interesting. Well, if we take this term and

this term, we get– those two terms are b squared sine

squared of theta plus b squared cosine– this should be squared

there, right, because we squared it. b squared cosine squared of

theta, and then we have plus c squared minus 2bc cosine theta. Well, what does

this simplify to? Well, this is the same thing

as b squared times the sine squared theta plus

cosine squared of theta. Something should be jumping out

at you, and that’s plus c squared minus 2bc cosine theta. Well, this thing, sine

squared plus cosine squared of any angle is 1. That’s one of the

earlier identities. That’s the Pythagorean

identity right there. So this equals 1, so then

we’re left with– going back to my original color. We’re almost there– a squared

is equal to– this term just becomes 1, so b squared. We’re just left with a b

squared plus c squared minus 2bc cosine of theta. That’s pretty neat, and this

is called the law of cosines. And it’s useful because, you

know, if you know an angle and two of the sides of

any triangle, you can now solve for the other side. Or really, if you want to, if

you know three sides of a triangle, you can now solve

for any angle, so that also is very useful. The only reason why I’m a

little bit, you know, here, there, is I don’t– if you are

in trigonometry right now and you might have a test, you

should memorize this because it’ll make you faster, and

you’ll get the answer right quicker. I’m not a big fan of just

memorizing it without knowing where it came from, because a

year from now or two years from now when you go to college and

it’s been four years since you took trigonometry, you probably

won’t have this memorized. And if you face a trig problem

all of a sudden, it’s good to kind of get there from scratch. With that said, this is the law

of cosines, and if you use the law of cosines, you could have

done that problem we just did a lot faster because we just–

you know, you just have to set up the triangle and then just

substitute into this, and you could have solved for a in

that ship off-course problem. I’ll see you in the next video.

goodbyePost author8:52 "A year or two from now when you go to college and it's been four years since you took trigonometry…" A year or two… four years… 2 = 4?

timmyfashoPost author@flowiepanda math of this level is almost all completely arbitrary

Sir_Sniff-A-LotPost authorYeah, I would be impressed too if someone (who is not a math teacher) knows trigonometry after turning 40. Most of the math terms and equations I learned in high school are pretty much forgotten.

Tai Ching KanPost authorThe law of sines only works when you have an angle and the side opposite it given to you.

Francesco ArmillottaPost authorcan I ask what software do you use? and overall it's free?

Cobra317Post authorThis way is 10x more confusing

Belinda GallowayPost authorI couldn't understand the text book I was reading so once I again I turned to you. You are amazing and SO CLEAR. Thank you, thank you, thank you….you take the frustration out of math…

mitchell andersonPost authori think it would have been easier to understand if you would have just started with a right triangle

Sania PervezPost author2:00…. Hahhahaha

Chuck SampsonPost authorI am sixty and I am still doing trigonometry. This stuff is for life. Ok, the law of cosines is the basis for vector analysis, specifically the dot product of two vectors, which you learn about in Calculus III. Thanks Khan for the quick refresher.

Interception masterPost authori laugh when you say i don't know

Jean RavenPost authorLearning in my point of view should be fun too. This guy is so much fun. I love it. Thanks KHAN.

Jean RavenPost authorI think since its his video he starts where he chooses. Let up Mitty. Hingie Namonga.

Mr707derbyPost authorI'm forty and doing trigonometry…Ty

jugglingtheapplesPost authorOH my god that was messy. I thought I was using the line tool

EXPComicsPost authorxD now I feel perpared for this Quiz LOL

Anas MerbatiPost authorfor the Obtuse Angle in Non-right angle triangle. shall we take the cosine of that angle when we want to calculate the length of the line opposite to that angle, or we take the cosine for the supplementary angle?

mhwrokzPost author*day of

PatarHDPost authorSLACKER!!!!111!!1one!

j98brantPost authorI'm sorry but I didn't see how to find the angle

Nano Sanchez LopezPost authorI love how shocked you were in the begining of the video when you realized the red line you were making wasn't straight lol

Jake ZephyrPost authorday before ACT…

Jimmy DonoghuePost authorHow many of us will fail our test anyway???

IngeniebrioPost authorWell, i didn't fail my test two years ago.

Jimmy DonoghuePost authorwell I'm asian so when I say I failed, it means I got a B lol

HingleMcCringleBerryPost authorKHAAAAAAAAAAAANNNNNNNNNNNNNNNNNN!

sydmanonePost authorEverybody shut up and stop feeding the trolls! Everybody!

Armon HPost authorA shit ton of us, apparently. XD

Armon HPost authorStar Trek: Into Darkness = badass.

Patricia B.Post authorA day before my Final Exam (*u*)b

ClassifiedPost authorLOL fuck

qqqPost authorkinda hard to believe you graduated top of your class when you spelled guerrilla warfare wrong. jackass.

GraitBrittonPost authorpathetic.

Sean DafnyPost authorHold on, how the FUCK yo picket fence head ass find me on this video??? I'm sitting here trying to learn Pythagorean proofs and shit damn. This my break time from trolling on DOOM videos. Shit I need breaks too goddam me.

Nitish MohanPost authorthat was really helpful ………… proving it, rather then memorizing it………sal

Kirigaya KazutoPost authorC-side = seaside hahahaha 3:49

GraitBrittonPost authorlol…..fucking nerd.

Sean DafnyPost authorNiqqa we BOTH nerds cause we listen to DOOM. Therefore we are nerds

InfinityPost authorLaw of cosines can be proven by drawing a triangle abc in Cartesian coordinates in which ab side = A, bc side = B, and ca side = C. The triangle points are as follows: a(0,0), b(A,0) and c(Ccos(x),Csin(x)) where x is the angle between A and C sides. Using distance formula: B^2 = (A-Ccos(x))^2 + (0-Csin(x))^2. B^2 = A^2-2ACcos(x)+C^2.[cos(x)]^2+C^2.[sin(x)]^2. B^2 = A^2+C^2-2ACcos(x).

KevinPost author8:43 LOL I have a test tomorrow and I haven't learnt this..

SammysapphirePost authorWere you dropped on your head as a kid or something?

teenrosesPost authorWas top of my class, "learned" this back in 2009, and still don't understand or like it.

Probably the sole reason I'm not any sort of engineering major. Death.

redbowl LpPost authorU over complicated this

kuddybeefPost authorMy nigga, Sean Khanory

Averhamlincoln1Post authorThis isn't anything close to what I have been learning, over complicated.

ScriptBlaster42Post authoranalyzing86% complete.tiggerbear3Post authorHey, I'm 40 and working on the laws of sine and cosine…should I be insulted here?? lol j/k 🙂

John McSackPost authorCannot read wtf you wrote.

MARS TV CHANNELPost authorCould someone explain the origins of the calculations at 6:02, or where I can find that particular Khan video where it is explained? I'm 40 and can't remember!

Kaina jonesPost author"I'd be impressed if you're still doing trig. at 40…but who knows"

Strange statement.

JackPost authorhow many colours does he have?!?!

hahaha

Adrian SantosPost authorlol why not use a^2 = c^2 – b^2 hahaha

NobiashiPost authorThat only works for right triangles

The MaxPost authorA mess of pixels.

Julia FloresPost authorsuperb

Khushi KanodiaPost authorthanks mate that helped

Sean DafnyPost authorthis nigga sound suspiciously similar to dj vlad

Peter CrossPost authorI'm gon eat that fish

GPost authorvery neat!

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Post authorIf ur in trigonometry lol i have to do this in geometry.

leon vddPost authorYes wow thx this is so great now I finally know how to do this 🙂

abichanPost authori love watching derivations asdfghjkl

MuletTheGreatPost authorHow did I become a programmer? I have trouble with math, yet I make video games for a living. -.-

Celena MorrisPost authorI got lost fml

Michelle WanhaPost authorYou really helped! I don't need to study from my textbook now =D!

Power SlayerPost authorthanks!!

Aseel soPost authorThank you

perfect 😊

Carl SilversteinPost authorI'm 57 and still doing Trig. Calc next year.

p garrianoPost authorYou came a long way Sal lmao

Anthony VolpePost author6:21 i still dont understand how you got 2cbcos(theta)

WiggedApples834Post authoris it theta or Fheta

???????????

Dru DruPost authorNeed a better black board. Lost me at the very end where the writing became difficult to make out.

George KimPost authorwow that video is so old.

Charles RamboPost authorWhat about when theta is an obtuse angle?

Pᴀʀᴀsᴇʟᴇɴᴇ TᴀᴏPost authorWe need this video remade; it's aged quite a bit—in it's time it was difficult to follow too.

Kurt DaimsPost authorThe handwriting is bad enough to interfere with learning.

محمد ابوزيدPost authorSo good and its simple than l thought

XxNexusxXPost authorcan you redo this with your now-neat-hand writing?

XxNexusxXPost authorcan you redo this with your now-neat-hand writing?

Vivian LeePost authorThanks! Your explanation is perfectly clear to me, and that helps me to remember it.

Jane NikitaPost authoru helped my lord of Cosine

Caileán JonesPost authorLove it

Maegan KelleyPost authorHow do you know for sure that pheta is angle A

Master MöbiusPost authorBeautiful

delroy taylorPost authorthanks

Aaron GouldPost authori love you sal khan

Mansoor AhmedPost authorThanks

Jack YoungPost authorwhy is everybody 40 years old?

Zack WalkerPost authorHmm… I wanted to know the proof for Law of Cosines in order to prove Pythagorean Theorem. I want proof more axiomatic to prevent this circular reasoning…

Abdalla BabikirPost authorGreat video, just need a better quality software… The era of paint is over

Diamond LionPost authorNow that is how you get brain damage .

Karalyn HarrisPost authorThis was more confusing than helpful

Mark GreenPost authorYour videos are so great but this one sounds like you woke up with a hangover and was asked to prove something.

SoulofAnotherDeityPost author@8:50 – "I'm not a big fan of just memorizing it without knowing where it came from"

I'm the same when it comes to learning pretty much _anything_. 🙂

WhoistheJC?Post authorThis is really interesting. The law of cosines is the Pythagorean Theorem minus a correctional factor of 2cbcos(angle). In the special case of a right triangle where side 'a' is the hypotenuse and the angle is 90°, you get a correctional factor of 2cbcos(90°) which is zero. That's pretty useful

Ankit AryaPost authorIts amazing that physicists and mathematicians solved made and discovered new tools for their convenient now every physicist and mathematician uses each other's tools for their convenience.

MuskarPost authorIf anyone else is curious, "last video" is referring to 2 videos:

watch?v=1vamogV81Y8

watch?v=4CNnPgabrLE

an honest observerPost authorwhat if theta is so large that you cant form a right angle on side C?

Dacota SpraguePost authorGod I love algebra!

Andre DuvalPost author"I'll be impressed if you're still doing trig when you're 40." I'm 59. Catching up on missed math.