TITLE: Show that $f(x) = 1$ for all the interval
QUESTION [5 upvotes]: 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

REPLY [2 votes]: 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$.