This looks like a very trivial question, but I could not find an answer on the web or my usual math references.
Suppose I have an inequality of the form $f(x) + g(x) \leq 0$ where $f$ and $g$ are, say, $C^2$. When is it allowed to take the derivative w.r.t. $x$ of both sides of the inequality without reversing the $\leq$ sign or otherwise doing something illegal? I know that if I have an identity $f(x) + g(x) = 0, \; \forall x \in \mathbb{R}$, then it is of course permissible to take derivatives of it, but not for a general equality.
Thanks in advance!