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

Optimization: cost of materials

With all the storage you might have to handle for your shoe factory, I bet you'd also like to be able to minize the cost of storage. Created by Sal Khan.

Want to join the conversation?

  • female robot grace style avatar for user Arie Vanhelden
    While there were two variables in the equation, instead of defining h, could we have taken the derivative implicitly?
    (34 votes)
    Default Khan Academy avatar avatar for user
    • leaf blue style avatar for user Matthew Daly
      It's always good to consider different strategies for solving problems, because sometimes implicit differentiation will save us a lot of effort. Bur if you did that in this case, you would get something like dC/dx = 40x + 36h + 36(dh/dx)x, and you'd be back to needing to find h(x) just like Sal did in order to solve dC/dx = 0 but you'd also need to calculate dh/dx. So this looks to me like a case where eliminating the dependent variables ahead of time will make for a less complicated solution.
      (65 votes)
  • marcimus red style avatar for user Kehinde Lawal
    at 9.23 sal says there is only one critical point. however the way i caculated the x values for the derivative equal zero. i got x= -1.65096 and x=1.65096
    (1 vote)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Johann Ho
    What if you wanted to get the maximum cost?
    (12 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Justin Long
      Same exact method, nearly. You find the points where the first derivative equals zero. Check the concavity of all these points (using the second derivative test) to find whether they are relative minimums or maximums, a negative concavity is a maximum. Check the Y-coordinates for all of your relative maximums, and find the largest one. HOWEVER, these are RELATIVE maximums. It is possible, such as in Sal's problem above, that your ABSOLUTE maximum is infinite (this is, of course, also true for minimums). The best method to know for sure is to learn, learn, learn you graphing, you should be able to tell fairly easily what most equations do. If you're not there yet, just plug in a very high positive and negative x-value and find if the corresponding y-value is higher then your relative maximum.
      (3 votes)
  • blobby green style avatar for user Madi Allred
    How would you do the same thing but for an area of land? For instance, A=780 square feet and two corresponding sides cost $6, and the other two cost $4?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Ben
      It's a relatively simple adjustment. You start with 3 variables. X=width of the space, Y=length of the space, and C=cost of materials.
      Because you know that the area is 780 square feet, you know that 780 is the product of x and y.
      X*Y=780
      You also know that c is the combined cost of the materials. the cost of the materials is going to be determined by the perimeter of the space. Perimeter is equal to twice the length + twice the width. You can then assign the $6 cost to one variable and the $4 cost to the other. From this you can build the equation:
      6(2X) +4(2Y)=C

      to move on you need a single equation with only 2 variables. Simply isolate the Y variable on one side of the first equation so you can substitute the expression it's equal to into the second equation.

      X*Y=780
      Y=780/X

      6(2x)+4(2(780/x))=C

      no simplify a little.

      6(2X)+4(2(780/X))=C
      12X+4(1560/x)=C
      12X+6240/x=C

      Change the 6240/x to 6240X^-1 to make deriving easier. Then find dc/dx using the power rule.
      12X+6240X^-1=C
      dc/dx=12-6240X^-2

      Next, set dc/dx equal to 0 this will allow you to find the x value for all mins and maxes in the original equation. Now solve for X.

      dc/dx=12-6240X^-2
      0=12-6240X^-2
      6240X^-2=12
      6240X^-2*X^2=12X^2
      6240=12X^2
      520=X^2
      ±√(520)=X
      X=±√(520)
      X=±√(130)*4
      X=2√(130), -2√(130)

      Right away you can discard the negative answer because X is a length and you cannot have negative length, so X=2√(130). If there were multiple positive X's it would be simple to test. You could either do the second derivative test to find out whether they are maximums or minimums, or you could simply plug into the cost equation and find out which one is cheaper. In either case we don't have to do that in this problem, so moving on.

      to find Y plug into the first equation
      X*Y=780
      2√(130)*Y=780
      Y=780/(2√(130))
      Y=340/√(130)

      Now to find C plug X into the cost equation.

      12X+6240X^-1=C
      12(2√(130))+6240(2√(130))^-1=C
      24√(130)+6240/(2√(130))=C
      24√(130)+3120/√(130)=C
      24√(130)*√(130)/√(130)+3120/√(130)=C
      24*130/√(130)+3120/√(130)=C
      3120/√(130)+3120/√(130)+C
      6240/√(130)=C

      Now you have all your answers. Just plug into a calculator.
      The $6 per foot side X=2√(130)=11.402 feet
      The $4 per foot side Y=340/√(130)=29.820 feet
      The total cost C=$6240/√(130)=$547.28
      (6 votes)
  • leaf green style avatar for user scott745618
    @ 6.20 Sal simplifies 36x(5/x^2) to 180x^x-1; is someone able to explain how that works in more detail? I so confused
    (2 votes)
    Default Khan Academy avatar avatar for user
    • old spice man green style avatar for user newbarker
      I assume you have a typo in your question and 180x^x-1 should be 180x^-1

      He multiplies the 36 and 5 together to get 180. The x up top cancels with one of the x's in the denominator so we have 180/x which can be written as 180x^(-1).

      Note that the 36x(5/x^2) can be rewritten as (36)(5)(x)/(x * x) which might help you to see things.
      (7 votes)
  • blobby green style avatar for user Hajun Kim
    At 0 = 180/x^2 - 40x, why doesn't he simplify that to a linear equation for that to equal to 0 = 40x - 180? I don't understand why he made the highest degree of x to be cubic, not linear (as he derived the quadratic equation)
    (2 votes)
    Default Khan Academy avatar avatar for user
    • primosaur seed style avatar for user Ian Pulizzotto
      This doesn't algebraically simplify to a linear equation. Multiplying both sides of 0 = 180/x^2 - 40x by x^2 (to get rid of the denominator) would give 0 = 180 - 40x^3.

      Note that we expect to get a cubic because the ratio of the term -40x to the term 180/x^2 (i.e. -40x/(180/x^2)) simplifies to a constant times x^3.

      Have a blessed, wonderful day!
      (3 votes)
  • piceratops ultimate style avatar for user LouieMcConnell26
    in this scenario, when it is obvious that there is a minmum and no maximum, do we still have to take the second derivitave
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leafers tree style avatar for user Anne Laura Darley
      The second derivative is rather useful when applying the Second Derivative test to a function to test for critical numbers of the derivative of that function (where the slope of the function is equal to zero) and gives you that coordinate for a possible local minimum or local maximum.
      (5 votes)
  • leaf green style avatar for user tdavidpearce
    Is it correct to say that when Sal finds h as a function of x he ALSO insures the minimum volume of 10m^3? This begins at time .

    He seems to solve two important steps with that single move and doesn't mention the fact that it was crucial in both ways:
    1. Find an h value that we can use, and
    2. Make sure the volume will be exactly 10m^3.

    Am I missing something? Was there another part where he made sure the volume would be 10m^3?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • aqualine ultimate style avatar for user sarah
    How does it work out that we only get one critical point and it's exactly the one we need? Like how does that work in real life? Does it always work out like that? Maybe there is no way to minimize the cost, like there is no absolute minimum point, then what?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Mark Geary
      The answer to your question depends very much on which real-life situation we're modeling.

      Some situations have no minimum solution...as a trivial example, how would you find the minimum number of basketball players on the court as a function of time? The mathematical expression of how many basketball players allowed on the court is f(t) = 5, so the minimum is constant at 5, which is the same as the maximum. Any constant function would result in the same outcome.

      Some situations might have more than one minimum. I can think of a number of non-trivial real-life functions with multiple minima or maxima, which are sinusoidal in form. Can you think of such a function?
      (3 votes)
  • marcimus pink style avatar for user Emma
    Is it possible for the curve to concave downwards for both of the points we get?
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

A rectangular storage container with an open top needs to have a volume of 10 cubic meters. The length of its base is twice the width. Material for the base costs $10 per square meter. Material for the sides costs $6 per square meter. Find the cost of the material for the cheapest container. So let's draw this open storage container, this open rectangular storage container. So it's going to have an open top. So let me draw its open top as good as I can. So it's going to have an open top. That's the top of my container. And then let me draw the sides. Just like that. So it might look something like that. And then I could draw-- and since it's open top, I can see through, I could see the inside of the container as well. So the container would look something like that. And so what do they tell us? They tell us that the volume needs to be 10 cubic meters. So let me write that down. The volume needs to be equal to 10 meters cubed. The length of its base is twice the width. So the length, let's call the width x, so the length is going to be twice that. It's going to be 2x. That's what they tell us right over here. They tell us the material for the base costs $10 per square meter. So this area right over here-- [INAUDIBLE] if I was transparent I could continue to draw it down here. But this right over here, that material costs $10 per square meter. Let me label that $10 per square meter. And then they say material for the sides costs $6 per square meter. So the material over here costs $6 per meter squared. So let's see if we can come up with a value or how much this box would cost to make as a function of x. But x only gives us the dimensions of the base. We also need a dimension for height. So it'll be a function of x and height for now. So let's write h as the height right over here. So what is the cost of this container going to be? So the cost is going to be equal to the cost of the base. Well, the cost of the base is going to be $10 times-- I'll just write 10. This is going to be 10 times the area of the base. Well, what's the area of the base? Well, it's going to be the width times the length. So 10 times x times 2x. That is the cost of base. And now what's going to be the cost of the sides? Well, the different sides are going to have different dimensions. You have this side over here and this side over here, which have the same dimension. They both have an area of x times h. You have x times h. And then our material is $6 per square meter. So it's 6 times x times h would be the cost of one of these side panels. So for two of them we have to multiply by 2. So plus 2 times 6 times h. And then we have these two side panels. We have this side panel right over here and we have this side panel right over here. The area of each of them is going to be 2x times h. So it's going to be 2x times h. The cost of the material is going to be 6. So the cost of one of the panels is going to be $6 per square meters times 2xh meters squared. But we have two of these panels. One panel and two panels. So we have to multiply by 2. And so we will get-- so this is right over here, this is the cost of the sides. And so let's see if we can simplify this. And I'll write it all in a neutral color. So this is going to be equal to 10. Let's see. 10 times 2 is 20. x times x is x squared. And then you have 2 times 6 times xh. So this is going to be plus 12xh. And then this is going to be 2 times 6, which is 12 times 2 is 24xh plus 24xh. So this is going to be equal to 20x squared plus 36xh. So this is going to be my cost. But I'm not ready to optimize it yet. We don't know how to optimize with respect to two variables. We only know how to optimize with respect to one variable, and maybe I'll say let's optimize with respect to x. But if we want to optimize with respect to x, we have to express h as a function of x. So how can we do that? How can we express h as a function of x? Well, we know that the volume has to be 10 cubic meters. So we know that x, the width times the length times 2x times the height times h needs to be equal to 10. Or another way of saying that, this tells us that 2x squared h, 2x squared times h needs to be equal to 10. And so if we want h as a function of x, we just divide both sides by 2x squared. And we get h is equal to 10 over 2x squared. Or we could say that h is equal to 5 over x squared. And then we can substitute back right over here. h is equal to 5 over x squared. So all of this business is going to be equal to 20 times x squared plus 36 times x times 5 over x squared. So our cost as a function of x is going to be 20x squared 36 times 5. Let's see, 30 times 5 is 150 plus another 30 is going to be 180. So it's going to be plus 180 times, let's see, x times x to the negative 2, 180x to the negative x to the negative 1 power. So we finally have cost as a function of x. Now we're ready to optimize. To optimize, we just have to figure out what are the critical points here and whether those critical points are a minimum or a maximum value. So let's see what we can do. So to find a critical point, we take the derivative, figure out where the derivative is undefined or equal to 0, and those are our candidate critical points. And then from the critical points we find, they might be minimum or maximum values. So the derivative of c of our cost with respect to x is going to be equal to 40 times x minus 180 times x to the negative 2 power. Now, this seems-- well it's defined for all x except for x equaling 0. But x equaling 0 is not interesting to us as a critical point because then we're going to have a degenerate. This is going to have no base at all. So we don't want to worry about that critical point. We would have no volume at all, so it would not work out. And actually, if x equals 0 then our height is undefined as well. So this was defined for everything else, for anything other than x equals 0. So let's see when this derivative is equal to 0 in our search for our potential critical points. So when does-- I'll do it over here. When does 40x minus 180x to the negative 2 equal 0? Well, we could add the 180x to the negative 2 to both sides. We get 40x is equal to 180. And I could write it as 180 over x squared. Now let's see. We could multiply both sides of this equation by x squared and we would get 40x to the third is equal to 180. Divide both sides by 40. You get x to the third is equal to 180 over 40, which is the same thing as 18 over 4, which is the same thing as 9 over 2. And so if we want to solve for x, we get that x is equal to a critical point. We get a critical point of x is equal to 9/2 to the 1/3 power, the cube root of 9/2. So let's see. Let's get an approximate value for what that is. So if we take 9/2, 9 divided by 2-- I guess you could call that 4.5-- and we want to raise it to the 1/3 power. To the 1/3 power we get 1.65. So it's approximately equal to 1.65 as our critical point. Now the way the problem is asked, we're only getting one legitimate critical point here. So that's probably going to be the x at which we achieve a minimum value. But let's use our second derivative test just in case to make sure that we're definitely concave upwards over here, in which case, this will definitely be the x value at which we achieve a minimum value. So the second derivative. I'll do it right over here. The second derivative of our cost function is just the derivative of this, which is going to be equal to 40 minus 180 times negative 2, which is negative 360. So it's going to be plus 360 over x to the 3. The derivative of this is negative 2 times negative 180, which is positive 360x to the negative 3 power, which is exactly this right over here. So when x is equal to 1.65, this is going to be positive. This is going to be positive. So let me write this down. c prime prime of 1.65 is definitely greater than 0. So we're definitely concave upwards when x is 1.65. Concave upwards, which means that our graph is going to look something like this. And so where the derivative equal to 0, which is right over there, we are at a minimum point. We are minimizing our cost. And so if we go back to the question, the only thing that we have to do now-- We know the x value that minimizes our cost. We now have to find the cost of the material for the cheapest container. So we just have to figure out what our cost is. And we already know what our cost is as a function of x, so we just have to put 1.65 into this equation. Evaluate the function at 1.65. So let's do that. Our cost is going to be equal to 20 times 1.65. I should say approximately equal to, because I'm using an approximation of this original value. 1.65 squared plus 180. I could say divided by 1.65. That's the same thing as multiplying by 1.65 to the negative 1. So divided by 1.65, which is equal to 163. I'll just say $163.5. So it's approximately. So the cost-- let me do this in a new color. We deserve a drum roll now. The cost when x is 1.65 is approximately equal to $163.54. So $163.54, which is quite an expensive box. So this is kind of expensive. This is fairly expensive material here. Although it's a fairly large box. 1.65 meters in width, and it's going to be twice that in length. And then you could figure out what its height is going to be. Although it's not going to be too tall. 5 divided by 1.65 squared. I don't know, it'll be roughly a little under two meters tall. So it actually is quite a large box made out of quite expensive material. The minimum cost to make this box is going to be $163.54.