Prove that $f(x)=1$ if and only if $\lim_{n\to \infty} \int_0^1 (f(x))^n\, dx = 1$ Suppose that $f$ is continuous on $[0,1]$.  Prove that $f(x) = 1$ if and only if
$$
\lim_{n\to \infty} \int_0^1 (f(x))^n\, dx = 1.
$$
The $\implies$ direction is clear to me: one can interchange the order of the limit and the integral because the sequence $[f(x)]^n = 1^n$ converges uniformly to $1$.  However, I am having trouble proving the $\impliedby$ direction.  Thank you for any advice on how to solve this.
 A: HINT: Suppose that $|f(x)|>1$ for some $x\in [0,1]$. Use continuity of $f$ to argue that, for some $\epsilon>0$, there exists $[a,b]\subset [0,1]$ such that $|f(x)|\ge 1+\epsilon$ for all $x\in [a,b]$. This allows you to show that $\int_0^1 f(x)^{2n}dx\ge (b-a)(1+\epsilon)^{2n}\to\infty$, clearly contradicting the assumption that the limit equals $1$.
Thus, we have $|f(x)|\leq 1$ for all $x\in [0,1]$. Now suppose there exists $x\in [0,1]$ such that $|f(x)|<1$. You can then argue that there exists $\epsilon>0$ such that $|f(x)|<1-\epsilon$ for all $x\in[a,b]\subset [0,1]$ for some interval $[a,b]$. Using the triangle inequality, this allows you to deduce that $\big|\int_0^1 f(x)^ndx\big|\leq 1-(b-a)(1-(1-\epsilon)^n)$ and therefore the limit is less than or equal to $1-(b-a)<1$, contradicting the assumption again.
Hence, $|f(x)|$ can never be greater than $1$ or less than $1$, thus $|f(x)|=1$ for all $x\in [0,1]$. From continuity, you have that either $f(x)=1$ or $f(x)=-1$, and the latter possibility can easily be ruled out.
Can you fill in the details?
A: Here is a supplement.  A harmless bit of entertainment on the theme of the problem.
The methods of the calculus (yes, those ancient methods) are adequate for many simple problems.   The other answer gives the best argument available at that level.
Here, for those interested, is the modern method for such problems.  You don't have to follow closely.  Just see how splitting the set $[0,1]$ into separate sets and integrating on each one allows a deeper analysis of the problem.
If you know the Lebesgue integral you know this stuff.
Problem.  Suppose that $f$ is Lebesgue integrable on $[0,1]$ and that
$$ \int_0^1 [f(x)]^n\,dx \to 1 \tag{*}$$
as $n\to \infty$.    Show that   $f(x)=1$ almost everywhere.
In particular, if $f$ is Riemann integrable then $f(x)=1$ at every point at which $f$ is continuous.  If $f$ is continuous then $f(x)=1$ at every point.
Claim 1. $ |f(x)|  =1$  almost everywhere in  $[0,1]$.
Define  $g_n(x) = [f(x)]^{2n}$ so that
$$ \int_0^1 g_n(x) \,dx \to 1$$
Let   $A =  \{ x\in [0,1]:  0   \leq |f(x) |< 1 \}$
Note that  $g_n$  tends   to zero on  $A$  and is uniformly bounded.  Hence
$$\int_A g_n(x)\,dx \to 0 . \tag{1}$$
Let  $B =  \{ x\in [0,1]:     |f(x)| =1 \}$
Note that   $g_n$  is constant on   $B$ and so
$$\int_B g_n(x)\,dx =|B|, \tag{2}$$
i.e., the measure of the set  $B$.
Let  $C=  \{ x\in [0,1]:     |f(x)| > 1 \}$
Note that   $g_n$   tends monotonically up to $\infty$ on  $C$ so $|C|=0$ since otherwise
$$\int_C g_n(x)\,dx  \to\infty , \tag{3}$$
which is impossible.
Then
$$ \int_0^1 g_n(x)\,dx = \int_A g_n(x)\,dx  +  \int_B g_n(x)\,dx +  \int_C g_n(x)\,dx  \to 1$$
which is only possible if $|B|=1$, i.e., if $|A|=|C|=0$.
Claim 2: $f(x)=1$ almost everywhere.
If $|f(x)|=1 $ a.e. is it possible that $f(x)=-1$ on a set $N$  of positive measure?
If that were so then $ \int_N f^n $ would alternate between $|N|$ and $-|N|$ which violates the condition (*).
