Calculating Marginal Rate of Substitution from Utility Function
by
Marginal Rate of Substitution (MRS) Calculator
Based on the Cobb-Douglas Utility Function: U(x, y) = xayb
Calculation Result:
Understanding the Marginal Rate of Substitution (MRS)
In consumer theory, the Marginal Rate of Substitution (MRS) represents the rate at which a consumer is willing to give up one good (Good Y) in exchange for another good (Good X) while maintaining the same level of utility. Geometrically, it represents the absolute slope of the indifference curve at a specific point.
The Formula
For a standard Cobb-Douglas utility function U(x, y) = xayb, the MRS is calculated by taking the ratio of the marginal utilities:
Step 1: Find MUx (Partial derivative of U with respect to x) = a * xa-1 * yb
Step 2: Find MUy (Partial derivative of U with respect to y) = b * xa * yb-1
Step 3: MRSxy = MUx / MUy = (a * y) / (b * x)
Practical Example
Imagine a consumer with the utility function U = x0.5y0.5. If they currently consume 10 units of Good X and 20 units of Good Y:
a = 0.5, b = 0.5
x = 10, y = 20
MRS = (0.5 * 20) / (0.5 * 10) = 10 / 5 = 2.00
This means the consumer is willing to give up 2 units of Good Y to obtain 1 additional unit of Good X while keeping their total satisfaction constant.
function calculateMRS() {
var a = parseFloat(document.getElementById('exponentA').value);
var b = parseFloat(document.getElementById('exponentB').value);
var x = parseFloat(document.getElementById('quantityX').value);
var y = parseFloat(document.getElementById('quantityY').value);
var resultContainer = document.getElementById('mrs-result-container');
var valueOutput = document.getElementById('mrs-value-output');
var interpretation = document.getElementById('mrs-interpretation');
if (isNaN(a) || isNaN(b) || isNaN(x) || isNaN(y)) {
alert("Please enter numeric values for all fields.");
return;
}
if (x <= 0 || y <= 0) {
alert("Quantities must be greater than zero.");
return;
}
// Logic for Cobb-Douglas MRS: (a * y) / (b * x)
var mrs = (a * y) / (b * x);
var mrsFormatted = mrs.toFixed(4);
resultContainer.style.display = 'block';
valueOutput.innerHTML = "MRSxy = " + mrsFormatted + "";
interpretation.innerHTML = "At your current consumption level, you are willing to sacrifice " + mrsFormatted + " units of Good Y to acquire exactly 1 additional unit of Good X. This indicates the trade-off ratio that keeps your total utility unchanged.";
}