Inverse Linear Function Calculator
Use this calculator to find the inverse of a linear function in the form y = mx + b and see the step-by-step derivation.
Inverse Function:
Step-by-Step Derivation:
" + originalFunction + "");
steps.push("2. Swap x and y: x = " + m + "y" + (b !== 0 ? ((b > 0 ? " + " : " - ") + Math.abs(b)) : "") + "");
var step3Eq = "x";
if (b !== 0) {
step3Eq += (b > 0 ? " – " : " + ") + Math.abs(b);
}
steps.push("3. Isolate the term with y: " + step3Eq + " = " + m + "y");
var numerator = "x";
if (b !== 0) {
numerator += (b > 0 ? " – " : " + ") + Math.abs(b);
}
var inverseFuncString = "f-1(x) = ";
if (m === 1) {
inverseFuncString += numerator;
} else if (m === -1) {
inverseFuncString += "-(" + numerator + ")";
} else {
inverseFuncString += "(" + numerator + ") / " + m;
}
steps.push("4. Solve for y to find the inverse function: y = " + inverseFuncString.substring(inverseFuncString.indexOf("=") + 1).trim() + "");
steps.push("5. Replace y with f-1(x): " + inverseFuncString + "");
inverseFunctionResultDiv.innerHTML = "" + inverseFuncString + "";
stepByStepDerivationDiv.innerHTML = steps.map(function(step) { return "" + step + ""; }).join("");
}
.calculator-container {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f9f9f9;
border: 1px solid #ddd;
border-radius: 8px;
padding: 20px;
max-width: 600px;
margin: 20px auto;
box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}
.calculator-container h2 {
color: #333;
text-align: center;
margin-bottom: 20px;
}
.calculator-container p {
color: #555;
line-height: 1.6;
margin-bottom: 15px;
}
.calc-input-group {
margin-bottom: 15px;
}
.calc-input-group label {
display: block;
margin-bottom: 5px;
color: #333;
font-weight: bold;
}
.calc-input-group input[type="number"] {
width: calc(100% – 22px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 16px;
}
.calculator-container button {
display: block;
width: 100%;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 18px;
cursor: pointer;
transition: background-color 0.3s ease;
margin-top: 20px;
}
.calculator-container button:hover {
background-color: #0056b3;
}
.calc-results {
margin-top: 25px;
padding-top: 20px;
border-top: 1px solid #eee;
}
.calc-results h3 {
color: #333;
margin-bottom: 10px;
font-size: 1.2em;
}
.result-output {
background-color: #e9ecef;
border: 1px solid #dee2e6;
border-radius: 4px;
padding: 15px;
margin-bottom: 15px;
font-size: 1.1em;
color: #333;
word-wrap: break-word;
}
.result-output code {
background-color: #f8f9fa;
padding: 2px 4px;
border-radius: 3px;
font-family: 'Courier New', Courier, monospace;
color: #c0392b;
}
.result-output p {
margin: 5px 0;
}
.error {
color: #dc3545;
font-weight: bold;
}
Understanding Inverse Functions and How to Find Them
An inverse function, often denoted as f-1(x), essentially "undoes" what the original function f(x) does. If a function takes an input x and produces an output y, its inverse function takes that y as an input and returns the original x. Not all functions have an inverse, but one-to-one functions (where each output corresponds to exactly one input) always do.
What is a Linear Function?
A linear function is a polynomial function of degree one. It can be written in the form y = mx + b, where:
mis the slope of the line, representing the rate of change ofywith respect tox.bis the y-intercept, which is the point where the line crosses the y-axis (i.e., the value ofywhenx = 0).
Linear functions are always one-to-one (unless m=0, in which case it's a horizontal line and not one-to-one), meaning they have a unique inverse function.
Steps to Find the Inverse of a Linear Function
Finding the inverse of a linear function y = mx + b involves a straightforward algebraic process:
- Start with the original function: Write down the function in the form
y = mx + b. - Swap
xandy: This is the crucial step that conceptually reverses the roles of input and output. The equation becomesx = my + b. - Isolate the term with
y: Rearrange the equation to get the term containingyby itself on one side. This usually involves subtractingbfrom both sides:x - b = my. - Solve for
y: Divide both sides bym(assumingm ≠ 0) to completely isolatey. This gives youy = (x - b) / m. - Replace
ywithf-1(x): The resulting expression foryis your inverse function, so write it asf-1(x) = (x - b) / m.
Example Calculation
Let's find the inverse of the function f(x) = 2x + 3 using the steps above:
- Original function:
y = 2x + 3 - Swap
xandy:x = 2y + 3 - Isolate the term with
y: Subtract 3 from both sides:x - 3 = 2y - Solve for
y: Divide both sides by 2:y = (x - 3) / 2 - Replace
ywithf-1(x):f-1(x) = (x - 3) / 2
So, the inverse of f(x) = 2x + 3 is f-1(x) = (x - 3) / 2.
Why is m ≠ 0 Important?
If the slope m is zero, the original function is y = b, which is a horizontal line. A horizontal line fails the horizontal line test, meaning it's not a one-to-one function. For example, if y = 5, then any x value maps to y = 5. If you try to find an inverse, swapping x and y gives x = 5, which is a vertical line. A vertical line is not a function (it fails the vertical line test), so it cannot be an inverse function.