Main content

## Production and costs in the short run

Current time:0:00Total duration:12:06

# Visualizing average costs and marginal costs as slope

## Video transcript

Voiceover: What I want to do in this video is look at the data from the last video and make sure we understand it in maybe a more visual way. What I've done is, in
this graph over here, I used the lines of code per month, so this right over here. I used this, or this was what I used on my horizontal axis, so I kind of, if you view it in terms of independent and dependent variables, I kind of made this the
independent variable now. Given a certain number of lines of code you want to produce per month, what is the fixed cost, the variable cost, and the total cost, so this is on this axis right over here. This is lines of code, lines of code per month per month, right over there, and then you see it
goes up to about 12,000, and we see that covers
the entire range of data that we would have to worry
about right over here. On the vertical axis, as I just alluded to, we are plotting the cost, so we're going to plot the fixed cost, the variable cost, and the total cost. We see that there in our little legend. The fixed cost, no matter how many lines
of code we've produced, this is a little bit different than the way we thought
about it in the last video. In the last video, we said, "How many programmers do we have, "and what is going to be our fixed cost, "our variable cost, our total cost?" Now we're thinking about it in terms of lines of code per month, but no matter how many lines of code per month we produce within reason, our fixed costs are the same, $15,000 per month for the office space, the food in the office, the water cooler, the project manager, things like that. We see it right over here. This pale green line,
that is our fixed cost. That is our fixed cost. No matter how many lines
of code we produce, we are using exactly $15,000 per month. This is $15,000 right over there. Then you have your variable costs in this orange color, so the variable costs in the orange color, and we can see how the points are plotted. When you have no lines of code per month, your variable costs are 0. That's this point right over there. When you have 4,000 lines of code, your variable costs are 10,000. That's that point right over there. When you have, let me pick up a random point over here, when you have 11,400
lines of code per month, your variable costs are 70,000. 11,400, let's see. This is about 11,000, 11,400, and your costs are $70,000. That's that point right over there. Then, finally, your total costs, or the sum of the fixed
plus the variable costs, and we've plotted this in this blue color, so the total costs, which is in blue right over here, it's really just the sum of
this green horizontal line and this orange line. Another way of thinking about it, take this orange line at any given point. That's the variable cost. Add the fixed cost, which is 15,000. It shifts you up to that blue line. So at any point, that
blue line is exactly, is exactly $15,000 higher. $15,000 higher than the orange line. You see it even over here, where it kind of bends back on itself. Then you're probably saying, "Well, why is it bending
back on itself like that?" And this goes straight
to what we talked about in the last video. That as we add more and more programmers, the average productivity
per programmer goes down because they have to
start meeting each other and coordinate with each other, and maybe they undo each other's work, and then there's some point at which, even when you add more resources, it actually decreases productivity. So we're adding more and more resources, and I don't have them plotted here, but we keep adding more
and more developers, and we get to this point where we're able to generate 11,400 lines of code per month, but then all of a sudden, as we add more developers, it still adds cost, because obviously they're
going to cost something. We have to pay their salaries and their insurance and all of that, but then our total productivity starts going down again. That's what we're seeing here when both the variable cost curve and our total cost curve
start curving back on itself. Now, with this plotted, what I want to think about visually, and especially in terms of slope, I encourage you to, if the term slope seems a
little bit foreign to you, there's tons of videos
on the idea of slope in the algebra playlist, but the slope is really
just how inclined a line is. For example, this line has a higher slope than this line right over there. That the way we measure it is our change in our vertical axis, so our change in our vertical axis, often given by a change in y, the triangles, that's the delta, Greek letter Δ, means change in Y divided by our change in, divided by our change
in our horizontal axis, that is change in X. So, slope is equal to Δy over Δx, and when you measure it this way, this line over here, it looks like it has about
the same change in x, but has a much lower change in y, lower change in y. So when you take this lower change in y divided by the same change in x, you're going to get a lower slope. If you had a line that
looked something like, if you had a line that looked something like this, then you have a much higher change in y, so your numerator is higher, a higher change in y, and you have a lower change in x. Your denominator's lower. That'll increase the
value of the quantity, so your change in x. This right over here is
going to be a high slope, a high slope. With that little primer out of the way on what a slope is, what I want to do is think about these average fixed costs, average variable costs, average total costs, and marginal costs in terms of slopes of these lines right over here. When you're looking at average, if we look at this point right over here, average fixed cost, $3.75. What that means is when we're producing 4,000 lines of code, 4,000 lines of code, our average fixed cost is $3.75, so I'm on the green line, actually. Let me use a green color right here. I'm on this green line right over here. To find that average, so that's our, that is our, that is our fixed cost. To find our average fixed cost, we want to divide our fixed cost, which is that height right over there. You want to divide it by
the total lines of code, and that gives us our fixed cost, our average fixed cost per line of code. We're taking a change in the vertical axis divided by our change in a
horizontal axis right there, so it's essentially giving
the slope of this line, just like that. It's giving the slope of that line, and that's this point right over here. When you go to this point right over here, you're saying, "Okay. "I'm producing 7,000 lines of code, "and it still costs me $15,000." That's $15,000. I divide my total change in fixed costs, divided by my or my total fixed cost divided by my total lines of code, divided by my total lines of code. I'm essentially getting the slope of, I know it's getting hard to see, the way I'm doing it. I'm essentially giving you the slope of, let me draw a little bit neater, this line right over here. You could see this line has a lower slope than the previous one, and that makes sense because the average fixed
cost per line of code should be going down. We have the same fixed cost and we're dividing it amongst more and more and more code. You can see if you go out here, and you do the slope from this point all the way over here, it's going to have even a little, even a lower slope, so let me clear this out of the way, so hopefully that makes sense. The fixed cost, at least for me, is maybe the easiest to understand. You're taking the same quantity, dividing it by more and more code, or by more and more developers. Now, the variable cost,
average variable cost, at any given point over here, we're taking the variable cost, and we're dividing it by
the total amount of code. So variable costs, over there it is $10,000, and we're dividing it
by 4,000 lines of code, so it is the slope of
this line right over here. When you go to 7,000 lines of code, you say, "Well, my total
variable cost is $20,000, "and I'm going to divide
it by 7,000 lines of code." So it is the slope of this
entire line right over here. I'm having trouble drawing these lines. It is the slope of this
line right over here. This is a curve, so the slope is different
here than it is over there. This line, when we're measuring the
average variable costs, we're measuring, you can imagine the average slope across from the beginning all
the way to this point right over here. Now, when you're doing
the average total cost, you're doing the same thing. The average total cost at that point is our total, total cost, so it's that, divided by, divided by the total code, so the total code. So it is the slope of this
line right over there. We see that, that slope,
when you start over here, when you start from this
point to that point, the slope goes down, but then we see the slope start going, it starts to go up again because we saw that the variables cost start increasing because we get less and less efficiency as we add more and more developers and attempt, at least, to write more code. Now, the marginal cost
is an interesting one. All of these other ones, we're taking our total cost, our total variable cost, our total total cost, our total fixed cost, and dividing by the total amount of code, so we're essentially
finding the slope of a line between these points and our origin. When you're doing the marginal cost, you're doing something different. Let me clear all of this out so that we can clear things up. Your marginal cost is you're measuring your change in total cost divided by, not your total total cost, you're doing your change in total cost divided by your change
in the lines of code. So, for example, that right over, let me do that in a more vibrant color. That marginal cost, that's at this point right over here, so let's say we're going to, we can do it with the variable cost curve or we could do it with
the total cost curve. i'll do it with the total cost curve, so it's this point right over here. What we're doing is, we're taking the change in total cost between the previous point. The previous point was there, so our change in total cost is just this part right over here, so this is our change in total cost, and we're dividing it by our change in the amount of code we produce. So we're dividing it by the change in, change in lines of code. So essentially, it's giving
us the slope of the line between the previous point
and the current point on the total cost curve. We could do it, so if we go right over here. Let me go to another arbitrary point that doesn't start from the beginning. Let's say we're looking
at this marginal cost. This was when we're talking about 10,600 lines of code, and our total cost was $65,000. So our total cost is $65,000, 10,600 lines of code. That's that point right over there. What this is measuring, it's our change in total cost since the last increment, so since the last increment, since the last point. It's our change in total cost. it's our change in total cost divided by the change in lines of code since the last point, so the change of lines
of code is just that, change in lines of code. Our marginal cost is this quantity divided by this quantity. It's the slope between these
two consecutive points. What the marginal cost is giving us, so I just want to make sure
we get everything clear, these average fixed, average variable, average total cost, that gives us a slope of the line between any of the points and the origin. The marginal cost is essentially giving us the slope of the curve between any two consecutive points on the total cost curve, or you could also view, because it's really just a shifted version of the variable cost curve, or you could do this as the same as the slope of the line between any two points on
the variable cost curve. This is an approximation you could do this as the average, and that's why I wrote average over here. This is the average slope of the curve between these two points.