Current time:0:00Total duration:7:35

# Optimization: sum of squares

## Video transcript

We are being asked, what
is the smallest-- this is a little typo here--
what is the smallest possible sum of
squares of two numbers if their product is negative 16? So let's say that these
two numbers are x and y. So how could we define the
sum of the squares of the two numbers? So I'll just call that
the sum of the squares, s for sum of the squares,
and it would just be equal to x squared
plus y squared. And this is what we
want to minimize. We want to minimize s. Now, right now s is expressed
as a function of x and y. We don't know how to minimize
with respect to two variables, so we have to get this in
terms of only one variable. And lucky for us, they give us
another piece of information. Their product is negative 16. So x times y is
equal to negative 16. So let's say we
wanted this expression right over here
only in terms of x. Well, then we can
figure out what y is in terms of x
and then substitute. So let's do that
right over here. If we divide both sides by x,
we get y is equal to negative 16 over x. And so let's replace
our y in this expression with negative 16 over x. So then we would get
our sum of squares as a function of
x is going to be equal to x squared
plus y squared. y is negative 16 over x. And then that's what
we will now square. So this is equal to x
squared plus, what is this? 256 over x squared. Or we could write that as
256x to the negative 2 power. That is the sum of our squares
that we now want to minimize. Well, to minimize
this, we would want to look at the critical
points of this, which is where the derivative
is either 0 or undefined, and see whether those
critical points are possibly a minimum or a maximum point. They don't have to
be, but those are the ones if we have a
minimum or a maximum point, they're going to be one
of the critical points. So let's take the derivative. So the derivative
s prime-- let me do this in a different
color-- s prime of x. I'll do it right
over here, actually. The derivative s prime
of x with respect to x is going to be
equal to 2x times negative 2 times 2x plus
256 times negative 2. So that's minus 512x to
the negative 3 power. Now, this is going to be
undefined when x is equal to 0. But if x is equal to
0, then y is undefined. So this whole thing breaks down. So that isn't a useful
critical point, x equals 0. So let's think about
any other ones. Well, it's defined
everywhere else. So let's think about where
the derivative is equal to 0. So when does this thing equal 0? So when does 2x minus 512x
to the negative 3 equal 0? Well, we can add 512x to the
negative 3 to both sides. So you get 2x is equal to 512x
to the negative third power. We can multiply both sides
times x to the third power so all the x's go away
on the right-hand side. So you get 2x to the
fourth is equal to 512. We can divide both
sides by 2, and you get x to the fourth
power is equal to 256. And so what is the
fourth root of 256? Well, we could take the
square root of both sides just to help us here. So let's see. So it's going to be x squared
is going to be equal to 256 is 16 squared. So this is 16. This is going to be x squared is
equal to 16 or x is equal to 4. Now that's our only
critical point we have, so that's probably
the x value that minimizes our sum of
squares right over here. But let's make sure
it's a minimum value. And to do that, we can just
do our second derivative test. So let's figure out. Let's take the
second derivative s prime prime of x and figure
out if we are concave upwards or downwards when
x is equal to 4. So s prime prime of x is
going to be equal to 2. And then we're going to have
negative 3 times negative 512. So I'll just write that
as plus 3 times 512. That's going to be 1,536. Is that right? Yeah, 3 times 500
is 1,500, 3 times 12 is 36, x to the
negative 4 power. And this thing right
over here is actually going to be positive for any x. x to the negative 4, even
if the negative x value, that's going to be positive. Everything else is positive. This thing is always positive. So we are always in a
concave upwards situation. Concave upwards means that
our graph might look something like that. Actually, I don't want to
draw the little squiggle. It might look
something like that. And you see there's a reason why
the second derivative implies concave upwards, a second
derivative positive means that our derivative
is constantly increasing. So the derivative is
constantly increasing. It's negative, less
negative, even less negative. Let me do it in a
different color. You see it's negative, less
negative, even less negative, 0, positive, more positive. So it's increasing
over the entire place. So if you have a
critical point where the derivative is equal to 0,
so the slope is equal to 0, and it's concave upwards,
you see pretty clearly that we have minimized
the function. So what is y going
to be equal to? We actually don't even
have to figure out what y has to be
equal to in order to minimize the sum of squares. We could just put
it back into this. But just for fun, we see that
y would be negative 16 over x. So y would be equal
to negative 4. And we could just figure out
now what our sum of squares is. Our minimum sum of
squares is going to be equal to 4 squared,
which is 16 plus negative 4 squared plus another 16,
which is equal to 32. Now I know some of you
might be thinking, hey, I could have done
this without calculus. I could have just tried out
numbers whose product is negative 16 and I probably would
have tried out 4 and negative 4 in not too much time
and then I would have been able to maybe figure
out it's lower than if I did 2 and negative 8 or negative
2 and 8 or 1 and 16. And that's true,
you probably would have been able to do that. But you still wouldn't
have been able to feel good that that was a minimum
value, because you wouldn't have tried out 4.01 or 4.0011. In fact, you couldn't have tried
out all of the possible values. Remember, we didn't say
that this is only integers. It just happened to be that
our values just worked out to be integers in
this situation. You can imagine what would
happen if the problem wasn't if their product is
negative 16, but what if their product is negative 17? Or what if the product
is negative 16.5? Or what if their
product was pi squared? Then you wouldn't be able
to try everything else out and you would have
to resort to doing what we did in this video.