I've tried to solve the following problem (1.1.30 from Berkeley Problems in Mathematics, no solution is provided therein), but I'm not sure if my solution is correct. I wanted to ask you for your opinion.
The problem: Let $S$ be the set of all real $C^1$ functions $f$ on $[0,1]$ such that $f(0)=0$ and $$ (*)\int_0^1f'(x)^2\mathrm{d}x\leq 1 $$ Define $$ J(f) = \int_0^1 f(x)\mathrm{d}x. $$ Prove that the function $J$ is bounded on $S$ and compute its supremum. Is there a function $f_0\in S$ at which $J$ attains its supremum? If so, give $f_0$.
My attempts: First note that for any $y\in[0,1]$, $\int_0^1 f'(x)^2\mathrm{d}x \geq \int_0^y f'(x)^2\mathrm{d}x$. Thus, using the Cauchy Schwartz inequality,
$$1\geq \int_0^y f'(x)^2\mathrm{d}x \cdot\underbrace{\int_0^1 1^2\mathrm{d}x}_{\geq\int_0^y 1^2\mathrm{d}x}\geq \left(\int_0^y f'(x)\cdot 1\mathrm{d}x\right)^2=(f(y)-f(0))^2=f(y)^2 $$ which implies that $|f(y)|\leq 1$. Therefore, $J(f)\leq|J(f)|\leq1$ so we have shown boundedness.
The rest is still a bit shaky:\ Now the supremum of $J$ on $S$ is attained when the equality in $(*)$ holds (why is that? I'm not sure I could show this). This is the case for $f_0(x)=x$. Now $J(f_0)=\frac{1}{2}$. My guess is that therefore $J(f)\leq \frac{1}{2}$ is the supremum and maximum.
Thank you for your suggestions.