Here is the link to the question I was trying to prove:

[Why $f(x) = 0$ is not excluded from the codomain?](https://math.stackexchange.com/questions/4555467/why-fx-0-is-not-excluded-from-the-codomain?noredirect=1#comment9582551_4555467)

And here is its statement:

Suppose $f:[0, \infty) \to \mathbb R$ is a continuously differentiable function and

$\bullet f(0) =1$.

$\bullet f'(x) \leq \frac{-1}{2} f(x)$ for all $x \geq 0.$

Prove that $f(x) \leq e^{\frac{-x}{2}}$ for $x\geq 0.$

**My question is:**

I got a hint (in the link above from Andrew) to consider the function $g(x)$ and specifically, this was the hint:

"Instead, it's cleaner to introduce the function $g(x) = e^{x/2}f(x)$, and use the product rule and $f'(x) \leq -\frac{1}{2}f(x)$ to show $g'(x) \leq 0$ for all non-negative $x$. The mean value theorem together with $g(0) = 1$ then guarantees $g(x) \leq 1$ for all non-negative $x$.
"

I managed to show that $g'(0) \leq 0$ for all non-negative $x$. But I do not know how "The mean value theorem together with $g(0) = 1$ then guarantees $g(x) \leq 1$ for all non-negative $x$." Could someone show me the details of this proof please?