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

Fixed, variable, and marginal cost

Explore how to think about average fixed, variable, and marginal costs, and how to calculate them, using a firm's production function and costs in this video. Created by Sal Khan.

Want to join the conversation?

  • mr pink red style avatar for user Nick Devlin
    According to my economics course, average variable cost is of the same structure as average total cost, in that they both fall to a minimum before they rise again. In this video, AVC rises straight away.
    The reason my course materials give for this is that the marginal product of each unit of labour normally increases before it falls: so instead of the first two workers losing productivity when working together, at this stage it would increase.

    Does anyone know which is more accurate?
    (10 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Cameron
      It depends on the nature of the work:
      -If the workers are basically doing the same type of work, and then need to coordinate (i.e. they aren't really receiving a benefit to their work from the other workers, but instead are losing out on productivity through meetings and coordination) then you would expect the marginal product to fall straight away

      -However, suppose that the workers specialize. e.g. One worker builds chairs, and the other worker paints them. This would increase marginal productivity, because one worker wouldn't have to waste all his time setting up the spray booth, putting on a respirator, etc. for each chair. The additional worker would do this once for the day and then be productive painting all day.

      -Another scenario would be workers bring other skills or knowledge to the table that they share with the other workers that results in the other workers becoming more productive as individuals (they would be more productive as workers after, even if they left the team)

      So, basically, the answer is it depends on the nature of the work, and how the labour will be organized.
      (33 votes)
  • leaf green style avatar for user Rashedul Islam
    How does the law of diminishing marginal product affect the shape of the marginl cost curve?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • mr pants teal style avatar for user Wrath Of Academy
      Well as you can see from the last column in his spreadsheet, as the marginal productivity dropped, the marginal cost began to skyrocket. Eventually it became "negative", which sounds weird, but meant productivity is actually being sacrificed. (I'm not sure that's really a realistic scenario though. If you have more people than you know what to do with, you reassign them to do QA preparation, or brainstorm on future versions - things that wouldn't hinder productivity of the rest of the team.)
      (5 votes)
  • blobby green style avatar for user Giovanni Baca
    What is the difference between the short run and the long run and what is an example of each?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • male robot hal style avatar for user Enn
      Short run is the period when there are some fixed factors of production/inputs such as land, machinery etc which can not be changed while there are some variable factors such as labour which can vary. However in the long run all the factors of production/inputs are variable.
      (5 votes)
  • aqualine seedling style avatar for user vaishnavi rao
    It is said fixed costs exist only in short run.....
    Variable costs exist in both short and long run....why?
    PLease elaborate with an example..
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leafers tree style avatar for user Quack
      Fixed costs come from resources that can't be easily changed in the short run (ej a building). In the long run, producers can choose to build more buildings or leave their buildings (eliminating fixed costs). Fixed costs only exist in the short run b/c at least one factor of production is constrained in the short run (definition of short run). In both short run and long run, variable costs exists because producers have to put in inputs to get out products. Take for example, a bean factory. In the short run, the farmer who owns the bean factory is constrained to twenty acres of land. Even if the farmer doesn't produce any beans, he still has to pay for his land (an example of fixed costs). In the long run, the farmer can choose to rent more acres of land and grow more beans (both variable costs).
      (5 votes)
  • blobby green style avatar for user meckstroth.meghin28
    How do you find the fixed cost if you are not given it, or any information other than, units of output and total cost.
    (1 vote)
    Default Khan Academy avatar avatar for user
  • leafers ultimate style avatar for user Jerzy Meteor
    What about synergy Sal!? :)
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user cole sweetman
    why is Marginal Cost also the average? or does that mean it is the average amount of money being spent to add an additional unit?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user Enn
    Will the marginal cost equal the actual cost of producing an additional unit of output or is it an approximation ?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user macgregor.d
      In the theoretical model, yes, in the long-run the marginal cost is equal to the additional unit of output. This is because the foundations of the models taught are based in mathematics in order for practical study.

      It is hard to explain without complicated calculus but the cost of an additional unit only will truly equal the marginal cost when you impose a limit of infinity - which is a concept that is logically flawed.

      I had a hard time accepting a lot of the assumptions in foundational economics courses because they seemed to not fit with reality but after many, many, years of study I can tell you now that understanding the concept is the goal and the fact that it doesn't square with the real world is something you don't have to worry about unless you make economics your career.
      (2 votes)
  • blobby green style avatar for user Alley Paquin
    Does anyone know how to use Marginal Cost to calculate variable cost? (assuming you have the fixed cost, price, quantity, marginal cost, and total revenue)
    (1 vote)
    Default Khan Academy avatar avatar for user
  • marcimus purple style avatar for user annamaria
    How do you know, just by looking at the graph, that its in the long run or the short run?
    (1 vote)
    Default Khan Academy avatar avatar for user

Video transcript

We here at the Khan Academy are working on some type of a software project. And we need to think about what's the optimal number of programmers we should hire, at least think about how much productivity we're getting per programmer when we're working on this software project. And so what I've done over here-- this is a spreadsheet so I'm not going to be able to write. I'll only be able to type. This is Microsoft Excel right over here. In this column, I have the different numbers of programmers. And then let's say based on other studies or industry studies or our past experience, this tells us how many lines of programming code we can get per month. And obviously, lines of code isn't maybe the best way to measure things because someone can write good lines or bad lines of code. But let's just say this is one way of measuring productivity for software engineers. So the first thing I'm going to think about is what are my fixed costs? So what am I going to spend no matter how many software engineers I hire for this project? And for the sake of this video, my fixed costs will be the office space and the electricity and let's assume I just have an office that can accommodate any number of these programmers. So that's a fixed cost. That's not going to change depending on the number of programmers I have. And then the other fixed cost, let's say I have a product manager for this project. And I'm going to pay her salary to essentially help spec out what this software should actually do. So her salary is, let's say, $10,000 a month and then another $5,000 a month in office space for everybody. So it's going to come out to $15,000 a month. And that's not going to change regardless of however many programmers I have. So I'm going to go into Excel and go to this little bottom right right over here. And I'm going to drag that down. And so it's going to be $15,000 in fixed costs no matter how many programmers I end up hiring. Now the variable cost. Well, let's just say that the full compensation for a programmer is $10,000 a month. So if you include the cost of their salary, if you include the cost of their health insurance, you include the extra goodies that they will eat from the company kitchen, whatever it might be. So it's going to be $10,000 a month. So my variable my total variable costs are going to be $10,000 times the number of programmers. So here I'm going to write equals, and I'm going to write, it's going to be $10,000 per programmer times-- that little snowflake, I pressed Shift + 8 to get that snowflake-- times, and I could say times whatever is in that cell. So you see it's cell D7. And actually let me scroll this over so that you can see the cells. So that is cell D7. And let me press Enter. So it's $10,000 times D7, which is this one right over here. And I just selected that. And I can press Enter. And right now, that's nothing. Let me scroll over so we can see everything a little bit better. Let me scroll over a little bit. There you go. I'm having trouble. OK. There you go. Now, what are going to be my total costs? My total costs are my fixed costs plus my variable costs. So that's going to be equal to-- and I'm just using my arrow keys right now-- it's going to be equal to F7, right? That's cell F7 plus this one, plus my variable costs. My total costs are my fixed costs plus my variable costs. And so it's $15,000. And actually, I can make this true for every row over here. And this is one of the really useful things about a spreadsheet, is I defined this cell as being $10,000 times whatever this cell is right over here. And so what I can just do is I can just take that, drag that all the way down. And for every one of these, it's going to take $10,000 times the cell that's essentially three to its left. So now it's going to be 10,000 times D8. This will be 10,000 times D9. Let's get that. So that we can see it right there. 10,000 times D9. And you could, if you click on there, you can actually see what the formula is. 10,000 times D9. So by dragging that, I was able to get the right formula all the way down. Now the total cost for every row here is going to be two to the left plus one to the left. And so if I drag that down, it'll do that for every row over here. So now this is 25, is the 15 plus the 10. 105 is 15 plus 90,000. Our total costs are fixed costs plus variable costs. Now let's think about the average fixed cost. And the average fixed cost, we're going to think about it in fixed cost per line of code produced. And over here, line of code produced is 0. So we're going to divide by 0, which is undefined. So we could leave that blank. But we could fill this one in. So our total fixed costs-- this is going to be our total fixed costs, which is cell F8. I just used the arrow keys to select F8. Divided by our total lines of code per month. So divided by our total lines of code per month. And so that gets me $3.75 fixed costs per line of code. And then I can do the same thing that I've been doing before. I can drag this down. And then we see what the fixed cost is. So if at any given point if I take the fixed cost, $15,000, divided by the lines of code, I get $1.38. And this actually makes sense because the more programmers I add on to this project, the more lines of code I get, I'm using the same fixed costs I'm. Using the same project manager. I'm using the same office space. So the cost of that project manager and that office space gets spread out along more and more code. So the fixed cost per line of code goes down as we add more and more programmers. Now what is the average of variable cost? So once again, the variable cost is going to be whatever the variable cost is per lines of code per month. So when we're talking about average, we're talking about average cost per line of code. So this is per line of code. Let me write it over here. Per line of code. And I can even say per month. Per line of code per month. Actually, I wanted that spread out more. But the way I've set it up. So let me scroll down. Oops. I'm having issues here. All right. Well these are all average lines of code per month. And so let's think about what happens with our variable costs. So I'm also going to start here because I don't want to divide by 0. So in this month, our total variable costs were $10,000 and our total lines of code are going to be $4,000. G8 divided by E8. And so average variable cost per line of code is 2.50 . And then what happens? So let's do that for every row over here. So when we do it for every row, something interesting happens. Our average fixed cost went down because we're taking the same cost and we're spreading it out amongst more code. But our average variable cost went up. As we added more programmers, per line of code, it actually costs us a little bit more on average per line of code. And that's actually, if you look here, as we add the incremental lines of code we get per programmer is actually going down. That first programmer by themselves, she can write 4,000 lines of code. But then that second programmer you're not getting to 8,000, you're getting to 3,000. And probably because they have to coordinate with each other. They have to plan a little bit more. It's not all in one person's head. Then, when you're at the third one, you're not even adding 3,000 lines of code. You're only adding 2,000 lines of code. And this is actually a real phenomenon that actually happens in companies. The more people you add on to a project, obviously they can maybe do more work, but there's also more coordination. There's going to be more meetings. There's going to be more interruptions. And so each person's individual productivity is going to go down. And this isn't to say that this third coder is somehow worse than the first coder. On average, all of them are now only going to produce 3,000 lines of code a month, when maybe individually they could have each produced 4,000 lines of code, but they have to spend some of their energies now coordinating it. And so that's why our average variable cost per line of code is going up. As we add more and more people, incrementally it's becoming more and more expensive on average to write that line of code. And now if we look at average total cost, that's going to be-- and this is once again, this is per line of code-- is going to be our total cost, H8 divided by the total lines of code per month. So if we just hire one engineer, we're going to have $6.25 spent per line of code. And this is actually just the sum of these two right over here. And then, let me set that formula for every row. And so we see something interesting. When we start to hire a few engineers, we're able to spread out our fixed costs, even though our average variable cost per line of code are going up, our fixed costs are going down. So it's actually we're getting a little bit of a benefit because we're spreading our fixed cost per line of code. But then it starts to get expensive again because, as we said, the more people you have working on the project, they're going to have spend more time coordinating with each other and maybe even undoing each other's work or redoing each other's work as opposed to just writing the actual software. And now let's think about the marginal cost. The marginal cost, the best way to think about it is, what is the incremental cost of that next set of line of code? So one way to think about it-- so this is going to be how much more you're spending divided by how much more code you're getting. So for example, how much more-- and this is going to be, once again, per line of code. So when we go from zero programmers to one programmer, we're going from $15,000 of total cost to $25,000 of total cost. We do it in parentheses. If we're going from 15 to 25, that means we're increasing our expenditure by 25 minus 15. And so that's why I'm doing H8 minus H7. So that's how much more we're spending in expenditures. And then, how much more code are we getting? Well we're getting 4,000 minus 0 lines of code. And the reason why I'm doing the formula this way is so that when we drag it down on all the rows, the formula will be right because it's relatively taking the right cells into account. And the reason why I'm saying it's average is because this is saying, what's the incremental cost per line of code for this first 4,000 lines of code? And then we can go from there. And we can drag it down. And now this tells us the incremental cost per code for the next 3,000 lines of code. And once again, it got a little bit more expensive because we're getting a little bit less efficient as we add more and more people. And there's something very interesting that happens here. And you might have even noticed it in these numbers over here. We actually get a negative marginal cost. And this isn't meaning that when we add more lines of code somehow we're getting money. It's actually saying that as we spend more money, we're actually killing lines of code. Because at some point, if you have too many people on this one project team, they actually start killing each other's productivity. And you can even see it right here in the numbers. When we had seven people, we were able to write 11,400 lines of code. But then the eighth person, because of coordination-- it's not that this eighth person is incompetent, it's just when you have eight people on a team, everyone's productivity goes down so that you're only able to produce 11,200 lines of code. And that's why you had this negative marginal cost. Now, when you get to eight people, all of a sudden by spending more dollars, you're actually destroying some of what you were actually trying to produce. So what I wanted to do here is just to really get you behind the numbers and really maybe give you a little sense of how you can actually do this with a spreadsheet. And get you thinking a little bit about how a firm's cost structure might actually work.