# What are the regularity conditions for differentiating an inequality?

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.

-
This generally can't be done. Consider something like $h(x)= x +x\sin(1/x)$, $x>0$ (this is for $\Bbb R^+$; but, suitable alterations can be made to provide a counterexample in all of $\Bbb R$. The point is $f$ can be small but $f'$ can nevertheless be big). – David Mitra Feb 16 '12 at 16:43

After taking the derivative, the inequality need not hold in either direction. As a counterexample: Let $f(x)=1$ and $g(x)=\cos( x)$. Then $f(x)+g(x)\ge 0$ for all $x$ in $\Bbb R$; but $f'-g'$ takes on both positive and negative values.

I don't think there are any general conditions that give you what you want, other than those that actually give the inequality for the derivatives.

What goes wrong here, is that in most cases, given a smooth function $f$ that satisfies a given inequality, it is possible to find another function that satisfies the same equality but whose derivative takes on arbitrarily large positive and negative values (make the graph of $f$ "wavy" by, for example adding the term $\alpha\sin(\beta x)$ where $|\alpha|$ is small and $\beta$ is big).

-