Drag the curves, rotate them with the round handles, or use the shifters. Add a tax, subsidy, price control or quota and watch the surplus areas change.
More: revenue, total surplus, incidence, elasticities
The law of demand and the law of supply
A demand curve shows the quantity buyers are willing and able to purchase at each price, holding everything else constant (ceteris paribus). The law of demand says quantity demanded falls as price rises: the curve slopes down because of the substitution effect (other goods become relatively cheaper) and the income effect (a higher price reduces purchasing power). A supply curve shows the quantity sellers offer at each price; it slopes up because higher prices cover the rising marginal cost of producing more and draw in new producers.
In the lab the linear curves are written in inverse form, price as a function of quantity:
The default tomato market has $P = 180 - 1.6Q$ and $P = 40 + 1.2Q$, with $P$ in KES per kg and $Q$ in tonnes per day. Because 1 tonne is 1,000 kg, an area of "KES per kg × tonnes" is measured in thousands of shillings (KES '000).
Movements along versus shifts of a curve
A change in the good's own price moves the market along a curve (a change in quantity demanded or supplied). A change in anything else shifts the whole curve (a change in demand or supply):
Income (normal goods rise, inferior goods fall), tastes and preferences, the number of buyers, prices of substitutes and complements, and expectations of future prices.
Input costs (fuel, fertiliser, wages), technology and growing conditions, the number of sellers, taxes and subsidies, and sellers' expectations of future prices.
An input-cost rise shifts supply up by the extra cost per unit; better technology or more sellers shift it right. The number of buyers or sellers scales a curve multiplicatively (twice as many farmers offer twice as much at every price), so it also changes the slope.
Equilibrium
The market clears where quantity demanded equals quantity supplied. For linear curves:
Above $P^*$ there is excess supply (a surplus) and sellers cut prices; below it there is excess demand (a shortage) and buyers bid prices up. The live market game shows this adjustment emerging from individual offers.
Consumer and producer surplus
Consumer surplus (CS) is the gap between what buyers would have been willing to pay and what they actually pay, summed over all units: the area below the demand curve and above the price. Producer surplus (PS) is the area above the supply curve and below the price sellers receive.
For straight lines these are triangles: $CS = \tfrac12 Q^*(a_d - P^*)$ and $PS = \tfrac12 Q^*(P^* - a_s)$. A competitive market maximises total surplus $CS + PS$; any policy that moves quantity away from $Q^*$ creates a deadweight loss (DWL), the value of trades that would have benefited both sides but no longer happen.
Elasticity
The price elasticity of demand measures how strongly quantity responds to price:
For a discrete change use the midpoint (arc) method, which gives the same answer whichever direction you move:
Demand is elastic when $|\varepsilon_d| > 1$, inelastic when $|\varepsilon_d| < 1$ and unit elastic when $|\varepsilon_d| = 1$. Along a linear demand curve the slope is constant but elasticity is not: $\varepsilon_d = -\frac{1}{b_d}\frac{P}{Q}$ runs from $-\infty$ at the price axis to 0 at the quantity axis, passing through $-1$ at the midpoint $Q = a_d/(2b_d)$, $P = a_d/2$.
Total revenue and the midpoint rule
Total revenue is $TR = P \times Q$, the rectangle under the demand curve. Since $\frac{dTR}{dQ} = P\left(1 + \frac{1}{\varepsilon_d}\right)$:
- On the elastic upper half, cutting the price raises revenue.
- On the inelastic lower half, raising the price raises revenue.
- Revenue is maximised at the midpoint, where demand is unit elastic.
Switch on "Elasticity & total revenue" and drag the yellow point along the demand curve to see the rectangle and the revenue hump in the inset.
Taxes, subsidies and incidence
A per-unit tax $t$ drives a wedge between the price buyers pay $P_b$ and the price sellers keep $P_s$, with $P_b - P_s = t$. Who legally pays the tax does not matter: shifting supply up by $t$ (sellers pay) or demand down by $t$ (buyers pay) gives the same $P_b$, $P_s$ and $Q$. The economic burden (incidence) falls on the less elastic side. For small taxes:
(For linear curves the exact shares are $b_d/(b_d+b_s)$ for buyers and $b_s/(b_d+b_s)$ for sellers.) Government revenue is $tQ_t$ and the deadweight loss is approximately the triangle $\tfrac12\, t\,(Q^* - Q_t)$. A subsidy works in reverse: quantity rises above $Q^*$, the government pays $sQ_s$, and the extra units are worth less to buyers than they cost to produce, which is again a deadweight loss.
Price controls and quotas
- Price ceiling (maximum price) below $P^*$: quantity traded falls to $Q_s(P_c)$ and a shortage $Q_d(P_c) - Q_s(P_c)$ appears. Queues, black markets or rationing follow. The lab assumes the scarce units go to the buyers who value them most; real rationing is usually worse.
- Price floor (minimum price) above $P^*$: quantity traded falls to $Q_d(P_f)$ and a surplus $Q_s(P_f) - Q_d(P_f)$ goes unsold (unless the government buys it).
- Quota below $Q^*$: buyers pay $P_d(Q_q)$, the marginal cost is only $P_s(Q_q)$, and the difference times the quota is a quota rent earned by whoever holds the licences. A quota of $Q_t$ has exactly the same prices and DWL as the tax $t$; only who collects the wedge differs.
A control that does not bind (a ceiling above $P^*$, a floor below it, a quota above $Q^*$) has no effect.
Introduction to market failure
The welfare results above assume a competitive market with full information and no spillovers. Markets can fail to maximise social welfare because of externalities (pollution from a factory is a cost not on its supply curve), public goods (street lighting is non-rival and non-excludable, so it is under-supplied), information asymmetry (a used-car seller knows more than the buyer) and market power (a monopolist restricts output to raise price). In those cases a well-designed tax, subsidy or regulation can raise total surplus, which is why "taxes always cause deadweight loss" is only true in a market that was efficient to begin with.
Example 1: Equilibrium and surplus (default market)
Demand $P = 180 - 1.6Q$, supply $P = 40 + 1.2Q$.
- Set equal: $180 - 1.6Q = 40 + 1.2Q \Rightarrow 2.8Q = 140 \Rightarrow Q^* = 50$ tonnes/day.
- Price: $P^* = 180 - 1.6(50) = 100$ KES/kg.
- $CS = \tfrac12 \times 50 \times (180 - 100) = 2{,}000$ (KES '000/day, i.e. KES 2 million).
- $PS = \tfrac12 \times 50 \times (100 - 40) = 1{,}500$. Total surplus $= 3{,}500$.
Press "Default market" in the lab: the stats panel shows exactly these values.
Example 2: A KES 28 per kg tax
- With the tax, $P_b - P_s = 28$: $(180 - 1.6Q) - (40 + 1.2Q) = 28 \Rightarrow 2.8Q = 112 \Rightarrow Q_t = 40$.
- Buyers pay $P_b = 180 - 1.6(40) = 116$; sellers keep $P_s = 40 + 1.2(40) = 88$.
- Incidence: buyers bear $116 - 100 = 16$ (57.1 %), sellers bear $100 - 88 = 12$ (42.9 %). Check: $b_d/(b_d+b_s) = 1.6/2.8 = 0.571$.
- Revenue $= 28 \times 40 = 1{,}120$; $DWL = \tfrac12 \times 28 \times (50 - 40) = 140$.
- $CS = \tfrac12 \times 40 \times 64 = 1{,}280$, $PS = \tfrac12 \times 40 \times 48 = 960$. Check: $1280 + 960 + 1120 + 140 = 3{,}500$, the original total surplus.
Try "Levied on buyers": the curve that moves changes, but every number stays the same.
Example 3: Elasticity at the equilibrium
- Point elasticity of demand: $\varepsilon_d = -\frac{1}{1.6}\times\frac{100}{50} = -1.25$ (elastic).
- Supply: $\varepsilon_s = \frac{1}{1.2}\times\frac{100}{50} = 1.67$.
- Midpoint of demand: $Q = 180/3.2 = 56.25$, $P = 90$, so revenue peaks at $TR = 90 \times 56.25 = 5{,}062.5$ versus $100 \times 50 = 5{,}000$ at equilibrium. Because demand is elastic at $P^* = 100$, a small price cut would raise sellers' revenue.
- A caution: these default curves are chosen for clean arithmetic. Measured short-run demand for tomatoes and other staple foods is usually inelastic ($|\varepsilon_d|<1$), which is why poor harvests tend to raise farm revenue in practice (see the "Inelastic + tax" preset and the Real world tab).
- Arc elasticity from $P = 100$ to $P = 116$ ($Q$: 50 to 40): $\dfrac{-10/45}{16/108} = \dfrac{-0.222}{0.148} = -1.50$.
Example 4: Price ceiling and quota
- Ceiling at KES 88: $Q_d = (180-88)/1.6 = 57.5$, $Q_s = (88-40)/1.2 = 40$, shortage $= 17.5$ t/day.
- Only 40 t trade, so $DWL = \tfrac12 \times (116 - 88) \times 10 = 140$, the same as the tax. Consumers who get tomatoes gain: $CS = \tfrac12\times 40\times(180-116) + 40\times(116-88) = 1{,}280 + 1{,}120 = 2{,}400$.
- Quota of 40 t: buyers pay $P_d(40) = 116$, marginal cost is $P_s(40) = 88$, quota rent $= 28 \times 40 = 1{,}120$: identical to the tax revenue in Example 2.
Example 5: A drought
Set "Technology & growing conditions" to −4: each step removes 3 t/day of supply at every price, so supply shifts left by 12 t: $Q_s = (P-40)/1.2 - 12$, i.e. $P = 54.4 + 1.2Q$.
- $180 - 1.6Q = 54.4 + 1.2Q \Rightarrow Q = 125.6/2.8 = 44.86$ t/day.
- $P = 180 - 1.6(44.86) = 108.2$ KES/kg: price up 8.2 %, quantity down 10.3 %.
- Sellers' revenue: $108.2\times 44.86 = 4{,}855$ versus 5,000 before. With elastic demand a supply shock lowers farm revenue; with inelastic demand (try the "Inelastic + tax" curves) it would raise it.
Challenges tick themselves off when the lab reaches the target. Default curves are assumed unless stated.
Guided experiments
- Incidence does not depend on who pays. Choose Tax, KES 28. Toggle between "Levied on sellers" and "Levied on buyers". Record $P_b$, $P_s$ and $Q$ each time. Explain why they are identical.
- Elasticity decides the burden. Press "Inelastic + tax", then "Elastic + tax". Compare the buyers' share and the size of the DWL triangle. Which tax raises more revenue with less distortion?
- Shifts versus movements. Raise household income to +20 %. Then switch the good to "inferior". Describe what happens to $P^*$ and $Q^*$ in each case.
- Price controls under stress. Apply "Drought", then add a ceiling at the old price of KES 100. Measure the shortage. Then remove the ceiling and see how much the price must rise to clear the market.
- The midpoint rule. Turn on "Elasticity & total revenue". Drag the yellow point from the top of the demand curve to the bottom and watch the TR rectangle grow then shrink. Where is it largest?
- Emergent equilibrium. Open the Live market game. Let it run for 5 days and note the daily average price. Trigger "Drought" and record how many days the price takes to settle at the new equilibrium.
Where these ideas show up
Why market experiments matter
From 1956 Vernon Smith ran classroom double auctions in which each student knew only their own valuation or cost (published in 1962). Prices still converged quickly to the competitive equilibrium, work recognised by the 2002 Nobel memorial prize. Later computer studies (Gode and Sunder's "zero-intelligence" traders, 1993) showed that even very simple trading rules produce near-efficient outcomes in a double auction. The Live market game uses adaptive traders of this kind (a simplified version of Cliff's 1997 "ZIP" rule): each trader nudges its price towards recent trades but never bids above its valuation or asks below its cost.
The scenarios are illustrative and simplified. Figures are not real market data and nothing on this page is investment or trading advice.