The mean value theorem says that there is an x in the interval (a,b) such that .

Now, we know that g' is nonzero (you assumed it), and if g(a) g(b), we can write .

As we know f(a) = g(a) = 0,

If we take the limit of both sides, then x and b will approach the same point.