Max value of alpha such that the function equality is reached Let $\mathrm{f}:[0,1] \rightarrow \mathrm{R}$ be continuously differentiable function and
$$
\left|\frac{f(0)+f(1)}{2}-\int_{0}^{1} f(x) d x\right| \leq \alpha \max _{x \in[0,1]}\left|f^{\prime}(x)\right|, \text { then } \alpha=?
$$ My work : by letting $f'(x) = \lim\limits_{h\to 0} \frac{f(x+h) -f(x)}{h}$, i considered converting the given functional inequality into $f'(x)$ type by letting $f(0) +f(1) <= 2\max f(x)$ but dont have any progress after that it will turn to be $\max f(x)$ - that integral modulus, maybe By Parts can be applied to get ? Answer is 1/4 though
 A: Here is an answer with the $\alpha=1/4$ bound. We use the fundamental theorem of calculus twice to get
$$f(x) = f(0) + \int_0^x f'(t)\, dt,$$
$$f(x) = f(1) - \int_x^1 f'(t) \, dt.$$
Average the two equations to get
$$f(x) = \frac{f(0) + f(1)}{2} + \frac{1}{2}\left(\int_0^x f'(t)\, dt -  \int_x^1 f'(t) \, dt\right).$$
Rearrange and integrate both sides to get
$$\int_0^1 f(x) \, dx - \frac{f(0) + f(1)}{2} = \frac{1}{2}\int_0^1\left(\int_0^x f'(t)\, dt -  \int_x^1 f'(t) \, dt\right)\, dx.$$
Let's work on the right side now. Swapping the order of integration we have
$$\int_0^1\int_0^x f'(t)\, dt\, dx = \int_0^1 \int_t^1 f'(t) \, dx \,dt = \int_0^1 (1-t)f'(t)\, dt. $$
Similarly we have
$$\int_0^1\int_1^x f'(t)\, dt\, dx = \int_0^1 \int_0^t f'(t) \, dx \,dt = \int_0^1 tf'(t)\, dt. $$
Plugging these in above we have
$$\int_0^1 f(x) \, dx - \frac{f(0) + f(1)}{2} = \frac{1}{2}\int_0^1 (1-2t)f'(t)\, dt.$$
To obtain the bound, we just apply absolute values on both sides:
$$\left|\int_0^1 f(x) \, dx - \frac{f(0) + f(1)}{2}\right| \leq \frac{1}{2}\int_0^1 |1-2t||f'(t)|\, dt \leq \frac{1}{4}\max_{0\leq t \leq 1}|f'(t)|.$$
Since everything was an equality up to the last line, we can see that an optimal choice for $f$ (to maximize the bound) would satisfy
$$f'(t)=
\begin{cases}
1,&\text{if } 0 \leq t \leq \frac{1}{2}\\
-1,&\text{if } \frac{1}{2} \leq t \leq 1.
\end{cases}$$
Such an $f$ is a triangle function. In this case we have
$$\int_0^1 f(x) \, dx - \frac{f(0) + f(1)}{2} = \frac{1}{2}\int_0^1 |1-2t|\, dt = \frac{1}{4}.$$
Of course, such an $f$ is not continuously differentiable, but we can take any smooth approximation to show the optimality.
