Basic Principles

How to Calculate a Linear Demand Function

Updated Jun 26, 2020

In economics, supply and demand functions come in many shapes and sizes. However, for the sake of simplicity, we often assume they are linear. That makes it much easier to compute them, which in turn is important to analyze and understand many basic economic concepts (e.g., calculating consumer surplus). Therefore, linear demand functions are quite popular in econ classes (and quizzes). Luckily, calculating them is not rocket science. It follows a simple four-step process: (1) Write down the basic linear function, (2) find two ordered pairs of price and quantity, (3) calculate the slope of the demand function, and (4) calculate its x-intercept.

1) Write Down the Basic Linear Function

The most basic form of a linear function is y = mx + b. In this equation, m represents the slope of the function, whereas b is the point where the line intersects the y-axis (i.e., the y-intercept). However, in the case of the supply and demand diagram it’s important to note that the x and y axis are flipped. That means our independent variable (i.e., price) is on the y-axis, whereas the dependent variable (i.e., quantity) is on the x-axis. Therefore we’ll have to make some adjustments as we calculate our demand function. But for now, let’s look at a simple demand function for ice cream. We’ll call the basic demand function QD, where P is the price of ice cream. In that case, the basic linear function looks as follows: QD = mP + b.

2) Find Two Ordered Pairs of Price and Quantity

For the next step, we need some additional information. Particularly, we need to know the quantities demanded, for at least two different prices. With this information, we can create two ordered pairs in the form of (x1,y1) and (x2, y2). In most cases, this information will be provided in statements such as “At a price of y, demand is x” or “when the price falls to y, demand increases to x”.  In our example, consumers demand 1000 ice cream cones when the price is USD 2.00. However, when the price increases to USD 3.00, demand falls to 800 cones. Thus, the two ordered pairs are (1000,2) and (800,3).

3) Calculate the Slope of the Demand Function

Now that we have the two ordered pairs, we can use them to calculate the slope of the demand function. The slope can usually be computed as the change in price divided by the change in quantity demanded between the two pairs. However, because our axes are flipped (see above), we have to flip this formula as well. Therefore, we use the following formula to calculate our slope: m = (x x1)/(y– y1). Going back to our example, let’s plug in the two value pairs from above. This results in a slope of -200 ([800-1000]/[3-2]). Note that this demand curve has a negative slope, which means its graph slopes downward. As a rule of thumb, this will be the case for most demand curves.

4) Calculate the x-Intercept of the Demand Function

Next, we can update the primary function to include the actual slope (instead of m). That allows us to calculate the x-intercept (again, we don’t use the y-intercept because the axes are flipped) of the demand function by plugging in the values of one ordered pair and solving the resulting equation for b. In our example, that means we update our first linear function to include the slope: QD = -200P + b. Now we plug in the values of our first ordered pair (2, 1000), which results in the following equation: 1000 = (-200*2) + b. When we solve this for b, we find that the x-intercept is 1400. Hence, the demand function is QD = -200P + 1400.

5) Plug the Second Ordered Pair in to Validate your Result (Optional)

If you want to make sure you calculated everything correctly, you can use the second ordered pair to double-check your demand function. To do this, simply plug the values into the demand function and see if the equation is still correct. For example, let’s use the values of our second ordered pair (3, 800) to validate the demand function QD = -200P + 1400. The resulting equation is 800 = (-200*3) + 1400, which still holds true and thus validates our result.

In a Nutshell

For the sake of simplicity, we often assume that demand functions are linear. That makes it easier to compute them, which in turn is important to analyze and understand many basic economic concepts. Calculating linear demand functions follows a simple four-step process: (1) Write down the basic linear function, (2) find two ordered pairs of price and quantity, (3) calculate the slope of the demand function, and (4) calculate its x-intercept.