Analytically,it works only for simple functions.See below
f[x_] := Log[x]; InverseFunction[(f[x] /. x -> #) &][x]
f[x_] := Sin[x]; InverseFunction[(f[x] /. x -> #) &][x]
f[x_] := Exp[x] - x; InverseFunction[(f[x] /. x -> #) &][x]
f[x_] := Exp[x] - x^2; InverseFunction[(f[x] /. x -> #) &][x](*Can't find *)
InverseFunction[((Integrate[(1/(1 + a Cos[x]))^2, x]) /. x -> #) &][x](*Can't find *)
In Mathematica,from help pages of InverseFunction:
As discussed in "Functions That Do Not Have Unique Values", many
mathematical functions do not have unique inverses. In such cases,
InverseFunction[f] can represent only one of the possible inverses for
f. InverseFunction is generated by Solve when the option
InverseFunctions is set to Automatic or True
Numerically with Plot
Show[{ContourPlot[Sin[x] == y, {y, -1, 1}, {x, -Pi, Pi}],
Plot[ArcSin[x], {x, -1, 1}, PlotStyle -> {Dashed, Red}]}](*Example with Sin[x]*)
Int = Integrate[(1/(1 + a Cos[x]))^2, x] /. a -> 2(*For a=2*)
ContourPlot[Int == y, {y, -1, 1}, {x, -Pi, Pi}](*Inverse of integral*)