For a $C^{\infty}$ function, is it true that $|f'(x)| \leq 1$ implies that $|f(x)| \leq x$? Let $f(x)$ be a nice/$C^{\infty}$ function of some real-variable $x$ which satisfies the inequality
$$
|f'(x)| \leq 1\ \ \ \ \ \ \ \mathrm{for\ all\ }x>0
$$
If this is true, does this imply that
$$
|f(x)| \leq |x| \ \ \ \ \ \ \ \mathrm{for\ all\ }x>0?
$$
Or something similar? This seems to follow by ``integrating both sides''. I've come up with some functions where this seems to be the case (for example $f'(x) = \tanh(x)$ satisfies $|f'(x)| \leq 1$, and $f(x) = \log(\cosh(x))$ satisfies $|f(x)| < |x|$).
If this is true, how can you prove it?
If this is not true, what is an example of a counter-example?
 A: $|f'(x)| \leq 1 $ for $x > 0$ implies that $|f(x) - f(0)| \le |x|$ for $x \ge 0$, that is an immediate consequence of the mean-value theorem. 
You don't need $C^\infty$ for this conclusion, it suffices that $f$ is  continuous for $x \ge 0$ and differentiable for $x > 0$.
If in addition $f(0) = 0$ then indeed $|f(x)| \le |x|$.
A: Take $$f(x)=\cos(x)$$
then
$f$ is $C^{\infty}$ and
$$|f'(x)|\le 1$$
but
$$f(0.00001)>0.00001$$
A: To elaborate a bit: the condition
$$
|f'(x)| \leq 1\quad\text{ for all } x>0
$$
does not imply any bound on $f$ because $f$ can be shifted by a constant and the derivative does not change. For example, we could shift $f$ up by $100$, down by $1000$, and so on, and the derivative would not change.
A concrete counterexample is given in the comments: if $f(x) = 1000$, then $|f'(x)| = 0$ so it is bounded by $1$, but $|f(x)|$ is not bounded by $|x|$.
So, if you want the bound on $|f(x)|$, you need to additionally specify something like $f(0) = 0$. In general, the best bound you can have is
$$
|f(x)| \le |x| + |f(0)|,
$$
which follows by Traingle inequality from Martin's answer.
P.S.: A particular consequence of the bound on the derivative $|f'(x)| \le 1$ that your function $f$ is Lipschitz continuous with constant $1$.
