We will go over the economics of demand functions for
different consumers and how to add them together to get aggregated demand
functions. At the end we will simulate
multiple identical consumers and how this will change the associated demand
functions, first let’s begin with two types of consumers. Consumer type 1 has a demand function of:

Q1 = 20 – 2P

And consumer type 2 has a demand function of:

Q2 = 48 – 6P

Adding these demand functions together into a single
equation is tricky because each consumer has a different maximum willingness to
pay (or value where the demand curve intersects the Y axis). The best way to do it is to have two separate
functions, one that is true when the price is between 8 and 10, and the other
where the price is lower than 8. Note
that nothing will be demanded when the price is greater than 10.

For example, Q (aggregate demand) = 20 – 2P when the price
is between 8 and 10 or 8<P<10 and 68 – 8P when the price is lower than or
equal to 8 or P<8.

The trick is that the second consumer enters the market at a
price of 8, so the curve will have kink in it at this point. Also note that the slope of the curve lower
than a price of 8 is the combined demand function of the two consumers so the
slope with be flatter than any of the individual consumers.

Now what happens if we have 200 type 1 consumers, and 100
type 2 consumers? I find the easiest way
to do this is to divide the quantities of the original demand functions by the number
of consumers to represent the specific fraction they are demanding. Then I multiply both sides by the number to
get rid of the fraction and the result is the aggregate demand. Here is the process for consumer 1:

Q1/200 = 20 – 2P now multiply both sides by 200 (to
represent the 200 consumers) to get:

Q1 = 4,000 – 400P and we have our aggregate demand for
consumer type 1.

For consumer type 2 we can follow a similar process:

Q2/100 = 48 – 6P and multiply both sides by 100 to get:

Q2 = 4,800 – 600P

We can find the amount of product that will be derived at
any given price by plugging in that price into these two demand equations and
then solving for q. For example, at a
price of 10, q will be 0 for both consumers (it will actually be negative for
type 2 but we ignore that). At a price
of 8, q will be 400 for type 1 and 0 for type 2, and a price of 4 it will be
2,400 for type 1 d 2,400 for type 2, and at a p of 0 q will be 4,000 for type 1
and 4,800 for type 2.