How to get the inverse function?

If I have some function y[x_]:=ax+b (just an example), how do I get x[y_]:=(yb)/a in Mathematica? I tried InverseFunction , Collect , and they do not work.

+6
wolfram-mathematica
source share
4 answers

Think of it as an equation and use Solve .

 In:=Solve[y-ax-b==0,x] Out={{x -> (-b + y)/a}} 
+8
source share

If you want to define a function, you can do:

 x[y_] := x /. Solve[y == ax + b, x][[1]] x[1] -> (1 - b)/a 
+3
source share

http://mathworld.wolfram.com/InverseFunction.html

In particular, the line:

In Mathematica, inverse functions are represented using InverseFunction [f].

+2
source share

One way: Solve:

 In[29]:= Solve[y == ax + b, x] Out[29]= {{x -> (-b + y)/a}} 
+2
source share

All Articles