If $f:R \to R, f(x)=x^3+3x+1$ then find the inverse of $f(x)$.
$f(x)$ is one to one (as it is increasing function for $x \in R$) and onto as well (Range is same as co-domain) but I don't know how to find inverse here as I am not able to write $x$ as a function of y.
Could someone help me with this?

For many — in fact, I would argue for most — purposes, the best expression for the inverse is
or maybe
and work with it in those terms. For example, do you want the derivative of $g$? The best way to compute it is with implicit differentiation:
$$f(g(x)) = x \implies g'(x) f'(g(x)) = 1 \implies g'(x) = \frac{1}{f'(g(x))} $$
Even if you had an algebraic formula for $g$, you would probably strongly prefer to compute the derivative in this fashion.
Another example: want the asymptotic behavior of $g(x)$ as $x \to \infty$? Use the behavior of $f$ and a change of variable:
$$ 1 = \lim_{x \to \infty} \frac{f(x)}{x^3} = \lim_{y \to \infty} \frac{f(g(y))}{g(y)^3} = \lim_{y \to \infty} \frac{y}{g(y)^3} $$
from which we conclude
$$ \lim_{x \to \infty} \frac{g(x)}{x^{1/3}} = 1 $$