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: profit

Who knows, you may end up running a shoe factory one day.  So it might not be a bad idea to know how to maximize profits. Created by Sal Khan.

Want to join the conversation?

  • leafers ultimate style avatar for user JorgeAlberto Pardo Herrera
    What if there are more critical points in the function? The quadratic formula only gives 2 points, so how would you find the other C.P. without plugging in random numbers?
    (18 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user john
    Shouldn't Sal have checked the end behaviour of the graph first to see if there even was a maximum profit? If the graph tended towards infinity this method could have given an incorrect result right?
    (17 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user benjamin.dubreu
      It is a good question, and you are mathematically right.

      Now, since we deal with a factory, there are reasons to believe that past a certain point, the more you add to the production, the less it will yield. It's an economic phenomenon called "Law of diminishing returns".
      So the "bunch of consultants" who came with an equation for the costs couldn't have come up with an equation where the costs are always decreasing with an increase of the production, in the first place ^^

      And while this law makes intuitive sense (ask to much of somebody or something and you'll kill the goose with the golden eggs), you don't need to take it for granted. In fact, I don't think Sal didn't check the end behavior because he thought of it.

      Rather, I think he knew that the general shape of a -x^3 equation tells us that as x increases, y tends towards negative infinity. With time, the general shape of these equations will pop up in your mind as you do the math.

      I hope this helps as to why Sal "skipped" this step, even though you are right in pointing out that it could have been included.
      (Another reason can be that Sal doesn't like to do videos of more than ten minutes and this one was already ^^)
      (27 votes)
  • leafers tree style avatar for user James
    At , is that a local or absolute max?
    (8 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Dhruv
      Actually the global maximum depends on the interval in which it is to be checked. A plot of the functions depicts a maxima at the point and an infinite rise where x<0. Since you cannot make negative shoes, you must take the interval x>0. In this range the point is the global max. In x E R, there is no global maxima.
      (14 votes)
  • piceratops ultimate style avatar for user Firedrake969
    Why does Sal write the first critical point to the thousandths but the second one to the ten-thousandths?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • male robot donald style avatar for user SiddharthRao97
    Can we use calculus to optimize a relation between workforce and profit ? like for example with 100 workers how much shoes need to be manufactured for maximum profit ?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Shannon Daley
    Did you miss the 10x to find the profit? You only calculated the cost, I think... ?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user C.J. Haynes
    It seems to me that, with this equation for profit, by giving x an arbitrarily large negative value you could get as big a profit result as you wanted. Consider: -3x^3 + 6x^2 -200x when x=-1,000,000,000. Obviously you can't make negative shoes, but I'm surprised this issue didn't show up in the example. In another equation the endless increase may be on the side of positive x-values, which means any max would not be the value at which the most profit would be made.
    (4 votes)
    Default Khan Academy avatar avatar for user
  • mr pants teal style avatar for user Hunter Thompson
    Okay, so before Sal solved the problem, I paused the video and took my own crack at it. Now I'm a bit confused.

    While I agree with the solution derived in the video, why doesn't setting r(x) = c(x) work? That wouldn't give you profit, but the margin of profit, m(x), and setting it equal to zero would tell you at what point(s) making another shoe will incur more loss than profit. Solving it this way gives you the points x = -1, 0, and 6. The first two are out, so 6 is the answer. This can be verified by plugging 6 back into the second derivative of m(x) and getting a positive result, meaning this zero produces a minimum loss of profits (or another way of putting it is maximum gain).

    So...What gives? Why doesn't this actually jive with Sal's solution?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Creeksider
      I get 0, 1 and 5 with your method, not -1, 0 and 6. But the more significant problem with your approach is that you're finding the zeroes of total profit, not marginal profit. If you make 5,000 pairs of shoes, you have revenues of $50,000 and costs of $50,000 for zero profit. Make any more shoes than that and you'll have a loss.
      (5 votes)
  • leaf green style avatar for user bigmit2011
    When taking the second derivative using the value .4725, we find out that it's concave up. So isn't there a possibility that if the function continues to rise, we can have point on the graph that represents that maximum value?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • starky tree style avatar for user Hortência
    Why does he put 3.528 if the calculate was 3.527?
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

You've opened up a shoe factory and you're trying to figure out how many thousands of pairs of shoes to produce in order to optimize your profit. And so let's let x equal the thousands of pairs produced. Now let's think about how much money you're going to make per pair. Actually, let me say how much revenue, which is how much you actually get to sell those shoes for. So let's write a function right here. Revenue as a function of x. Well, you have a wholesaler who's willing to pay you $10 per pair for as many pairs as you're willing to give him. So your revenue as a function of x is going to be 10 times x. And since x is in thousands of pairs produced, if x is 1, that means 1,000 pairs produced times 10, which means $10,000. But this will just give you 10. So this right over here is in thousands of dollars. So if x is 1, that means 1,000 pairs produced. 10 times 1 says r is equal to 10, but that really means $10,000. Now, it would be a nice business if all you had was revenue and no costs. But you do have costs. You have materials, you have to build your factory, have to pay your employees, you have to pay the electricity bill. And so you hire a bunch of consultants to come up with what your cost is as a function of x. And they come up with a function. They say it is the number of the thousands of pairs you produce cubed minus 6 times the thousands of pairs you produce squared plus 15 times the thousands of pairs that you produce. And once again, this is also going to be in thousands of dollars. Now, given these functions of x for revenue and cost, what is profit as a function of x going to be? Well, your profit as a function of x is just going to be equal to your revenue as a function of x minus your cost as a function of x. If you produce a certain amount and let's say you bring in, I don't know, $10,000 of revenue and it costs you $5,000 to produce those shoes, you'll have $5,000 in profit. Those numbers aren't the ones that would actually you would get from this right here. I'm just giving you an example. So this is what you want to optimize. You want to optimize p as a function of x. So what is it? I've just said it here in abstract terms, but we know what r of x is and what's c of x. This is 10x minus all of this business. So minus x to the third plus 6x squared minus 15x. I just subtracted x squared, you subtract 6x squared it becomes positive, you subtract a 15x it becomes negative 15x, and then we can simplify this as-- let's see, we have negative x to the third plus 6x squared minus 15x plus 10x, so that is minus 5x. Now if we want to optimize this profit function analytically, the easiest way is to think about what are the critical points of this profit function and are any of those critical points minimum points or maximum points? And if one of them is a maximum point, then we can say, well, let's produce that many. That is going to be-- we will have optimized or we will figure out the quantity we need to produce in order to optimize our profit. So to figure out critical points, we essentially have to find the derivative of our function and figure out when does that derivative equal 0 or when is that derivative undefined? That's the definition of critical points. So p prime of x is going to be equal to negative 3x squared plus 12x minus 5. And so this thing is going to be defined for all x. So the only critical points we're going to have is when the first derivative right over here is equal to 0. So negative 3x squared plus 12x minus 5 needs to be equal to 0 in order for x to be a critical point. So now we just have to solve for x. And so we just are essentially solving a quadratic equation. Just so that I don't have as many negatives, let's multiply both sides by negative 1. I just like to have a clean first coefficient. So if we multiply both sides by negative 1, we get 3x squared minus 12x plus 5 is equal to 0. And now we can use the quadratic formula to solve for x. So x is going to be equal to negative b, which is 12, plus or minus the square root. I always need to make my radical signs wide enough. The square root of b squared, which is 144, minus 4 times a, which is 3, times c, which is 5. All of that over 2a. So 2 times 3 is 6. So x is equal to 12 plus or minus the square root of, let's see, 4 times 3 is 12 times 5 is 60. 144 minus 60 is 84. All of that over 6. So x could be equal to 12 plus the square root of 84 over 6 or x could be equal to 12 minus the square root of 84 over 6. So let's figure out what these two are. And I'll use a calculator. I'll use the calculator for this one. So I get, let's see, 12 plus the square root of 84 divided by 6 gives me 3.5-- I'll just say 3.53. So approximately 3.-- Actually, let me go one more digit, because I'm talking about thousands. So let me say 3.528. So this would literally be 3,528 shoes, because this is in thousands, or pairs of shoes. And then let's do the situation where we subtract. And actually we can look at our previous entry and just change this to a subtraction. Change that to not a negative sign, a subtraction. There you go. And we get 0.4725. Let me remember that. 0.4725. Approximately equal to 0.4725. I have a horrible memory, so let me review that I wrote the same thing. 4725. Yep. All right. Now these are all we know about these, or these are both critical points. These are points at which our derivative is equal to 0. But we don't know whether they're minimum points, they're points at which the function takes on a minimum value, a maximum value, or neither. To do that, I'll use the second derivative test to figure out if our function is concave upwards or concave downwards or neither at one of these points. So let's look at the second derivative. So p prime prime of x is going to be equal to negative 6x plus 12. And so if we look at-- let me make sure I have enough space. So if we look at p prime prime of 3.528. So let's see if I can think this through. So this is between 3 and 4. So if we take the lower value, 3 times negative 6 is negative 18 plus 12 is going to be less than 0. And if this was 4 it'd be even more negative, so this thing is going to be less than 0. Don't even have to use my calculator to evaluate it. Now what about this thing right over here? 0.47. Well, 0.47, that's roughly 0.5. So negative 6 times 0.5 is negative 3. This is going to be nowhere close to being negative. This is definitely going to be positive. So p prime prime of 0.4725 is greater than 0. So the fact that the second derivative is less than 0, that means that my derivative is decreasing. My first derivative is decreasing when x is equal to this value, which means that our graph, our function, is concave downwards here. And concave downwards means it looks something like this. And so you can see what it looks something like that, the slope is constantly decreasing. So if you have an interval where the slope is decreasing and you know the point where the slope is exactly 0, which is where x is equal to 3.528, it must be a maximum. So we actually do take on a maximum value when x is 3.528. On the other side we see that over here we're concave upwards. The graph will look something like this over here. And if the slope is 0 where the graph looks like that, we see that that is a local minimum. And so we definitely don't want to do this. We would produce 472 and 1/2 units if we were looking to minimize our profit, maximize our loss. So we definitely don't want to do this. But let's actually think about what our profit is going to be if we produce 3.528 thousands of shoes, or 3,528 shoes. Well, to do that we just have to input it back into our original profit function right over here. So let's do that. So I get my calculator out. So my original profit function is right over there. So I want to be able to see that and that. So I get negative 3.528 to the third power plus 6 times 3.528 squared minus 5 times 3.528 gives me-- and we get a drum roll now-- gives me a profit of 13.128. So let me write this down. The profit when I produce 3,528 shoes is approximately equal to or it is equal to, if I produce exactly that many shoes, it's equal to 13.128. Or actually it's approximately, because I'm still rounding 13.128. So if I produce 3,528 shoes in a given period, I'm going to have a profit of $13,128. Remember, this right over here is in thousands, this right over here is 13.128 thousands of dollars in profit, which is $13,128. Anyway, we are now going to be rich shoe manufacturers.