Goodmorning. I am trying to prove that the following inequality is true for any differentiable function $f: [a,b] \to \mathbb{R}$, where $a,b$ are real and $a<b$: $$|f(x)| \leq \frac{1}{2}\left(|f(a)+f(b)|+\int_a^b|f'(x)|dx\right)\,\,\, \forall x \in [a,b]$$ I have worked on this for about three hours and I'm not making a lot of progress. I have tried using the triangular inequality for absolute values of integrals but it has lead me nowhere and, now that I think about it, I'm not even sure it makes sense to use it because the inequality $$\int_a^b|f'(x)|dx \geq \left|\int_a^bf'(x)dx\right| = |f(b)-f(a)|$$ requires $f'$ to be integrable, which I have no way to prove. On top of that the term $|f(b)-f(a)|$ is not very useful because it does not appear in the expression.
I have also tried the following approach, which I think is much closer to the solution; the original inequality is true if and only if the following is true: $$2|f(x)|-|f(a)+f(b)| \leq \int_a^b|f'(x)|dx$$ Now, by the triangular inequality, $$2|f(x)|-|f(a)+f(b)| \leq |f(x)-f(a)+f(x)-f(b)| \leq |f(x)-f(a)| + |f(x)-f(b)|.$$ We can apply the mean value theorem to prove that, if $x\neq a,b$, there exist $c \in [a,x]$ and $d \in [x,b]$ such that $$|f(x)-f(a)| + |f(x)-f(b)| = \frac{|f(x)-f(a)|}{|x-a|}|x-a| + \frac{|f(b)-f(x)|}{|b-x|}|b-x| = |f'(c)||x-a|+|f'(d)||b-x|.$$ The RHS is a Riemann sum for a very rough partition of $[a,b]$. Where do I go from here? How do I prove that the sum above is actually less than or equal to the integral of $|f'(x)|$. Any help is thoroughly appreciated.
For any $x\in [a,b]$, $$f(x)=f(a)+\int_a^x f'(t)\,dt\quad\text{and}\quad f(x)=f(b)-\int_x^b f'(t)\,dt.$$ Hence, after summing the two equations, we get $$2f(x)=f(a)+f(b)+\int_a^x f'(t)\,dt-\int_x^b f'(t)\,dt$$ which implies, by the triangle inequality, $$2|f(x)|\leq |f(a)+f(b)|+\int_a^x |f'(t)|\,dt+\int_x^b |f'(t)|\,dt\\= |f(a)+f(b)|+\int_a^b |f'(t)|\,dt.$$