Show that $f(x) = 1$ for all the interval Let $f(x)$ a continuous function over $[a,b]$
Suppose that 
$$\frac{1}{b-a} \int_a^b (f(x))^2 \, dx = 1$$
And
$$\frac{1}{b-a} \int_a^b f(x) \, dx = 1$$
Show that $f(x) = 1$ for all $x \in [a,b]$.
I've tried to use the Mean Value Theorem for integrals and I've just got that exist $c \in [a,b] $ such that $f(c) = 1$ ,  I am not sure how to introduce the first assumption.
Thanks in advance 
 A: Outline:
Show that if $g$ is continuous and non-negative in $[a,b]$ and $\int_a^b g(x) \, dx  = 0$ then $g(x)=0$.
Then prove this condition is true for $g(x)=(f(x)-1)^2$.
A: Alternate approach use the identity:
$$\int_a^b f^2(x)\,dx\int_a^b g^2(x)\,dx - \left(\int_a^b f(x).g(x)\,dx\right)^2 \\= \frac{1}{2}\int_a^b\int_a^b (f(x)g(y) - g(x)f(y))^2\,dx\,dy$$
with $g(x) = 1$, the $LHS = 0$ by the given conditions, which imply $f(x) =f(y)$
since, $(f(x) - f(y))^2 \ge 0$ and $$\displaystyle \int_a^b\int_a^b (f(x) - f(y))^2\,dx\,dy = 0 \implies f(x) - f(y) = 0$$
i.e., $f$ is a constant function.
Note: This is a proof of Cauchy-Schwarz Inequality and you equations are dealing with the equality case of this inequality.
A: Let's assume $a=0,b=1$ (just to make it simpler). So, the givens are $\newcommand{\d}{\operatorname{d}\!}\int_0^1(f(x))^2\d x=1$ and $\int_0^1f(x)\d x=1$.
Now, consider the value $\int_0^1(f(x)-1)^2\d x$. Note that $\int_0^1(f(x)-1)^2\d x=0$ iff $f(x)=1$. (Do you see why?)
Now:
\begin{align}
\int_0^1(f(x)-1)^2\d x&=\int_0^1\left((f(x))^2-2f(x)+1\right)\d x\\
&=\int_0^1(f(x))^2\d x-2\int_0^1f(x)\d x+\int_0^11\d x\\
&=1-2+1\\
&=0
\end{align}
Thus, $\int_0^1(f(x)-1)^2\d x=0$, and therefore $f(x)=1$.
A: Hint: 
First, suppose $a=0$ and $b=1$, it will make things easier. Now, suppose $f$ is not $1$ all the time. Hence you could pick a small interval $I\subset [0,1]$ such that $f(x)>1+\epsilon$ for all $x\in I$, where $\epsilon>0$ is a constant. Can you make a contradiction from here? (Note that if $f(x)>1+\epsilon$, then $f^2>f$)
