Main content

### Course: Calculus 1 > Unit 5

Lesson 11: Solving optimization problems- Optimization: sum of squares
- Optimization: box volume (Part 1)
- Optimization: box volume (Part 2)
- Optimization: profit
- Optimization: cost of materials
- Optimization: area of triangle & square (Part 1)
- Optimization: area of triangle & square (Part 2)
- Optimization problem: extreme normaline to y=x²
- Optimization
- Motion problems: finding the maximum acceleration

© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Optimization: sum of squares

What is the minimum possible value of x^2+y^2 given that their product has to be fixed at xy = -16. Created by Sal Khan.

## Want to join the conversation?

- Well, but what is optimization ?(57 votes)
- Optimization just means finding the value that maximizes or minimizes something. In this case, we optimized (minimized) the sum of two numbers squared.(93 votes)

- What does calculus represent? What does it do for us?(5 votes)
- Our world is in constant motion, or change, so if you want to describe/explain/model/predict this world, the best tool to use is one that was developed to describe processes that change over time, namely the calculus; poetic license can share the emotive/descriptive aspect of change, but not tell us anything about how or why. Almost everything you see around you in the world today, internet, computers, highways, bridges, buildings, successful business, planes, trains and automobiles, medicines and medical devices, TVs, cell phones and even computer games could not be at the level of complexity they have now with out calculus.(57 votes)

- When you solve x^2=16 you said it's 4. But this could be -4 too, and so Y would be 4 instead of -4.(20 votes)
- As long as one integer is negative and one integer is positive in this case, then it doesn't matter which variable is negative or positive, it will still come out to be -16.(7 votes)

- At4:27: Wherefore do you take the second derivative of the original equation?(5 votes)
- The second derivative was to verify that the point x=4, would indeed create the smallest sum. And not, for instance, the largest sum. The first derivative only showed us that x=4 was a critical point, not which kind.(11 votes)

- When in real life would we use this?

and when would we use any other calculus stuff?(2 votes)- If you wanna get into machine learning or tough scientific / engineering problems, this is a really important topic.

I'm 31 and learning this stuff - I need it for my job as a software engineer.(12 votes)

- If the graph is always concave upwards (since Y''(x) is always positive) how can there be two minimums (at 4 and -4)?(6 votes)
- The function is discontinuous and goes to infinity as
`x→∞`

or`x→-∞`

or`x→0`

.(3 votes)

- Is x=-4 also an acceptable answer? I got that as a critical point and everything seemed to work out.(3 votes)
- Yep, that works too! However, note that negative answers can be wrong in some cases (For example, if you were to find the side of a box which optimizes its volume, x = -4 wouldn't make sense, as a side cannot have negative length)(6 votes)

- Graphically, If x = +4 and -4 than function will have 2 points where derivative of f(x) = 0, means there will be two points where sope of f(x) = 0 . Where is the second point if Funcion is always concave upwards and doesn't have an inflection point ?(3 votes)
- The function has zero slope at x=4 and x=-4. It doesn't have an inflection point, but it has an asymptote at x=0 because one of the terms has x in the denominator and tends to infinity. It may appear to be a curve that's always concave up, but actually it's two separate curves that are concave up, with a discontinuity at x=0.(6 votes)

- Couldn't we just input a value in the first derivative that is close to x=4 from both the positive and negative sides. If the first derivatives gives a negative value for the side of x that is more negative, and the first derivative gives a value that is positive for the side of x that is more positive, then don't we know that x=4 is a minimum value? b/c the original function's slope is negative approaching from negative infinity and positive approaching from positive infinity?(4 votes)
- Correct, the first derivative test for local extrema is a valid alternative to the second derivative test for local extrema.(3 votes)

- Is the concept of maximisation and minimisation the same thing as convexity and concavity?(2 votes)
- Not exactly, but they are related.

Concavity is a description of how the slope of a function changes, and finding concavity involves looking at the second derivative of the parent function for zeros, which correspond to**possible**inflection points.

Optimization problems are problems of identifying certain extrema, and tend to involve not just finding them (which would be just looking at the first derivative of the parent function for zeros, which correspond to**possible**critical points/extrema) but also describing the parent function in the first place, determining it from a worded description of the problem. This is shown in the video here, where the word problem "minimize the sum of the squares of two numbers whose product is -16" must be translated into "minimize S(x), the single-variable function which represents the sum of the squares of two numbers whose product is -16".

The two concepts are related, in that the extrema found in optimization problems are usually at points that look like the tops of crests (maxima) or the bottoms of troughs (minima), and as a result the concavity around those extrema is very visually distinguishable.

(Note that when I say "possible" points, I mean that for it to be "actually" a critical or inflection point, the first or second derivative (respectively) would have to have an actual sign change in the neighborhood of the zero.)(7 votes)

## 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.