Economists and manufacturers study demand functions to see the effects of different prices on the demand for a product or service. To calculate it, you need at least two data pairs that show how many units are bought at a particular price. In its simplest form, the demand function is a straight line. Manufacturers interested in maximizing revenues use the function to help set production levels that yield the most profits.

1. Pair Sales to Selling Price

Pair the amount of sales to the selling price. For example, a blueberry farmer might sell 10 quarts at Market 1 at $2.50 each and 5 quarts at Market 2 at $3.75 each. The two ordered data pairs are (10 quarts, $2.50 per quart) and (5 quarts, $3.75 per quart).

2. Calculate the Slope

Calculate the slope of the line connecting the data points as they would lie on a graph of price versus sales. In this example, the slope is the change in price divided by the change in quantity sold, in which the numerator is ($2.50 minus $3.75) and the denominator is (10 quarts minus 5 quarts). The resulting slope is $-1.25/5 quarts, or $-0.25 per quart. In other words, for every 25-cent increase in price, the farmer expects to sell one less quart.

3. Derive the Demand Function

Derive the demand function, which sets the price equal to the slope times the number of units plus the price at which no product will sell, which is called the y-intercept, or "b." The demand function has the form y = mx + b, where "y" is the price, "m" is the slope and "x" is the quantity sold. In the example, the demand function sets the price of a quart of blueberries to be y = (-0.25x) + b.

4. Plug in Ordered Pairs

Plug one ordered data pair into the equation y = mx + b and solve for b, the price just high enough to eliminate any sales. In the example, using the first ordered pair gives $2.50 = -0.25(10 quarts) + b. The solution is b = $5, making the demand function y = -0.25x + $5.

5. Apply the Demand Function

Apply the demand function. If the farmer wants to sell 7 quarts of blueberries at each market, she figures the price equal to ($-0.25)(7 quarts) + $5, or $3.25 per quart.


You can calculate more sophisticated versions of the demand curve by using more data and running a linear regression, which produces a slope that best fits the data. You might find the relationship between price and demand is not a straight line, but is best described by a curve.


The example is idealized and, in reality, it might be difficult for a manufacturer to test the effects of different prices on demand. One strategy is to label the same product with different brand names that sell at different price points. Producers of commodities, such as foods, metals, oil or nails, might be able to collect competitor data to help figure the demand function.