If $f'(x)\le g'(x)$, prove $f(x)\le g(x)$

I have to do the following exercise:

Let $f$ and $g$ two differentiable functions such that $f(0)=g(0)$ and $f'(x)\leq g'(x)$ for all $x$ in $\mathbb{R}$. Prove that $f(x)\leq g(x)$ for any $x\geq0$.

Now, I know this is true because the first derivative of a function is the angular coefficient of the function in a point $x$. So, $f'(x)\leq g'(x)$ means, in other words, that the function $g(x)$ grows faster than $f(x)$. I think this is the base for a more formal proof, could someone help me to figure out a more formal proof?


Hint: consider the function $h(x) := g(x) - f(x)$, so that $h(0) = 0$ and $h'(x) \geq 0$ for every $x\geq 0$.

Now, for a fixed $x> 0$, it is enough to apply the mean value theorem to $h$ in the interval $[0, x]$.


For $x \ge 0$, we have

$f(x) = f(0) + \displaystyle \int_0^x f'(s) ds = g(0) + \displaystyle \int_0^x f'(s) ds, \tag{1}$

since $f(0) = g(0)$; and since $f'(x) \le g'(x)$, we have

$\displaystyle \int_0^x f'(s) ds \le \displaystyle \int_0^x g'(s) ds; \tag{2}$

thus,

$f(x) = g(0) + \displaystyle \int_0^x f'(s) ds \le g(0) + \displaystyle \int_0^x g'(s) ds = g(x). \tag{3}$

NB: Note added in edit: I think it is only fair to admit this is sort of a "low-tech" argument, since it does in fact assume $f, g \in C^1$. Something suitable for first-year calculus. Rigel's answer above seems to indicate a more sophisticated view of the matter.