# Integral inequality with derivative bound.

Suppose $f \in C^1([0,1])$ and $f(0) = f(1) = 1/2$. Also $|f'(x)| \leq 1$ for all $x \in [0,1]$.

Is it possible that $$\frac{-1}{4} \leq \int_0^1 f(x) \, dx \leq \frac{1}{4} \:?$$

My attempt: Using $-1 \leq f'(x) \leq 1$ and $\displaystyle f(x) - f(0) = \int_0^x f'(t)\,dt$ I get:

$$\frac{1}{2}-x \leq f(x) \leq x + \frac{1}{2}$$

$$0 \leq \int_0^1 f(x) \,dx \leq 1.$$

The integral must be bounded between $0$ and $1$, but I can't determine if there exist functions with these conditions where the integral is in the range $[0,1/4]$.

No, it is not possible. Using the fact that $f(0) = 1/2 = f(1)$ and the derivative bound, we have that
$$f(x) \ge \max\{1 - x, x - 1\}$$
(draw the picture of what this means!). Hence $\int_0^1 f(x) \, dx \ge \frac 1 4$. On the other hand, one can argue that (again because of the derivative bound, together with the fact that $f \in C^1$) that $f(1/2)$ must actually be strictly positive, giving just a little bit more to the integral.
What is true is that you can find a sequence $f_n$ for which $\int_0^1 f_n(x) \, dx \to \frac 1 4$ from above.