The Marginal Rate of Substitution (MRS) is a concept in microeconomics that describes 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. In simpler terms, it answers the question: "How much of good Y am I willing to sacrifice to get one more unit of good X, and still be just as happy?"
The MRS is typically represented by the slope of an indifference curve at a particular point. As a consumer moves along an indifference curve, consuming more of one good generally means they are willing to give up less of the other good to maintain the same satisfaction level. This is due to the principle of diminishing marginal rate of substitution.
The formula for the Marginal Rate of Substitution between good X and good Y is derived from the ratio of their marginal utilities:
MRSXY = MUX / MUY
Where:
MRSXY is the Marginal Rate of Substitution of good X for good Y.
MUX is the Marginal Utility of good X (the additional satisfaction gained from consuming one more unit of good X).
MUY is the Marginal Utility of good Y (the additional satisfaction gained from consuming one more unit of good Y).
function calculateMRS() {
var muX = parseFloat(document.getElementById("marginalUtilityX").value);
var muY = parseFloat(document.getElementById("marginalUtilityY").value);
var resultElement = document.getElementById("mrs-result");
resultElement.innerHTML = ""; // Clear previous results
if (isNaN(muX) || isNaN(muY)) {
resultElement.innerHTML = "Please enter valid numbers for both marginal utilities.";
return;
}
if (muY === 0) {
resultElement.innerHTML = "Marginal Utility of Good Y cannot be zero.";
return;
}
var mrs = muX / muY;
resultElement.innerHTML = "
Result:
MRSXY = MUX / MUY = " + muX + " / " + muY + " = " + mrs.toFixed(2) + "";
resultElement.innerHTML += "This means you are willing to give up approximately " + mrs.toFixed(2) + " units of Good Y to obtain one additional unit of Good X while maintaining the same level of satisfaction.";
}
#mrs-calculator {
font-family: sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
background-color: #f9f9f9;
}
#mrs-calculator h2 {
text-align: center;
color: #333;
margin-bottom: 15px;
}
#mrs-calculator p {
line-height: 1.6;
color: #555;
margin-bottom: 10px;
}
#mrs-calculator ul {
margin-left: 20px;
margin-bottom: 15px;
}
#mrs-calculator li {
margin-bottom: 5px;
color: #555;
}
.input-group {
margin-bottom: 15px;
display: flex;
align-items: center;
}
.input-group label {
flex: 1;
margin-right: 10px;
font-weight: bold;
color: #333;
}
.input-group input[type="number"] {
flex: 1;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box; /* Ensure padding and border are included in the element's total width and height */
}
#mrs-calculator button {
display: block;
width: 100%;
padding: 10px 15px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
margin-top: 10px;
}
#mrs-calculator button:hover {
background-color: #0056b3;
}
.result-display {
margin-top: 20px;
padding: 15px;
border: 1px solid #d4edda;
border-radius: 4px;
background-color: #e9f7ef;
color: #155724;
text-align: center;
}
.result-display h3 {
margin-top: 0;
color: #155724;
}
.result-display p {
margin-bottom: 5px;
}
.result-display strong {
font-weight: bold;
}