# How to Calculate a Linear Demand Function

| Updated Feb 28, 2019

In economics, supply and demand functions come in many shapes and sizes. However, for the sake of simplicity we often assume they are linear. This 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 y-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-intersect). To give a simple example, let’s calculate a demand function for ice cream. In that case, we’ll call the basic demand function QD, where P is the price of ice cream. Thus, 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. More specifically, 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 x, demand is y”, or “when price falls to x, demand increases to y”.  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 (2, 1000) and (3, 800).

## 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 be computed as the change in price divided by the change in quantity demanded between the two pairs. That means, we can use the following formula: m = (y y1)/(x x1). 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 y-Intercept of the Demand Function

Next we can update the initial function to include the actual slope (instead of m). This allows us to calculate the y-intersect 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 initial 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 y-intercept is 1400. Hence, the demand function is QD = -200P + 1400.

## 5) Plug in the Second Ordered Pair 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. This 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 y-intercept.