We discussed the idea that in a competitive market a firm will set the quantity sold such that price equals marginal cost. You might ask, well where did you come up with that decision rule? So let's do a little calculus here to understand why we have this decision rule that price should equal marginal cost is where we should set our quantity. Consider the following profit function. Profits equal simply revenues minus our variable costs minus our fixed costs, variable cost being, again, the cost for producing a certain number of goods, and the fixed cost being things we incur even before we sell our first good. Mathematically, we represent it using pi to represent profits. We have our revenues, which is our price times the quantity sold. We represent variable cost simply as a function of the quantity sold. So, C as a function of q1. And then we have our fixed cost, represented by CEF which is basically a fixed parameter within the model. So for those of you who have had calculus, you might remember to maximize an expression, an objective function. You take the derivative with respect to the decision variable you have and you set it equal to zero. Now our decision variable here is the quantity sold. Once again, we are price takers. We are given the price by the market. So we can just simply choose how many t-shirts, in our t-shirt example, we are likely to sell. Here is the math, we take the derivative, set it equal to zero and what we find is, the derivative for the revenue of piece, ends up being the price. We represent the derivative or cost function or variable cost function as simply as the derivative of the cost function with the c prime q1. The fixed costs fall out at this point, and once again we set it to zero. Moving things around, we get P1 should equal the derivative of our cost function. The derivative of our cost function, you might recall, is simply our marginal cost, hence giving us the decision rule to set quantity such that price equals marginal cost. And then, once again, it generates the following result that we see in our graph here. If you'd like to play around with it, you can move q1 around. And you'll find that what maximizes the size of the profits created in this case is placing q1 where we've placed it on the graph here.