Prove the following integral inequality [contest math] Let 
$$\mathbb{A} = \{f\in R([0,1]):f(0)=f(1)=0,f'(0)=a\}.$$
Then find 
$$\min_{f\in \mathbb{A}}\int _{0}^{1}[f''(x)]^2dx$$ and also find $f$ when the minimum is attained.
I was just trying to apply the Cauchy's inequality to get that 
$$\left(f'(1)-a\right)^2=\left(\int_{0}^{1}f''(x)\right)^2\leq \int _{0}^{1}[f''(x)]^2dx.$$
What do I do after this? 
The correct bound is $3a^2.$
 A: Let $p(x) = x(1-x)(1-x/2)$. It is easy to see $p(0) = p(1) = 0$ and $p'(0) = 1$.  
Rewrite $f(x)$ as $h(x) + ap(x)$, we will have $h(0) = h(1) = h'(0) = 0$.
Furthermore,
$$\int_0^1 f''(x)^2 dx =
  \int_0^1 h''(x)^2 dx + 2a\int_0^1 h''(x) p''(x) dx + a^2\int_0^1 p''(x)^2 dx\tag{*1}$$
Since $p''(x) = 3(x-1)$, the middle term is $6a$ times
$$\begin{align}\int_0^1 h''(x)(x-1) dx
&= \int_0^1 (x-1) dh'(x) \\
&= [ (x-1) h'(x) ]_0^1 - \int_0^1 h'(x) dx\\
&= [ (x-1) h'(x) - h(x) ]_0^1\\
&= [ (1-1)h'(1) - h(1) ] - [(0-1)h'(0) - h(0) ]\\ 
&= 0\end{align}\tag{*2}$$
As a result,
$$\int_0^1 f''(x)^2 dx = \int_0^1 h''(x)^2 dx + 9a^2\int_0^1 (x-1)^2 dx
= \int_0^1h''(x)^2dx + 3a^2
\ge 3a^2$$
It is trivial to see $$\min_{f \in \mathbb{A}} \int_0^1 f''(x)^2 dx = 3a^2$$ because we can take $h(x)$ to be identically $0$ and then $f = ap \in \mathbb{A}$.

Background material
The sort of decomposition in $(*1)$ and the process to get rid of cross terms in $(*2)$ using integration by parts is essentially what is behind the proof that 
the function $q \in C^{2n}([a,b])$ which minimizes a functional of the form 
$$S(q) = \int_a^b L(t,q(t),q'(t),q''(t),\ldots,q^{(n)}(t)) dt$$
satisfies the Euler-Lagrange equation
$$
\frac{\partial L}{\partial q} - \frac{d}{dt}\left(\frac{\partial L}{\partial q'}\right)
+ \frac{d^2}{dt^2}\left(\frac{\partial L}{\partial q''}\right)
 - \cdots + (-1)^n \frac{d^n}{dt^n}\left(\frac{\partial L}{\partial q^{(n)}}\right) = 0$$
For the problem at hand, $L = (f'')^2$. The EL equation tell us the minimal $f$
satisfy:
$$\frac{d^2}{dt^2}\frac{\partial L}{\partial f''} = 2 \frac{d^2}{dt^2} f'' = 2 f^{(4)} = 0$$
This means $f$ is a polynomial with degree at most $3$. Using the given initial condition, we find the minimal $f$ has the form $ax(1-x)(1-bx)$. What's remain is search for a $b$ which allow the cross term to vanish.
