How prove this $\int_{a}^{b}f^2(x)dx\le (b-a)^2\int_{a}^{b}[f'(x)]^2dx$ let $f\in C^{(1)}[a,b]$,and such that $f(a)=f(b)=0$, show that

$$\int_{a}^{b}f^2(x)dx\le (b-a)^2\int_{a}^{b}[f'(x)]^2dx\cdots\cdots (1)$$

My try: use Cauchy-Schwarz inequality
we have

$$\int_{a}^{b}[f'(x)]^2dx\int_{a}^{b}x^2dx\ge \left(\int_{a}^{b}xf'(x)dx\right)^2$$
  $$\Longrightarrow \int_{a}^{b}[f'(x)]^2dx\ge\dfrac{3\left(\displaystyle\int_{a}^{b}xdf(x)\right)^2}{(b^3-a^3)}=\dfrac{3\left(\displaystyle\int_{a}^{b}f(x)dx\right)^2}{b^3-a^3}$$
  so we only show that following 
  $$\dfrac{3\left(\displaystyle\int_{a}^{b}f(x)dx\right)^2}{b^3-a^3}\ge\dfrac{\displaystyle\int_{a}^{b}f^2(x)dx}{(b-a)^2}$$
  maybe this is not true. so How prove it by (1)

Thank you 
 A: In fact it is known that the sharp inequality is a factor of $\pi^2$ better:
$$
\int_a^b f^2(x) dx \leq \frac{(b-a)^2}{\pi^2} \int_a^b [f'(x)]^2 dx
$$
with equality iff $f(x) = c \sin(\pi\frac{x-a}{b-a})$ for some constant $c$.
This is a form of 
Wirtinger's inequality, 
most easily proved by expanding $f$ in a Fourier sine series.
A: Let $\displaystyle\;\;\lambda = \frac{\pi}{b-a}.\;\;$ Since $f(a) = f(b) = 0$ and $f \in C^1[a,b]$, the function defined by:
$$\varphi(x) = \begin{cases}
\dfrac{f'(a)}{\lambda}, & x = a\\
\\
\\
\dfrac{f(x)}{\sin(\lambda(x-a))}, & a < x < b\\
\\
\\
-\dfrac{f'(b)}{\lambda}, & x = b
\end{cases}$$
is $C^1$ over $(a,b)$ and continuous at $a$ and $b$. We have
$$\int_a^b |f'(x)|^2 dt
= \int_a^b \Big(\varphi'(x) \sin(\lambda(x-a)) + \lambda \varphi(x) \cos(\lambda(x-a))\Big)^2 dx
$$
Notice the cross term in the integrand can be simplified as:
$$\begin{align}
  & 2\lambda \varphi(x)\varphi'(x) \sin(\lambda(x-a))\cos(\lambda(x-a))\\
= & \frac{\lambda}{2} (\varphi^2(x))'\sin(2\lambda(x-a))\\
= & \frac{\lambda}{2} \frac{d}{dx}\left[ \varphi^2(x) \sin(2\lambda(x-a))\right] - \lambda^2 \varphi^2(x) \cos(2\lambda(x-a))
\end{align}$$
We find
$$\begin{align}
  & \int_a^b |f'(x)|^2 dt\\
= & \int_a^b \Big( |\varphi'(x)|^2 + \lambda^2 |\varphi(x)|^2 \Big) \sin^2(\lambda(x-a)) dx 
+ \frac{\lambda}{2} \left[\varphi^2(x) \sin(2\lambda(x-a))\right]_a^b\\
\ge & \lambda^2 \int_a^b |\varphi(x)|^2 \sin^2(\lambda(x-a)) dx\\
=   & \lambda^2 \int_a^b |f(x)|^2 dx\\
\ge & \frac{1}{(b-a)^2} \int_a^b |f(x)|^2 dx
\end{align}
$$
Please note that above steps actually contain a proof of Wirtinger's inequality for functions mentioned in Noam's answer. For other proofs of this inequality, please see this
question and the links there.
A: other solution
let $$F(x)=\int_{a}^{x}f(t)dt$$
then
$$|F(x)|\le\int_{a}^{b}|f(t)|dt\le(b-a)^{\frac{1}{2}}\left(\int_{a}^{b}f^2(t)dt\right)^{\frac{1}{2}}$$
and
$$\int_{a}^{b}f^2(x)dx=-\int_{a}^{b}F(x)f'(x)dx\le (b-a)^2\int_{a}^{b}[f'(x)]^2dx$$
A: Another solution: 
Use integration by parts:
$$
\int_a^b f(x)^2 dx = -\int_a^b 2(x-\frac{a+b}{2})f(x)f'(x) dx
$$
Use $2|x- \frac{a+b}{2}|\leq b-a$ for all $x\in [a,b]$, and Cauchy-Schwarz. Then 
$$
\int_a^b f(x)^2 dx \leq (b-a)\left[\int_a^b f(x)^2dx\right]^{\frac{1}{2}}\left[\int_a^b f'(x)^2 dx\right]^{\frac{1}{2}}
$$
A: We have
$$\int_a^bf^2(x)dx=\int_a^b\left(\int_a^x f'(y)dy\right)^2dx$$
and by Cauchy-Schwarz
$$\left(\int_a^x f'(y)dy\right)^2\leq \int_a^x[f'(y)]^2dy\int_a^x1dy=(x-a)\int_a^x[f'(y)]^2dy$$
thus we get
$$\begin{align}
\int_a^bf^2(x)dx &\leq \int_a^b(x-a)\int_a^x [f'(y)]^2dydx\\
&\leq \int_a^b(b-a)\int_a^b [f'(y)]^2dydx=(b-a)^2\int_a^b [f'(y)]^2dy
\end{align}$$
as desired.
A: Let $M=|f(x_0)|=\|f\|_{C[a,b]}.$ By Cauchy-Schwarz 
$$(b-a)^2\int_a^bf'^2(x)dx\ge (b-a)\int_{a}^{x_0}1dx\int_a^{x_0}f'^2(x)dx\ge(b-a)\left(\int_a^{x_0}f'(x)dx\right)^2$$$$=M^2(b-a)\ge \int_a^bf^2(x)dx$$
where the last inequality follows from the fact that $f^2(x)\le M^2.$ 
P.S. It is enough to request $f$ to vanish at one endpoint only. 
