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

# Visualizing average costs and marginal costs as slope

## Video transcript

what I want to do in this video is look at the data from the last video and make sure we understand it it may be a more visual way so what I've done is is in this graph over here I use the lines of code per month so this right over here I used I use 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 so 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 and on the vertical axis as I just alluded to we are plotting the costs so we're going to plot the fixed costs of variable costs and the total costs and we see that there in our little legend so the fixed costs no matter how many lines of code we produce and this is a little bit different than the way we thought about in the last video in the last video we said how many programmers do we have and what is going to be our fixed costs are variable costs or total costs now we're thinking about 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 watercooler the project manager things like that and we see it right over here this pale green line that is our fixed costs that is our fixed cost no matter how many lines of code we produce we are using exactly$15,000 per month so this is 15,000 right over there and 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 zero 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 academi pick up a random point over here when you have eleven thousand four hundred lines of code per month your variable costs are seventy thousand eleven thousand four hundred let's see this is about this is about eleven thousand eleven thousand four hundred and your costs are seventy thousand dollars that's that point right over there and then finally your total costs are the sum of the fixed plus the variable cost and we've plotted this in this blue color so the total costs int which is in blue right over here it's really just the sum of this green horizontal line and this orange line or another way of thinking about it take this orange line at any given point that's the that's the variable cost add the fixed cost which is fifteen thousand it shifts you up to that blue line so at any point the blue line is exactly is exactly fifteen thousand dollars higher fifteen thousand dollars higher than the orange line you see it even over here where it kind of bends back on itself and 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 had to keep we keep adding more and more developers and we get to this point where we're able to make generate eleven thousand four hundred 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 that but then our total productivity starts going down again and so that's what we're seeing here when this when both of the at both the variable cost curve and our total cost curve start start curving back on itself now with this plotted what I want to think about visually and especially in terms of slope and I encourage you to if if the if the term slope it seems a little bit foreign to you there's tons of videos on the idea of slope and the algebra playlist but the slope is really just how inclined a line is so for example this line has a higher slope than this line right over there and 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 that triangles that's the this Delta Greek letter Delta 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 change in Y over change in X and when you measure it this way this line over here it has looks like it has about the same change in X but it has a much lower change in Y lower 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 and if you had a line that looks something like if you had a line that looks 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 and so your denominator is lower that'll increase the value of the quantity so your change in X so this right over here is going to be a high slope a high slope so without that 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 cost in terms of slopes of this of these lines right over here so when you're looking at average if we look at this point right over here average fixed cost $3.75 what that means is well when we're producing 4 thousand lines of code four thousand 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 and to find that average so that's our that is our that is our that is our fixed cost it find our average fixed cost we want to divide our fixed costs which is which is that height right over there you want to divide it by the total lines of code and that gives us our fixed costs our average fixed cost per line of code so we're taking 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 7000 lines of code and it still cost me it still cost me $15,000 that's$15,000 I divide my I divide my total change in fixed costs divided by my or my my total fixed cost divided by my total 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 it a little bit neater this line right over here and you can 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 and you can see if you go out of 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 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 we it's over there it is 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 seven thousand 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 and this is a curve so the slope is different here than it is over there this lot when we're measuring the average variable cost 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 average total cost at that point is our total total costs 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 and we see that that slope it's when you start over here when you start 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 costs 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 the line between these points and our origin when you're doing the marginal cost you're doing something different and 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 could do it with thee we could do it with a variable cost curve or we could do it with the total cost curve I'll do it with a total cost curve so it's at this point right over here so what we're doing is we're doing 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 costs 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 this essentially is giving us the slope of the line between the previous point and the current point on the total cost curve and 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 so let's say we're looking at this marginal cost so this was when we're talking about ten thousand six hundred lines of code and our total cost was sixty five thousand dollars so our total cost is sixty five thousand dollars ten thousand six hundred lines of code so that's that point right over there and 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 so our marginal cost is that this quantity divided by this quantity it's the slope between these two consecutive points so 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 costs 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 view this as the same as the slope of the line between any two points on the variable cost curve so this is this is an approximation you could view 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