If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content
Current time:0:00Total duration:16:55

Proof of the Cauchy-Schwarz inequality

Video transcript

let's say that I have two non zero vectors say the first Wester is X the second vector is why they're both a part of or a set they're both in the set are N and they're nonzero non zero it turns out that the absolute value of their let me do it in a different color the absolute let me do it in a this color is nice the absolute value of their dot product of the two vectors the absolute value remember this is just a scalar quantity is less than or equal to the product of their lengths and we've defined the dot product and we've defined lengths already it's less than or equal to the product of their lengths and and just to push it'll even further the only time that this is equal so the dot product the dot product of the two vectors is only going to be equal to the length so this you know the equal in the less than or equal apply only in the situation let me write that down only in the situation where one of these vectors is a scalar multiple of the other or they're collinear they're just you know that one's just kind of the longer a shorter version of the other one so only in the situation where let's just say X is equal to some scalar multiple of Y and this this these inequalities or is I guess this is the quality and this inequality this is called the Cauchy Schwarz inequality kocchi kocchi Schwarz inequality inequality so let's prove it because you can't take something like this just at face value you shouldn't just accept that so let me just construct a somewhat artificial function let me construct some function of some that's a that's a that's a function of some variable some scalar t let me define P of T to be equal to the length of the vector T T times the vector some scalar T times the vector Y - the vector X it's the length of this vector this is going to be a vector now is it that squared now before I move forward I want to make a little one little point here if I take the length of any vector of any real vector so the length of any real vector I'll do it here let's say I take the length of some vector V I want you to accept that this is going to be a positive number so it's at least greater than or equal to zero because this is just going to be each of its terms squared V 2 squared all the way to VN squared all of these are real numbers when you square a real number you get something greater than or equal to zero and then you sum them up you're going to have something greater than or equal to zero and you take the square root of it the principal square root the positive square root you're gonna have something greater than or equal to zero so the length of any real vector is going to be greater than or equal to zero so this is the length of a real vector so this is going to be greater than or equal to zero now in the previous video I think it was two videos ago I also showed that the magnitude or the length of a vector squared can also be re-written as the dot product of that vector with itself so let's rewrite this vector that way so this is equal to the the length of this vector squared is equal to the dot product of that vector with itself so it's T Y minus X dot T Y minus X in the last video I showed you a bunch of I showed you that you can treat a multiplication or you can treat the dot product very similar to regular multiplication when it comes to the associative distributive and commutative properties so when you multiply these you know you can kind of use these multiplying these two binomials you can do it the same way as you would just multiply two regular algebraic binomials you're essentially just using the distributive property so if you're but you remember this isn't just regular multiplication this is the dot product we're doing this is vector multiplication or one version of vector multiplication so if we distribute it out this will become T Y dot T Y so let me write that out we'll be T Y dot T Y and then we'll get a - a mine let me do it this way then we get the - x times this T Y so you get or let me instead of saying taht times I should be very careful say dot so - X dot T Y and then you end up and then you have the this T Y times this minus X so then you have minus T Y dot X and then finally you have the X's dot with each other and it's you can view them as minus one X dot minus One X so you could say plus minus One X right I could just say view this is plus minus one or plus minus one so this is minus One X dot minus One X so let's see so this is what my whole expression simplified to or expanded to I can't really call this a simplification but we can use the fact that this is commutative and associative to rewrite this expression right here this is equal to Y dot y y dot Y times T squared right T is just a scalar - - and actually this is - these two things are equivalent right if they're just rearrangements of the same thing and we saw that the dot product is associative so this is just equal to two times x dot y times t and i should do that and maybe a different color so these two terms result in that term right there and then you have them if you just rearrange these you have a minus one times a minus one they cancel out so those would come com+ and you're just left with plus X dot X and I should do that in a different color as well I'll do that orange color so those terms end up with that term right then of course that term results in that term and remember all I did is I rewrote this thing and said look this has got to be equal greater than or equal to zero so I can rewrite that here this is this thing is still just the same thing I've just rewritten it so this is all going to be greater than or equal to zero now let's make a little bit of a substitution just to clean up our expression a little bit and we'll later back substitute into this let's define this as a let's define this piece right here as B so the whole thing minus two x dot y I'll leave the T there and let's define this or let me just define let me define this right here see X dot X as C so then what is our expression become it becomes a times T squared minus I'm going to be careful with the colors B times T plus C plus C and of course we know that it's going to be greater than or equal to zero it's the same thing as this up here greater than or equal to zero I could write P of T here P of T now this is greater than or equal to zero for any for any T that I put in here for any real T that I put in there and so I could just put in I could just put in let me just pick a T to be let me take let me evaluate our function at B over 2a and I can definitely do this because what was a I just have to make sure I'm not dividing by zero anyplace so a was this this vector dotted with itself and we said this is a nonzero vector so this is the square of its length it's a nonzero vector so some of these terms up here would end up becoming positive when you take its length so this thing right here is nonzero this is a nonzero vector then two times the dot product with itself is also going to be nonzero so we can do this we don't have to worry about dividing by zero or whatever else but what does this be equal to this will be equal to and I'll just stick to the green it takes too long to keep switching between colors this is equal to a times this expression squared so it's B squared over 4a squared I just squared two way to get 4a squared minus B times this so B time this is just regular multiplication B times B over 2a I'll just write in regular multiplication there plus C and we know all of that is greater than or equal to zero now if we simplify this a little bit what do we get well this a cancels out with this exponent there and you end up with a B squared right there so we get B squared over 4a minus B squared over 2a that's that term over there plus C is greater than or equal to zero and I let me rewrite this I could if I multiply the numerator denominator this by two what do I get I get 2b squared over 4a and the whole reason I did that is because to get a common denominator here so what do you get you get B squared over 4a minus 2 B squared over 4a so what is what are these two terms simplify to well the numerator is B squared minus 2 B squared so that just becomes minus B squared over 4a plus C is greater than or equal to 0 these two terms add up to this one right here now if we add this to both sides of the equation we get C is greater than or equal to V squared over 4a right there's a negative on the left hand side if I add it to both sides it's going to be a positive on the right hand side so we're already we're approaching something that looks like an inequality so let's back substitute our original substitutions to see what we have now so where as are my original substitutions that I made I was right here so what was and actually just to simplified any more let me multiply both sides by 4a and once I set once again I said a not only is it nonzero it's going to be positive this is the square of its length and I already showed you that the length of any vector and real any real vector is going to be positive and the reason why I'm taking great pains to show that a is positive is because if I multiply both sides of it I don't want to change the inequality sign so let me multiply both sides of this by a before I substitute so we get 4 AC is greater than or equal to be squared there you go and I remember I took great pains I just said a is definitely a positive number because it is essentially the square of the length y dot y is the square of the length of y and that's the positive value it has to be positive for dealing with real vectors now let's back substitute this so 4 times a 4 times y dot y Y dot y is also I might as well just write it there y dot y is the same thing as the magnitude of Y squared that's why dot y this is a why do I showed that I showed you that in a previous video times si si is X dot X X dot X well X dot X is the same thing as the length of vector x squared so this was C so four times a times C is going to be greater than or equal to B squared now what was B B was this thing here so B squared would be 2 times X dot y squared so we've gotten to this result so far and so what can we do with this so oh sorry this whole thing is squared this whole thing right here was B so let's see if we can simplify this so we get on switched to a different color four times the length of Y squared times the length of x squared is greater than or equal to if we square this quantity right here we get 4 times X dot Y 4 times X dot Y times X x dot y actually even better let me just write it like this let me just write 4 times X dot y squared now we can divide both sides by 4 that won't change our inequality so that just cancels out there and now let's take the square root of both sides of this equation so the square roots of both sides of this equation these are positive values so the square root of this side is the square root of each of its terms that's just a property so if you take the square root of both sides you get the length of Y times the length of X is greater than or equal to the square root of this and we're going to take the positive square root we're going to take the positive square root on both sides of this equation that keeps us from having to mess with anything on the inequality or anything like that so the positive square root is going to be the absolute value absolute value of XY and I want to be very careful to say this is the absolute value because it's possible that this thing right here this thing right here wasn't as a negative value but when you square it you you you know you want to make be careful that when you take the square root of it that you stay a positive value because otherwise you have to when we take it with the principal square root we might mess with the inequality so this is we're taking the positive square root which will be so if you take the absolute value ensuring that it's going to be positive but this is our result the absolute value of the dot product of our vectors is less than the product of the two vectors length so we got our cauchy's warts inequality so we got our caoxi Schwarz inequality now the last thing I said is look what happens what happens if what happens if X is equal to some scalar multiple of Y well in that case what's the absolute value the absolute value of x dot y well that equals that equals what if we make the substitution that equals the absolute value of C times y that's just X dot Y which is equal to which is equal to just from the associative property it's equal to the absolute value of C times we want to make sure absolute values take everything keep everything positive y dot y and well this is just equal to C times C times the magnitude of Y or the length of Y squared well that just is equal to that is just equal to the magnitude of C times though or the absolute value of our scalar C times our length of Y times our length of Y times our length of Y well this right here this I can rewrite this I mean you can prove this to yourself if you don't believe it but this we could put the C inside of the magnitude and that could be a good exercise for you to prove but it's pretty straightforward you just do the definition of length and you multiply it by C this is equal to the magnitude of C Y times let me say the length of C Y times the length of Y length of Y I've lost my vector notation someplace over here I lost my there you go now this is X so this is equal to the length of X times the length of Y so I showed you kind of the second part of the Cauchy Schwarz inequality that this is only equal to each other if one of them is a scalar multiple of the other and if you thought if you're a little uncomfortable some of these steps I took it might be a good exercise to actually prove it for example to prove that the absolute value of C times the length of the vector Y is the same thing as the length of C times y anyway hopefully you found this pretty useful the Cauchy Schwarz inequality will use a lot when we prove other results in linear algebra and in a future video I'll give you a little more intuition about why this makes a lot of sense relative to the dot product