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.
y[x_]:=ax+b
x[y_]:=(yb)/a
InverseFunction
Collect
Think of it as an equation and use Solve .
Solve
In:=Solve[y-ax-b==0,x] Out={{x -> (-b + y)/a}}
If you want to define a function, you can do:
x[y_] := x /. Solve[y == ax + b, x][[1]] x[1] -> (1 - b)/a
http://mathworld.wolfram.com/InverseFunction.html
In particular, the line:
In Mathematica, inverse functions are represented using InverseFunction [f].
One way: Solve:
In[29]:= Solve[y == ax + b, x] Out[29]= {{x -> (-b + y)/a}}