To find the inverse of a function written as y = mx + b, swap x and y, then solve for y: write x = my + b, subtract b, and divide by m, so the inverse is y = (x − b)/m. That works only when m is not zero — a horizontal line fails the horizontal line test and has no inverse function, and a vertical output like x = b has no slope-intercept form at all. The four steps below turn this into a repeatable move you can apply to any linear function without thinking hard about it.
Step 1: Confirm the Line Is Invertible Before You Touch the Algebra
Before writing anything, check the slope. A function has an inverse function only if it passes the horizontal line test, which for a line means the slope m is not zero. If m is zero you have y = b, a horizontal line, and its "inverse" is the vertical line x = b — a relation, not a function, because the single input b maps to every real y.
Two boundary conditions matter more than most tutorials admit. The vertical line x = b cannot be expressed in y = mx + b at all, since no slope-intercept form exists for it, so it's out of scope here rather than a special case. And the line y = x itself inverts to itself, which is a useful benchmark: when your answer comes back identical to the input, you've either done everything right or made two offsetting errors, so verify with a point.
Slope m = 0 is the only failure inside this form. Every other linear function is one-to-one over the real numbers, which means every non-zero-slope line has a genuine inverse function defined for all real x. State that check out loud as step one and you'll avoid the most common conceptual error — producing a "formula" for a line that was never invertible.
Write the function in the standard y = mx + b order first if it arrives scrambled, such as 3x + 2y = 12. Rearranging to y = −(3/2)x + 6 is ordinary algebra, not the inversion step, and doing it up front keeps the four steps clean.
Step 2: Swap X and Y To Get the Inverse Relation
The swap is the entire mechanism. Replace every x with y and every y with x: y = mx + b becomes x = my + b. Geometrically this reflects the graph across the line y = x, which is exactly what an inverse does — every point (a, b) on the original line becomes (b, a) on the inverse.
Keep the slope attached to the new y, not the new x. In x = my + b, the coefficient m now multiplies y. Writing x = my + b is correct; writing y = mx + b again and calling it swapped is the single most frequent mistake students make, and it produces a line that looks plausible and is completely wrong.
Use parentheses when m is fractional or negative. For y = −(2/3)x + 4, the swapped relation is x = −(2/3)y + 4. Without brackets, a careless transcription of −(2/3)y as −2/3y invites sign errors during the division step, and negative slopes are where those errors cluster.
Mark the swapped equation clearly as a relation, not yet a function in y form. It's fine to leave it as x = my + b for a moment; the next step turns it back into y = something. Treating the swap as the finished answer is the second-most-common failure.
Step 3: Solve the Swapped Equation for Y
Isolate y in two moves. First subtract b from both sides: x − b = my. Then divide both sides by m: y = (x − b)/m. That's the inverse function, f⁻¹(x) = (x − b)/m, and nothing about it requires cleverness — just the order of operations in reverse.
Split the fraction if you want the inverse itself in slope-intercept form. Since (x − b)/m = (1/m)x − b/m, the inverse has slope 1/m and y-intercept −b/m. That's a genuinely useful fact: the original slope and the inverse slope multiply to 1, and the y-intercepts are related by a sign flip and a division by m. You can use it as a mental check before you even write the final line.
Work an example with real numbers. Take y = 3x − 6. Swap: x = 3y − 6. Add 6: x + 6 = 3y. Divide by 3: y = (x + 6)/3 = (1/3)x + 2. The slope became 1/3, the reciprocal of 3, and the y-intercept moved from −6 to +2, matching −b/m = 6/3 = 2. Both checks pass.
Handle negative and fractional slopes the same way, carefully. For y = −(2/3)x + 4, swap to x = −(2/3)y + 4, subtract 4 to get x − 4 = −(2/3)y, then multiply by −3/2 rather than divide by −2/3 if that feels safer: y = −(3/2)(x − 4) = −(3/2)x + 6. The inverse slope −3/2 is the reciprocal of −2/3, and the sign is preserved.
Step 4: Verify With a Round-Trip Test and One Point
Compose the functions both ways. For f(x) = 3x − 6 and f⁻¹(x) = (x + 6)/3, check f(f⁻¹(x)): substitute (x + 6)/3 into 3x − 6 to get 3·((x + 6)/3) − 6 = (x + 6) − 6 = x. Then check f⁻¹(f(x)): substitute 3x − 6 into (x + 6)/3 to get ((3x − 6) + 6)/3 = 3x/3 = x. Both compositions return x, which is the definition of an inverse function.
Test a single point as a fast sanity check. The original line passes through (2, 0), since 3(2) − 6 = 0. Its inverse should pass through (0, 2): (0 + 6)/3 = 2. That's confirmed. Pick any point on the original, flip the coordinates, and the inverse must contain the flipped point.
Use the slope-and-intercept relationships as a second independent check. Slope product should equal 1 — here 3 × (1/3) = 1. The inverse y-intercept should equal −b/m — here −(−6)/3 = 2, which matches. If either check fails, the algebra went wrong somewhere between the swap and the final division.
Failing the round trip usually means one of three things: the swap wasn't done (both x's and y's left in place), the division by m used the wrong sign, or the subtraction of b was applied to the wrong side. Rerun the composition with x = 0 and x = 1; if either fails to return the input, you have a concrete localization of the bug.
The One Swap Trap That Explains Most Wrong Answers
The dominant error isn't arithmetic — it's skipping the swap. Students who learned that "finding an inverse means rearranging for the other variable" often solve y = mx + b for x to get x = (y − b)/m and hand that in. That equation is algebraically true, but it's the same line with the variables renamed conversationally, not the inverse function's slope-intercept form.
The fix is a firm rule: the answer must be y = something in x. If your final equation still reads "x =," you've solved for x in terms of y, which is a different (though related) question. The swap converts the "solve for the other variable" instinct into the correct operation, and it's worth doing explicitly every time rather than in your head.
A related trap is mismatched signs on b. Swapping y = mx + b gives x = my + b, and subtracting b must apply to the x side: x − b = my. Writing my = b − x instead flips the entire intercept and produces an inverse reflected across the wrong axis. Both errors look like small slips; both break every check in step four.
Trap three: treating y = x as the expected answer for every line. It's only self-inverse when m = 1 and b = 0. Any slope other than 1 or intercept other than 0 changes the inverse, and a formula-driven check — slope product of 1, intercept of −b/m — catches it immediately.
Two Worked Examples, From Fractions to Negative Slopes
Example one: y = (1/2)x + 3. Swap: x = (1/2)y + 3. Subtract 3: x − 3 = (1/2)y. Multiply by 2: y = 2(x − 3) = 2x − 6. Check slope product: (1/2) × 2 = 1. Check intercept: −3/(1/2) = −6. Both pass. The original grows slowly and starts at 3; the inverse grows twice as fast and starts at −6, which is exactly what a reflection across y = x should produce.
Example two: y = −4x + 8. Swap: x = −4y + 8. Subtract 8: x − 8 = −4y. Divide by −4: y = (x − 8)/(−4) = −(1/4)x + 2. Slope product: (−4) × (−1/4) = 1, confirmed. Intercept: −8/(−4) = 2, confirmed. The steep declining line becomes a gentle declining line, which is the correct geometric mirror.
The table below puts six functions side by side so you can see the pattern at a glance. Values are arithmetic, not measured — recompute any row to verify.
| Original function | Inverse function | Slope product | Inverse y-intercept |
|---|---|---|---|
| y = 3x − 6 | y = (1/3)x + 2 | 1 | 2 |
| y = (1/2)x + 3 | y = 2x − 6 | 1 | −6 |
| y = −4x + 8 | y = −(1/4)x + 2 | 1 | 2 |
| y = x + 5 | y = x − 5 | 1 | −5 |
| y = −x | y = −x | 1 | 0 |
| y = 2x + 1 | y = (1/2)x − (1/2) | 1 | −0.5 |
Rows two through five include the negative-slope and self-inverse cases that tutorials often skip. The y = −x row is worth memorizing: it's the second self-inverse line, and its intercept is 0 in both directions. Row six shows a case where the intercept becomes a fraction, which is fine and happens whenever b is not divisible by m.
Why the Horizontal Line Test Is the Real Gatekeeper
The horizontal line test asks whether any horizontal line crosses the graph more than once. For a line, a horizontal line crosses any non-horizontal line exactly once, so every line with m ≠ 0 passes. A horizontal line y = b crosses y = b everywhere, so it fails, and its "inverse" is the vertical line x = b, which fails the vertical line test for functions.
This is the geometric reason slope m = 0 is excluded in step one. A function must map each input to exactly one output; the inverse must also map each input to exactly one output. When the original is horizontal, the inverse is vertical, and a vertical line assigns infinitely many outputs to one input — not a function.
The test also explains why non-linear functions need domain restrictions even when they can be inverted piecewise. A parabola fails the horizontal line test over all real x, so its inverse is only defined after you restrict the domain to, say, x ≥ 0. That's outside slope-intercept form and beyond this article's scope, but the underlying criterion is the same.
One practical consequence: if you're ever asked to "find the inverse" and the function is horizontal, the correct answer is that no inverse function exists, or that the inverse is the vertical line x = b as a relation. Supplying a slope-intercept formula in that case is always wrong.
Turning the Original Into Slope-Intercept Form First
Many problems hand you a function in standard form or point-slope form. Convert before inverting. For 3x + 2y = 12, subtract 3x and divide by 2 to get y = −(3/2)x + 6. Only then swap, subtract 6, divide by −3/2, and get y = −(2/3)x + 4. Running the round-trip check: f(f⁻¹(x)) = −(3/2)(−(2/3)x + 4) + 6 = x − 6 + 6 = x, which confirms the conversion chain.
Point-slope form is the same procedure with a different starting shape. y − 2 = 3(x − 1) simplifies to y = 3x − 1, which inverts to y = (x + 1)/3. Skipping the conversion and trying to swap inside point-slope notation creates nested parentheses that invite sign errors.
Watch for functions with no constant term. y = 5x has b = 0, so the inverse is y = x/5. The −b/m term vanishes, and students sometimes drop the x/5 into x/5 + 0 unnecessarily. It's harmless but a sign the pattern is being applied mechanically rather than understood.
Once the function is in slope-intercept form, the inversion is a fixed four-step procedure with two checks. The conversion step is the only place where the original problem's presentation can bite, so budget your care there and the rest follows.
When the Inverse Is Itself a Horizontal or Vertical Line
The inverse of a horizontal line is vertical, and the inverse of a vertical line isn't a function at all, so the only slope-intercept inverse you'll ever produce comes from a line with m ≠ 0. This section is mostly about recognizing the edge so you don't force the four-step procedure where it doesn't apply.
Consider y = 7. There's no x, so m = 0 and the slope-intercept form is y = 0x + 7. Swapping gives x = 0y + 7, which simplifies to x = 7 — a vertical line. That's the correct inverse relation, but it can't be written as y = something, so it has no slope-intercept form. Say so explicitly and you've answered correctly.
Now consider x = 4. It's a vertical line, which isn't a function of x at all under the standard definition, so "inverse function" doesn't apply. Rewriting it as x = 0y + 4 exposes the problem: solving for y would require dividing by zero, which is exactly the failure of the swap-and-solve step. Recognizing that division by zero is the failure mode ties the geometric picture to the algebra.
A practical rule: if you're about to divide by m and m is zero, stop and state that no inverse function exists. Don't attempt to produce a fractional slope from 1/0. That's the algebra signaling the horizontal line test's verdict in numeric form.
Reading the Slope Relationship as a Fast Diagnostic
The inverse slope is the reciprocal of the original slope, and the inverse y-intercept is −b/m. Knowing both lets you predict the answer before you do the algebra, which is a real time-saver on timed tests and a genuine error detector everywhere else. If your written answer's slope isn't 1/m, you have a bug; if the intercept isn't −b/m, you have a different bug.
Reciprocal slopes have a geometric meaning. Steep lines invert to shallow lines, shallow to steep, and the signs are preserved. A line rising 3 units per 1 horizontal unit inverts to one rising 1 unit per 3 horizontal units. Visualize that mirror across y = x and the reciprocal relationship makes immediate sense.
The intercept relation is less intuitive but equally mechanical. Starting from y = mx + b, the swapped relation is x = my + b, so y = (x − b)/m = x/m − b/m. The 1/m is the reciprocal slope, and the −b/m is the intercept term. Read it as a single formula rather than two memorized facts and you'll reconstruct it under pressure.
For self-inverse lines y = x and y = −x, both checks confirm: slope 1 with intercept 0, and slope −1 with intercept 0, respectively. Any other line that appears self-inverse is a sign of an arithmetic error, since only those two satisfy m = 1/m and b = −b/m simultaneously.
FAQ
Does every slope-intercept function have an inverse?
No — only those with m ≠ 0. A horizontal line y = b fails the horizontal line test, and its inverse relation is the vertical line x = b, which isn't a function. You'll know you're in trouble during step three, when solving for y requires division by m = 0.
What's the fastest way to check my inverse is right?
Compose both orders and confirm each returns x. For f(x) = 3x − 6, f(f⁻¹(x)) and f⁻¹(f(x)) both equal x when the inverse is (x + 6)/3. That two-composition check catches swap failures, sign errors, and division mistakes in under a minute.
Why does my answer still have x = instead of y =?
You solved for x in terms of y but didn't complete the swap. The inverse function's slope-intercept form must read y = something in x. If it reads x = something, you have the inverse relation in the wrong orientation, not the slope-intercept inverse function.
Is the inverse always a function?
For non-zero-slope lines, yes, because every non-horizontal line passes the horizontal line test. For curves it depends on domain restrictions — a parabola inverts only after restricting to one branch. Within slope-intercept form, the only non-function inverse is the vertical line, which can't be written as y = mx + b.
How does the inverse slope compare to the original?
The two slopes multiply to 1, so the inverse slope is the reciprocal 1/m with the same sign. Original slope 3 inverts to 1/3; original slope −4 inverts to −1/4. Original slope 1 inverts to 1, which is why y = x is self-inverse.
What happens to the y-intercept when I invert?
The inverse y-intercept is −b/m, not simply −b. For y = 3x − 6, the inverse intercept is −(−6)/3 = 2, not 6. The division by m is easy to forget, and forgetting it breaks the slope-intercept check even when the slope is right.
Can a vertical line have an inverse in slope-intercept form?
No. A vertical line x = b has no y term, so no slope-intercept form exists for it, and it isn't a function of x to begin with. Attempting the swap produces x = 0y + b, which can't be solved for y without dividing by zero.
Where does this show up outside a math class?
Inverting linear relationships appears in converting temperature scales, reversing unit conversions priced per item, and solving cost equations for quantity. Any time one variable is expressed as a linear function of another and you need the reverse direction, the same four-step procedure applies, with the slope condition still ruling out constant relationships.