Solving a cubic function $4 = g^3(3) + 3g(3)$ I hope you will not find this question inappropriate and I apologize for posting an image.
I was studying following solution but I don't understand how someone got g(3) = 1 from $4 = g^3(3) + 3g(3)$. Was it purely by observation and plugging in couple of values, or there is some math algorithm for solving it?
Original question: Let y = g(x) be the inverse function of $f(x)=x^3+3x-1$. Calculate g'(3).
Full solution:

 A: You can factor $x^3+3x-4=(x-1)(x^2+x+4)$, and see that the second term is non-zero, thus the only solution is $g(3)=1$.
In general factoring cubic equations like this can be more of an art than a science. You should ask your instructor what the expectations are in this regard. When I taught similar courses, I would make the expectations clear to the students, for example by saying that if any cubic equations appear, all the solutions would be integers, which makes the factoring process simpler.
A: In this particular instance, some kind of luck or $karma$ lets you and pre-kidney to solve the problem without much ado. In general, cubic equations do not let us solve them this easy.  In your post, you have asked whether there is some math algorithm for solving yours. Of course, there is a method and it is called $\rm\bf{Formula\space of\space Vieta\space \&\space Cardano}$. And there are other methods, which catered specially for equations with real coefficients. To give you some taste of one of these methods, I am giving below the solution to the equation $x^3+3x-4=0$. 
According to this method, the cubic equation $z^3+3pz+2q=0$ have only one real root and two complex roots, if the coefficient of the $z$-term is positive. 
The real root is given by,
$$-2r\sinh\left(\frac{\phi}{ 3}\right), $$
where $r=\pm\sqrt{\|p\|}$ and $\phi=\sinh^{-1}\left(\frac{q}{r^3}\right)$.
In addition to this, the sign of $r$ is the same as the sign $q$.
In your equation, $p=1$ and $q=-2$. Therefore, $r=-1$. This means
$$\phi=\sinh^{-1}\left(2\right)= 1.4436354751788103424932767402731$$
Therefore , the real root is equal to 
$$\left(-2\right)\times \left(-1\right)\times\sinh\left(0.48121182505960344749775891342437\right)=1$$
