You should start by solving for x the equation g(x) = y and you will get an expression in terms of y.
Then, you should check if the expression you have found for g^(-1)(x) is the inverse of the function using the following property such that:
(gog^(-1))(x) = g(g^(-1)(x)) = x
You should notice all the steps described above on the following example:
g(x) = x+1
You may write g(x) = y such that:
y = x+1
Solving for x the equation y = x+1 yields:
x = y - 1 => g^(-1)(x) = x - 1
You need to use the composition of functions such that:
g(g^(-1)(x)) = g^(-1)(x) + 1
g(g^(-1)(x)) = (x - 1) + 1
g(g^(-1)(x)) = x
Hence, evaluating the inverse of a function g(x), you need to obtain an expression such that g(g^(-1)(x)) = x.
To find the inverse function, the most commom method is to set it as y=g(x), then you solve for x. In other words, your answer should look like x=h(y). Once you get that, you can rename x as y and y as x to make it look more conventional.