Practice problem from Mean Value Theorem in Real Analysis

Can someone give an insight on the following problem? I'm not sure how to start the problem. It's a practice problem for "mean value theorem" and "Taylor's Theorem" so I'm assuming they might be necessary for the proof. Thanks!

Let $f: \mathbb{R} \to \mathbb{R}$ be a function. Suppose that $f$ is differentiable, that $f(0)=1$, and that $|f'(x)| \leq 1$ for all $x \in \mathbb{R}$. Prove that $|f(x)| \leq |x|+1$ for all $x \in \mathbb{R}$.

Lets work by contradiction. Assume that $x\geq 0$ (I leave the negative reals for you) Suppose there is a point $x_0$ such that $f(x_0)>1+x_0$. (Note: Here $|x|=x$ since we are dealing with the non-negative reals) Then we have $$\frac{f(x_0)-f(0)}{x_0}>\frac{x_0+1-1}{x_0}=1,$$ so that by the mean value theorem there is a point $c\in (0,x_0)$ such that $f^'(c)>1$ which is a contradiction.

Hope that helps,

As an example, I will show how to prove something different using the mean value theorem.

$$|\cos y - \cos x| \leq |y - x|$$

The mean value theorem says that for $x \lt y$, there is some $c \in (x,y)$ such that

$f(y) - f(x) = (x-y) f'(c)$.

For instance, when when $f(x) = \cos x$ we have that

$\cos y - \cos x = (y-x) (-\sin c)$

Now if we take the modulus,

$|\cos y - \cos x| = |y - x| |\sin c| \leq |y - x|$, (as $|\sin c| \leq 1$).

Thus using the mean value theorem, we have proven that

$|\cos y - \cos x| \leq |y - x|$

Do you see how to solve your problem now?

Try using the mean value theorem: for any $x$ we know there is some $a$ between $0$ and $x$ such that $$\frac{f(x)-1}{x} = f'(a)$$. Rearranging gives $f(x) = 1 + xf'(a)$. Now take absolute values and use the triangle inequality.