How find the minimum of the value $k$ such this intergral $\int_{0}^{1}f^2(x)dx\le k\left(\int_{0}^{1}f(x)dx\right)^2$ 
Find the minimum of the value $k$, such have 
  $$\int_{0}^{1}f^2(x)dx\le k\left(\int_{0}^{1}f(x)dx\right)^2$$
  for any integrable function $f(x)$,and 
    $1\le f(x)\le 2,x\in(0,1)$ 

My idea: use Cauchy-Schwarz inequality we have
$$\int_{0}^{1}f^2(x)dx\ge\left(\int_{0}^{1}f(x)dx\right)^2$$
I know this can't usefull to solve my problem. Thank you
 A: 1). Since $(2-f(x))(f(x)-1)\geq0$, so
$$\int_0^1\Big(2-f(x)\Big)\Big(f(x)-1\Big)\,dx\geq0$$
that is 
$$3\int_0^1f(x)\,dx-2\geq \int_{0}^{1}f^2(x)\,dx$$
2). Set $t=\int_0^1f(x)\, dx$, $1\leq t\leq2$. We want 
$$kt^2\geq 3t-2\qquad1\leq t\leq2$$
that is $kt+\dfrac2t\geq3$. By A-G inequality, we get 
$$k\geq\dfrac98$$
On the other hand
$$\dfrac98t^2- \big(3t-2\big)=\dfrac98\Big(t-\frac43\Big)^2\geq0$$
so $k=\dfrac98$ is sufficient!
3) If $\int_{0}^{1}f^2(x)dx=\dfrac98\left(\int_{0}^{1}f(x)dx\right)^2$, we have 
$$t=\int_{0}^{1}f(x)dx=\frac43\qquad \int_{0}^{1}f^2(x)\,dx=2$$
en
\begin{equation}f(x)=\begin{cases}1& 0\leq x\leq\frac23\\2&\frac23\lt x\leq1\end{cases}\end{equation}
A: Let $k=\sup_{f:[0,1]\to[1,2]}\frac{\int f^2}{(\int f)^2}.$ The function $f(x)=2$ if $x\le\frac13$ and $f(x)=1$ otherwise provides the lower bound $k\ge\frac98$. I claim that $k=\frac98$. Let $\epsilon(x)=\epsilon\,\delta_a(x_0)$ be a rectangular bump function at $x_0$ with width $a\ll1$ and integral $\epsilon\ll a$.
$$\Big(\int f(x)+\epsilon(x)\,dx\Big)^2=\Big(\int f\Big)^2+2\epsilon\int f+\epsilon^2\\
\int (f(x)+\epsilon(x))^2\,dx=\int f^2+2\epsilon f(x_0)+\epsilon^2/a$$
Thanks to our choices $\epsilon\ll a\ll1$, we can ignore the final term of each expansion, so we are left with the (unsurprising) conclusion that given any $f$, we can increase the quantity $\int f^2/(\int f)^2$ by moving a chunk of $f$ away from its average value. Thus any extremal $f$ must have every point as far from its average value as possible, that is, we must have $f:[0,1]\to\{1,2\}$. The integrals of such functions are driven entirely by the measure of $f^{-1}(\{2\})$; labeling this quantity as $z$, we have
$$\int f^2=4z+(1-z)=3z+1\\
\Big(\int f\Big)^2=(2z+(1-z))^2=(z+1)^2,$$
and the quantity $\frac{3z+1}{(z+1)^2}$ attains a unique maximum in $[0,1]$ at $z=\frac13$, with value $\frac98$ (and leading to our original example for a lower bound). Thus $k=\frac98$.
