# Optimization: box volume (Part 2)

## Video transcript

In the last video, we were able to get a pretty good sense about how large of an x we should cut out of each corner in order to maximize our volume. And we did this graphically. What I want to do in this video is use some of our calculus tools to see if we can come up with the same or maybe even a better result. So to do that, I'm going to have to figure out the critical points of our volume as a function of x. And to do that, I need to take the derivative of the volume. So let me do that. And before I even do that, it'll simplify things so I don't have to use the product rule in some way and then have to simplify that, let me just multiply this expression out. So let's rewrite volume as a function of x is equal to-- and I'll write it all in yellow. So it's going to be x times-- I'll multiply these two binomials first. So 20 times 30 is 600. Then I have 20 times negative 2x, which is negative 40x. Then I have negative 2x times 30, which is negative 60x. And then I have negative 2x times negative 2x, which is positive 4x squared. So this part over here simplifies and I can change the order to 4x squared minus 100x plus 600. I just switched the order in which I'm writing them. So that's that. And so I can rewrite the volume of x as being equal to x times all of this business, which is-- let me make sure I have enough space, let me do it a little higher-- which is equal to 4x to the third power minus 100x squared plus 600x. And that'll be pretty straightforward to take the derivative. So let's say that v prime of x is going to be equal to-- I just have used the power rule multiple times-- so 4 times 3 is 12. x to the 3 minus 1 power 12x squared minus 200 times x to the first power, which is just x, plus 600. And so now we just have to figure out when this is equal to 0. So we have to figure out when 12x squared minus 200x plus 600 is equal to 0. What x values gets my derivative to be equal to 0? When is my slope equal to 0? I could also look for critical points where the derivative is undefined, but this derivative is defined especially throughout my domain of x that I care about, between 0 and 10. So I could try to factor this or try to simplify this a little bit. But I'm just going to cut to the chase and try to use the quadratic formula here. So this is, the x's that satisfy this is going to be x is going to be equal to-- So negative b. So it's 200. Negative, negative 200 is positive 200. Plus or minus the square root of b squared, which is negative 200 squared. So I could just write that as 200 squared. Doesn't matter if it's negative 200 squared or 200 squared, I'm going to get the same value. So let me give myself some more space. So negative 200 squared. Well, that's going to be 4 with 4 0's. 1, 2, 3, 4. So that's going to be 40,000 minus 4ac. So minus 4 times 12, 12 times 600-- I still didn't give myself enough space-- times 600. All of that over 2 times a. So all of that over 24. And I'll take out the calculator again to try to calculate this. So let me get out of graphing mode. All right, so first I'll try when I add the radical. So I'm going to get 200 plus the square root of 40,000. I could have just written that as 200 squared, but that's fine. 40,000 minus 4 times 12 times 600. And I get 305, which I then need to divide by 24. Which I'll divide by 24, and I get 12.74. So one of my possible x's. So it equals 12.74. And now let me do the situation where I subtract what I had in the radical sign. So let me get my calculator back. And so now let me do 200-- I probably could have done this slightly more efficiently, but this is fine-- minus the square root of 40,000-- 1, 2, 3-- minus 4 times 12 times 600. And I get that's just the numerator. And then I'm going to divide that by 24, and I get 3.92. Did I do that right? 200 minus 40,000 minus 4 times 12 times 600, all of that divided by 24. My previous answer divided by 24 gives me 3.92. So it's 12.74 or 3.92. Now which of these can I use? Well x equals 12.74 is outside of our valid values for x. If x was equal to 12.74, the x's would start to overlap with each other. So x cannot be 12.74. So we get a critical point at x is equal to 3.92. And you could look at the graph and you could say, oh, well look, that looks like a maximum value. But if you didn't have the graph at your disposal, you can then do the second derivative test and say, hey, are we concave upwards or concave downwards when x is equal to 3.92? Well, in order to do the second derivative test, you have to figure out the second derivative is. So let's do that. b prime prime of x is going to be equal to 24x, 24 times x to the first, minus 200. And you can just look at inspection that this number right over here is less than 4. So this thing right over here is going to be less than 100. You subtract 200. So we can write the second derivative at 3.92 is going to be less than 0. You can figure out what the exact value is if you like. So because this is less than 0, we are concave downwards. Another way of saying it is the slope is decreasing the entire time. Concave downwards. When the slope is decreasing the entire time, our shape looks like that. The slope could start off high, lower, lower, gets to 0, even lower, lower, lower. And we even saw that on the graph right over here. And since it's concave downwards, that implies that our critical point that sits where the interval is concave downward, that critical point is a local maximum. So this is the x value at which our function attains our maximum. Now what is that maximum value? Well, we could type that back in into our original expression for volume to figure what that is. So let's figure out what the volume when we get to 3.92 is equal to. What is our maximum volume? So get the calculator back out. It's obviously roughly 3.92. I could use this exact value. Actually, I'll just use 3.92 to get a rough sense of what our maximum value is, our maximum volume. So it'll be 3.92. I'll just use this expression for the volume as a function of x. 3.92 times 20 minus 2 times 3.92 times 30 minus 2 times 3.92 gives us-- and we deserve a drum roll now-- gives us 1,056.3. So 1,056.3, which is a higher volume then we got when we just inspected it graphically. We probably could have gotten a little bit more precise if we zoomed in some and then we would have gotten a little bit better of an answer, but there you have it. Analytically, we were able to actually get an even better answer than we were able to do at least on that first pass graphically.