Example of the equality of an inequality This question is related to Daniel Fischer's answer here.
Suppose $f$ is a real $C^{1}$ function on $[0, 1]$ such that $f(0) = 0$ and $\int_{0}^{1}f'(x)^{2}\, dx \leq 1$. Then (essentially by Cauchy-Schwarz), we have $\left|\int_{0}^{1}f(x)\, dx\right| \leq 2/3$ as Daniel Fischer stated in his answer.
My question is: Is there an example of a function such that we have equality in $\left|\int_{0}^{1}f(x)\, dx\right| \leq 2/3$? I was thinking of maybe a smoothed version of a function which takes the value $0$ on $[0, 1/2)$ and $4/3$ on $(1/2, 1]$ but that seems complicated to construct, moreover, the derivative in some neighbourhood of $1/2$ might be hard to control.
 A: No, we can't ever reach $\frac23$. When applying the Cauchy-Schwarz inequality
$$\int_0^x 1\cdot f'(t)\, dt \leqslant \left(\int_0^x 1^2\,dt\right)^{1/2}\left(\int_0^x f'(t)^2\,dt\right)^{1/2} = \sqrt{x}\left(\int_0^x f'(t)^2\,dt\right)^{1/2},$$
we have two factors that ensure that the inequality $f(x) < \sqrt{x}$ is strict.


*

*For small $x$, the integral $\int_0^x f'(t)^2\,dt$ is small, much smaller than $1$.

*We only have equality in the Cauchy-Schwarz inequality if the two functions differ only by a constant factor.


The first defect is minimised if the bulk of the weight of $f'$ is concentrated near $0$, but that increases the difference in the CS inequality.
We can get $\int_0^1 f(x)\,dx = \frac{\sqrt{3}}{3}$ by choosing $f'(x) = \sqrt{3}(1-x)$, and that is the maximal possible value:
$$\begin{align}
\int_0^1 f(x)\,dx &= \int_0^1 \int_0^x f'(t)\,dt\,dx\\
&= \iint_{0 \leqslant t \leqslant x\leqslant 1} f'(t)\,dt\,dx\\
&= \int_0^1 \int_t^1 f'(t)\,dx\,dt\\
&= \int_0^1 (1-t)f'(t)\,dt\\
&\leqslant \left(\int_0^1 (1-t)^2\,dt\right)^{1/2}\left(\int_0^1 f'(t)^2\,dt\right)^{1/2}\\
&= \sqrt{\frac13} = \frac{\sqrt{3}}{3}.
\end{align}$$
A: Since another question was linked here as duplicate I would like to give an alternative solution to the problem 
$$
\max\int_0^1f(x)\,dx,\qquad f(0)=0,\ \int_0^1\dot f^2(x)\,dx\le 1.
$$
If we, for example, did not get the intuition for the artistic solution by CS above, we can try to approach the problem in a more standard way via the variational calculus.


*

*Formalization: we have the minimization problem with one functional constraint and one fixed point (the left end)
$$
\min\int_0^1(-f(x))\,dx,\qquad f(0)=0,\ \int_0^1\dot f^2(x)\,dx\le 1.
$$

*Use Lagrange multiplier method to include the constraint into the optimization with $\lambda\ge 0$
$$
\min\int_0^1(-f(x)+\lambda(\dot f^2(x)-1))\,dx=\min\int_0^1\bigl(-f(x)+\lambda\dot f^2(x)\bigr)\,dx-\lambda,\qquad f(0)=0
$$

*Write down the Euler-Lagrange equation
$$
-1+2\lambda\ddot f(x)=0,\quad f(0)=0.
$$
Here we see that $\lambda\ne 0$ (otherwise no solutions), so $\lambda>0$. [It explains, in particular, why the constraint must be active, i.e.  $\|\dot f\|_2^2=1$, because the complementary slackness principle tells us that $\lambda(\|\dot f\|_2^2-1)=0$.]

*Add the natural boundary condition at the free right end
$$
2\lambda\dot f(1)=0.
$$

*The solution to the E.-L. equation with two boundary conditions gives
$$
f(x)=\frac{1}{4\lambda}x(x-2).
$$

*Using the fact that the constraint must be active, we find $\lambda$ from the equation
$$
1=\int_0^1\dot f^2(x)\,dx=\int_0^1\frac{1}{4\lambda^2}(x-1)^2\,dx\quad\Rightarrow\quad\lambda=\frac{1}{2\sqrt{3}}.
$$
Thus
$$
f(x)=\frac{\sqrt{3}}{2}x(x-2).
$$

*Convexity of the problem makes the Euler-Lagrange equation sufficient for the minimum (the same proof as in Theorem 4.3, page 12).

*Change the sign for $f$ to get the solution to the original problem.

