ForHosting KIT · Finance & money

Market equilibrium from linear demand and supply

With demand of 100 minus 2 times the price and supply of 20 plus 2 times the price, the market clears at a price of 20 and a quantity of 60. Enter both intercepts and slopes to get the equilibrium. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Demand intercept
100
Demand slope
-2
Supply intercept
20
Supply slope
2
You get
Demand equation
Qd=100-2P
Supply equation
Qs=20+2P
Equilibrium price
20
Equilibrium quantity
60

Market equilibrium is the price and quantity where the amount buyers want equals the amount sellers offer. In introductory microeconomics, demand and supply are often written as linear quantity functions of price: quantity demanded falls as price rises, and quantity supplied rises as price rises. Setting the two schedules equal yields a unique clearing price and the corresponding traded quantity. This market equilibrium calculator accepts the intercept and slope of each linear schedule, solves for P* and Q* with the closed-form intersection formula, and returns the demand and supply equations alongside the result so students can check homework steps without graphing software.

Linear demand and supply as quantity functions of price

Write quantity demanded as Qd equals a plus b times P, and quantity supplied as Qs equals c plus d times P. The intercept a is the quantity demanded when the price is zero; for a normal good it is positive and large enough that demand stays non-negative over the relevant price range. The demand slope b is typically negative so the demand curve slopes down.

The supply intercept c is the quantity offered at a zero price and may be zero or positive; the supply slope d is typically positive so firms offer more as the price rises. Textbooks often rewrite the same demand line as Qd equals alpha minus beta times P with beta positive; that is identical to setting a equal to alpha and b equal to minus beta.

Once both lines are in Q-of-P form, market clearing is a single algebra step rather than a geometry exercise: find the price that equates the two quantities, then evaluate either schedule at that price.

Coursework, tutoring, and lightweight market notebooks

Principles of economics courses assign linear demand and supply equilibrium problems because the closed form is easy to grade and matches the graphs drawn in class. Tutoring platforms and LMS plugins need a deterministic oracle that returns P star and Q star for arbitrary intercepts and slopes without student-side spreadsheet drift. Product and operations teams sketching a simple market model before a full simulation can pin the same analytic intersection in tests.

Use classic pairs such as Qd equals one hundred minus two P and Qs equals twenty plus two P to get P star equals twenty and Q star equals sixty, then scale intercepts for problem generators. Pin the rounded fields in automated tests, reject parallel slopes and negative clearing values explicitly, and you get reproducible market equilibrium figures for homework, exam generators, and lightweight economics notebooks without standing up a full optimization stack.

Homework and exam equilibrium checks

Students enter linear demand and supply coefficients and verify clearing price and quantity against textbook solutions without graphing by hand.

Problem banks and market notebooks

Generate or validate linear Qd and Qs schedules for coursework seeds and pin expected P* and Q* in continuous integration.

What form of demand and supply does this calculator use?

Linear quantity functions of price: Qd = a + b·P and Qs = c + d·P. Set Qd = Qs to get P* = (a − c)/(d − b) and Q* = a + b·P*.

Can equilibrium price or quantity be zero?

Yes. Zero is accepted as a boundary clearing outcome. Strictly negative P* or Q* is rejected as economically invalid for standard market models.

What is the equilibrium for demand of 100 minus 2 times price and supply of 20 plus 2 times price?

The market clears at a price of 20, where buyers and sellers trade 60 units. You can check it by putting 20 into either line: both give 60.

My textbook writes demand as α minus β times price. How do I enter it?

Use α as the demand intercept and enter the slope as a negative number, minus β. The calculator keeps the sign you type, so a falling demand line needs a negative slope.

Why does the calculator reject lines with the same slope?

Lines with equal slopes are parallel and never cross, so there is no single price where demand equals supply. The calculator says so instead of inventing an answer.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/econ/equilibrium-from-demand-supply-functions

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/econ/equilibrium-from-demand-supply-functions \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"demand_intercept":100,"demand_slope":-2,"supply_intercept":20,"supply_slope":2}'
{
  "demand_intercept": 100,
  "demand_slope": -2,
  "supply_intercept": 20,
  "supply_slope": 2
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "econ.equilibrium_from_demand_supply_functions",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

The browser tool is free; successful API calls use prepaid KIT balance at $0.002 per item.

Linear demand and supply as quantity functions of price

This endpoint keeps the signed slopes explicit so you can paste coefficients from either notation without flipping signs by hand.

Solving for equilibrium price and quantity, inputs, and validation

Set Qd equal to Qs: a plus b P equals c plus d P. Rearrange to a minus c equals d minus b times P, so the equilibrium price is P star equals a minus c over d minus b. The equilibrium quantity is Q star equals a plus b times P star, which must match c plus d times P star when arithmetic is exact. Send four finite numbers: demand_intercept a, demand_slope b, supply_intercept c, and supply_slope d. Fields may arrive as JSON numbers or numeric strings; missing, empty, or non-finite values fail with invalid_input naming the field. If demand_slope equals supply_slope, the lines are parallel and there is no unique intersection, so the API rejects the pair instead of dividing by zero. If the algebraic intersection has a negative price or a negative quantity, the schedules do not clear in the non-negative orthant used by standard market models, and the call fails with a clear invalid_input message. On success the response echoes the four coefficients, the two equation strings, equilibrium_price, equilibrium_quantity, and a short formula string. Failed validation is not billed; successful parse calls use the published $0.002 base price.

LMS and tutoring auto-grading

Score market-equilibrium items with a deterministic oracle that rejects parallel slopes and negative P* or Q* as invalid_input.

My textbook writes Qd = α − βP with β positive. How do I enter that?

Set demand_intercept to α and demand_slope to −β. Supply Qs = γ + δP maps to supply_intercept γ and supply_slope δ.

Why must demand_slope and supply_slope differ?

Equal slopes mean parallel lines. There is no unique intersection, so the API returns invalid_input instead of dividing by zero.

What does the market equilibrium calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →