Let $f:[0,1]\to\mathbb{R}$ be a continuous and convex function such that $f(0)=0$ and $\int\limits_0^1 f(x) ~dx=0$. Prove that $$\int\limits_0^1 |f(x)| ~dx=2\cdot \max\limits_{x\in [0,1]}\left|\int\limits_0^x f(t) ~dt\right|.$$
For now I considered just the simpler case when $f(1)\leq 0$. Since a convex function defined on a closed interval attains its maximum on one end of the interval and since $f(0)=0$, it follows that $f(x)\leq 0$ on $[0,1]$; therefore, the function $\int\limits_0^x f(t)~dt$ is decreasing on $[0,1]$, but since its values in $0$ and $1$ are both $0$ this function is constant ($0$) on the whole interval and the conclusion follows easily.
$$ a = \max \{ x \in [0, 1] \mid f(x) \le 0 \} $$ is well-defined since $f(0) = 0$ and $f$ is continuous. Then $f(x) \le 0$ on $[0, a]$ (since $f$ is convex), and $f(x) > 0$ on $(a, 1]$.
The function $F(x) = \int_0^x f(t) \, dt$ is decreasing on $[0, a]$ and increasing on $[a, 1]$ with $F(0) = F(1) = 0$. Now we have $$ \begin{align} \int_0^1 |f(x)| \, dx &= \int_0^a (-f(x)) \, dx + \int_a^1 f(x) \, dx \\ &= -(F(a)-F(0) + F(1)-F(a) \\ &= -2 F(a) \end{align} $$ and $$ \max_{x \in [0, 1]} |F(x)| = \max_{x \in [0, 1]} (-F(x)) = -F(a) \, . $$