Supply & Demand Curve Simulator Back
Economics / Microeconomics

Supply & Demand Curve Simulator

Shift demand and supply curves in real time to visualize changes in equilibrium price and quantity. Explore price elasticity, consumer surplus, producer surplus, and deadweight loss interactively.

Market Parameters

Demand curve D: P = a − b·Q
Demand intercept a
Demand slope b
Supply curve S: P = c + d·Q
Supply intercept c
Supply slope d
Price ceiling
0 = no ceiling. Current: None
Preset market
Results
Equilibrium price P*
50.0
price units
Equilibrium quantity Q*
25.0
Unit
Consumer surplus CS
625
price units
Producer surplus PS
469
price units
Total surplus TS
1094
price units
Shortage / surplus
Equilibrium
Main
Elast
Theory & Key Formulas

Demand: $P = a - bQ$
Supply: $P = c + dQ$
Equilibrium: $a - bQ^* = c + dQ^*$
$Q^* = \dfrac{a - c}{b + d},\quad P^* = a - bQ^*$

Supply and Demand — How Are Market Prices Determined?

🙋
Professor, I hear on the news things like "oil prices went up" or "the weak yen made gas more expensive." How are prices actually determined? It's not like someone just decides on a price, right?
🎓
Right, in a free market no one decides. The point where the "demand curve" and "supply curve" intersect—the equilibrium point—naturally sets the price. The demand curve is a downward-sloping line: the higher the price, the less people buy. The supply curve is upward-sloping: the higher the price, the more producers want to sell. Where these two lines cross gives us the equilibrium price $P^ $ and equilibrium quantity $Q^ $.
🙋
So, like during COVID when masks ran out—why did that happen?
🎓
That's a case where demand surged, shifting the demand curve to the right. Normally, the price would rise and restore equilibrium, but if prices spike too fast, it's criticized as "price gouging," and governments may impose price ceilings. If the ceiling is set below the equilibrium price, you get excess demand (shortage) where quantity demanded > quantity supplied. Try the "price ceiling preset" in the simulator.
🙋
I often see the terms "consumer surplus" and "producer surplus." What are they?
🎓
Consumer surplus is the sum of "maximum price you'd pay − actual price." For example, if you're willing to pay up to $500 for a smartphone but get it for $300, you've gained $200. It's represented by the triangular area between the demand curve and the equilibrium price. Producer surplus is the sum of "price received − production cost," shown as the area between the supply curve and the equilibrium price. The sum of both—total social surplus—is maximized at the efficient equilibrium point.
🙋
So price controls reduce social surplus? I've also heard the term "deadweight loss."
🎓
Exactly. Price ceilings or taxes move the transaction quantity away from equilibrium, causing part of the surplus to vanish as "deadweight loss"—a loss to society as a whole. However, in reality, if the market isn't perfectly competitive (e.g., monopolies or externalities exist), the market equilibrium may not be socially optimal. Check out the surplus analysis tab to compare scenarios with and without regulation.

Frequently Asked Questions

What causes the demand curve to shift?
Main factors shifting the demand curve right (increase in demand): ① Increase in income (for normal goods), ② Rise in price of substitutes, ③ Change in consumer preferences (trends), ④ Population growth, ⑤ Expectations of future price increases. A left shift (decrease in demand) is the opposite. It's important to distinguish between "movement along the curve" due to price changes and "shift of the curve itself" due to other factors.
What is price elasticity?
Price elasticity of demand $e_d = -\dfrac{\Delta Q/Q}{\Delta P/P}$ (the percentage change in quantity demanded for a 1% price change). If $|e_d| \gt 1$ (elastic), demand is price-sensitive (luxury goods or goods with many substitutes). If $|e_d| \lt 1$ (inelastic), demand is price-insensitive (necessities or goods with few substitutes). Gasoline and medicine tend to be inelastic; travel and luxury goods tend to be elastic.
Why do price ceilings cause shortages?
When a price ceiling is set below the equilibrium price, consumers want to buy more because it's cheap (increased quantity demanded), while producers reduce supply because profits are lower. The result is excess demand (quantity demanded > quantity supplied), leading to empty shelves. Similar effects occur with rent controls, gasoline price caps, and ticket resale regulations.
How do you calculate consumer and producer surplus?
For a linear demand curve $P = a - bQ$ and linear supply curve $P = c + dQ$:
Equilibrium $Q^* = (a-c)/(b+d)$, $P^* = a - bQ^ $
Consumer surplus $CS = \frac{1}{2}(a - P^
) \cdot Q^ $ (triangle between the demand curve's y-intercept and $P^ $)
Producer surplus $PS = \frac{1}{2}(P^* - c) \cdot Q^ $ (triangle between the supply curve's y-intercept and $P^ $)
Isn't the real market more complex than this?
You're right. This model assumes an ideal "perfectly competitive market." In reality, there are various "market failures" such as ① oligopoly/monopoly by a few firms, ② information asymmetry (buyers and sellers have different information), ③ externalities (production/consumption affects third parties), and ④ public goods (non-excludable and non-rival). Still, the supply-demand model is the most fundamental framework for understanding price mechanisms and is widely used in economic policy analysis.

What is Supply & Demand Curve?

Supply & Demand Curve is a fundamental topic in engineering and applied physics. This interactive simulator lets you explore the key behaviors and relationships by directly manipulating parameters and observing real-time results.

By combining numerical computation with visual feedback, the simulator bridges the gap between abstract theory and physical intuition — making it an effective learning tool for students and a rapid-verification tool for practicing engineers.

Physical Model & Key Equations

The simulator is based on the governing equations behind Supply & Demand Curve Simulator. Understanding these equations is key to interpreting the results correctly.

Each parameter in the equations corresponds to a slider in the control panel. Moving a slider changes the equation's solution in real time, helping you build a direct connection between mathematical expressions and physical behavior.

Real-World Applications

Engineering Design: The concepts behind Supply & Demand Curve Simulator are applied across mechanical, structural, electrical, and fluid engineering disciplines. This tool provides a quick way to estimate design parameters and sensitivity before committing to full CAE analysis.

Education & Research: Widely used in engineering curricula to connect theory with numerical computation. Also serves as a first-pass validation tool in research settings.

CAE Workflow Integration: Before running finite element (FEM) or computational fluid dynamics (CFD) simulations, engineers use simplified models like this to establish physical scale, identify dominant parameters, and define realistic boundary conditions.

Common Misconceptions and Points of Caution

Model assumptions: The mathematical model used here relies on simplifying assumptions such as linearity, homogeneity, and isotropy. Always verify that your real system satisfies these assumptions before applying results directly to design decisions.

Units and scale: Many calculation errors arise from unit conversion mistakes or order-of-magnitude errors. Pay close attention to the units shown next to each parameter input.

Validating results: Always sanity-check simulator output against physical intuition or hand calculations. If a result seems unexpected, review your input parameters or verify with an independent method.

How to Use

  1. Adjust the demand curve slider (lbl-a) to shift consumer preference left or right, observing how equilibrium price and quantity respond in real time
  2. Use the supply curve slider (lbl-b) to model production cost changes, tariffs, or technology improvements that alter market supply at each price point
  3. Manipulate the price elasticity parameter (lbl-c) to test scenarios ranging from perfectly inelastic goods (salt, insulin at 0.2) to elastic categories (luxury cars at 1.8), noting how steep or flat curves affect surplus distribution

How to Use

  1. Adjust the demand intercept a to shift consumer willingness-to-pay up or down, observing how equilibrium price and quantity respond in real time
  2. Use the supply intercept c and slopes b, d to model production cost changes, tariffs, or technology improvements that alter market supply at each price point
  3. Change the slopes to test scenarios ranging from inelastic goods (salt, insulin) to elastic categories (luxury cars), noting how steep or flat curves affect surplus distribution

Worked Example

Consider a wheat market with initial equilibrium at $8.50/bushel and 12,000 bushels traded. A drought shifts supply left by 30% (sl-b = -0.30), raising price to $11.20/bushel with quantity dropping to 8,400 bushels. Producer surplus increases $22,680 despite lower volume. If demand elasticity (lbl-c) is set to 0.65 (inelastic staple crop), consumers reduce purchases only 25%, creating deadweight loss of $4,890 from the shortage. Conversely, a bumper harvest (sl-b = +0.40) pushes price to $5.10/bushel and quantity to 18,600 bushels, benefiting consumers while squeezing farm margins.

Practical Notes

  1. Agricultural commodities typically exhibit low elasticity (0.2–0.5); test how subsidies (negative demand shift) create persistent surpluses requiring government purchase programs
  2. Technology improvements shift supply rightward; simulate semiconductor fab capacity expansion and observe how price floors become binding at lower price points
  3. Cross-elasticity scenarios: model inferior goods (elasticity <0) when competing product prices rise, revealing why ramen demand surges during recessions
  4. Test extreme elasticity values to understand why concert tickets (elastic, 1.5+) see massive revenue swings with small price changes, while gasoline (inelastic, 0.3) shows stable revenues despite volatility
1.20/bushel with quantity dropping to 8,400 bushels. Producer surplus increases $22,680 despite lower volume. If demand elasticity (lbl-c) is set to 0.65 (inelastic staple crop), consumers reduce purchases only 25%, creating deadweight loss of $4,890 from the shortage. Conversely, a bumper harvest (sl-b = +0.40) pushes price to $5.10/bushel and quantity to 18,600 bushels, benefiting consumers while squeezing farm margins.

Practical Notes

  1. Agricultural commodities typically exhibit low elasticity (0.2–0.5); test how subsidies (negative demand shift) create persistent surpluses requiring government purchase programs
  2. Technology improvements shift supply rightward; simulate semiconductor fab capacity expansion and observe how price floors become binding at lower price points
  3. Cross-elasticity scenarios: model inferior goods (elasticity <0) when competing product prices rise, revealing why ramen demand surges during recessions
  4. Test extreme elasticity values to understand why concert tickets (elastic, 1.5+) see massive revenue swings with small price changes, while gasoline (inelastic, 0.3) shows stable revenues despite volatility