How to Calculate Equilibrium Quantity

Equilibrium Quantity Calculator :root { –primary-blue: #004a99; –success-green: #28a745; –light-background: #f8f9fa; –dark-text: #343a40; –border-color: #dee2e6; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–light-background); color: var(–dark-text); line-height: 1.6; margin: 0; padding: 20px; } .loan-calc-container { max-width: 700px; margin: 40px auto; background-color: #ffffff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border: 1px solid var(–border-color); } h1, h2 { color: var(–primary-blue); text-align: center; margin-bottom: 20px; } .input-group { margin-bottom: 20px; padding: 15px; border: 1px solid var(–border-color); border-radius: 5px; background-color: #fdfdfd; } .input-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(–primary-blue); } .input-group input[type="number"] { width: calc(100% – 20px); /* Account for padding */ padding: 10px; border: 1px solid var(–border-color); border-radius: 4px; box-sizing: border-box; /* Include padding and border in the element's total width and height */ font-size: 1rem; } .input-group input[type="number"]:focus { outline: none; border-color: var(–primary-blue); box-shadow: 0 0 0 2px rgba(0, 74, 153, 0.25); } button { display: block; width: 100%; padding: 12px 20px; background-color: var(–primary-blue); color: white; border: none; border-radius: 5px; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; } button:hover { background-color: #003366; transform: translateY(-2px); } #result { margin-top: 30px; padding: 20px; background-color: var(–success-green); color: white; text-align: center; font-size: 1.8rem; font-weight: bold; border-radius: 5px; box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3); } .explanation { margin-top: 40px; padding: 25px; background-color: #eef5f9; border-radius: 8px; border: 1px solid var(–border-color); } .explanation h2 { color: var(–primary-blue); text-align: left; margin-bottom: 15px; } .explanation p, .explanation ul, .explanation li { margin-bottom: 15px; color: var(–dark-text); } .explanation ul { list-style-type: disc; margin-left: 20px; } .explanation code { background-color: #ddeeff; padding: 2px 6px; border-radius: 3px; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; } /* Responsive adjustments */ @media (max-width: 768px) { .loan-calc-container { padding: 20px; margin: 20px auto; } h1 { font-size: 1.8rem; } button { font-size: 1rem; padding: 10px 15px; } #result { font-size: 1.5rem; } }

Equilibrium Quantity Calculator

Calculate the market equilibrium quantity where supply and demand intersect.

Understanding Equilibrium Quantity

In economics, the equilibrium quantity represents the amount of a good or service that is produced and consumed at the market equilibrium price. At this point, the quantity supplied by producers exactly matches the quantity demanded by consumers. This balance signifies a stable market condition where there is no inherent pressure for the price or quantity to change, assuming all other factors remain constant.

The equilibrium is found at the intersection of the demand curve and the supply curve. These curves are typically represented by equations.

The Math Behind Equilibrium

The standard linear equations for demand and supply are:

  • Demand Equation: Qd = a - bP
  • Supply Equation: Qs = c + dP

Where:

  • Qd is the quantity demanded
  • Qs is the quantity supplied
  • P is the price
  • a is the demand intercept (the quantity demanded when price is zero)
  • b is the slope of the demand curve (typically negative, indicating that as price increases, quantity demanded decreases)
  • c is the supply intercept (the quantity supplied when price is zero)
  • d is the slope of the supply curve (typically positive, indicating that as price increases, quantity supplied increases)

At equilibrium, the quantity demanded equals the quantity supplied (Qd = Qs), and the price is the equilibrium price (Pe). To find the equilibrium quantity (Qe), we first set the two equations equal to each other and solve for the equilibrium price Pe:

a - bPe = c + dPe
a - c = dPe + bPe
a - c = Pe(d + b)
Pe = (a - c) / (b + d)

Once we have the equilibrium price Pe, we can substitute it back into either the demand or the supply equation to find the equilibrium quantity Qe. Using the supply equation for simplicity:

Qe = c + d * Pe
Qe = c + d * [(a - c) / (b + d)]

This calculator directly computes Qe using the provided intercept and slope values.

Example:

Suppose we have the following demand and supply functions:

  • Demand: Qd = 100 - 2P (Here, a = 100, b = 2)
  • Supply: Qs = 10 + 3P (Here, c = 10, d = 3)

Using the calculator inputs:

  • Demand Intercept (a): 100
  • Demand Slope (b): 2
  • Supply Intercept (c): 10
  • Supply Slope (d): 3

The calculator will determine the equilibrium quantity.

Calculator Logic:

The calculator implements the derived formulas:

  1. Calculate Equilibrium Price: Pe = (demandIntercept - supplyIntercept) / (demandSlope + supplySlope)
  2. Calculate Equilibrium Quantity: Qe = supplyIntercept + supplySlope * Pe

It also includes checks to ensure valid inputs are provided to prevent errors.

function calculateEquilibrium() { var demandIntercept = parseFloat(document.getElementById('demandIntercept').value); var demandSlope = parseFloat(document.getElementById('demandSlope').value); var supplyIntercept = parseFloat(document.getElementById('supplyIntercept').value); var supplySlope = parseFloat(document.getElementById('supplySlope').value); var resultDiv = document.getElementById('result'); resultDiv.style.display = 'none'; // Hide previous result // Input validation if (isNaN(demandIntercept) || isNaN(demandSlope) || isNaN(supplyIntercept) || isNaN(supplySlope)) { resultDiv.innerHTML = "Error: Please enter valid numbers for all fields."; resultDiv.style.backgroundColor = '#dc3545'; // Red for error resultDiv.style.display = 'block'; return; } // Check for valid slopes (demand slope negative, supply slope positive) if (demandSlope >= 0) { resultDiv.innerHTML = "Error: Demand slope (b) must be negative."; resultDiv.style.backgroundColor = '#dc3545'; resultDiv.style.display = 'block'; return; } if (supplySlope <= 0) { resultDiv.innerHTML = "Error: Supply slope (d) must be positive."; resultDiv.style.backgroundColor = '#dc3545'; resultDiv.style.display = 'block'; return; } // Check if denominator (demandSlope + supplySlope) is zero or negative which implies no valid equilibrium price exists or price is negative if ((demandSlope + supplySlope) <= 0) { resultDiv.innerHTML = "Error: Invalid slopes leading to non-positive denominator for price calculation."; resultDiv.style.backgroundColor = '#dc3545'; resultDiv.style.display = 'block'; return; } // Calculate Equilibrium Price (Pe) var equilibriumPrice = (demandIntercept – supplyIntercept) / (demandSlope + supplySlope); // Calculate Equilibrium Quantity (Qe) // Using supply equation: Qe = c + d*Pe var equilibriumQuantity = supplyIntercept + supplySlope * equilibriumPrice; // Check if calculated equilibrium quantity is non-negative if (equilibriumQuantity < 0) { resultDiv.innerHTML = "Error: Calculated equilibrium quantity is negative. This suggests an issue with the provided intercepts or slopes, potentially indicating no feasible market equilibrium."; resultDiv.style.backgroundColor = '#dc3545'; resultDiv.style.display = 'block'; return; } // Display the result resultDiv.innerHTML = "Equilibrium Quantity: " + equilibriumQuantity.toFixed(2); resultDiv.style.backgroundColor = 'var(–success-green)'; // Reset to green resultDiv.style.display = 'block'; }

Leave a Comment