TITLE: Example of the equality of an inequality
QUESTION [5 upvotes]: 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.

REPLY [2 votes]: 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.