Integral of a square compared to the square of an integral

What can be said about a complex valued, continuous function $f$, defined on $[0,1]$, such that: $$\int_0^1{|f|^2}=\left|\int_0^1{f}\right|^2$$ I encountered this form as part of an exercise. Obviously, the above holds for any constant $f$, and it seems intuitive that the converse also holds (i.e. that if the above equality is true, then $f$ is constant), but I could not prove it.

Any help will be appreciated.

• @GPerez No, both absolute values are complex. Apr 13, 2015 at 18:13
• What you are trying to prove is false. The $L^2$ norm does not equal the $L^1$ norm in general for constant functions. Notice that $\int C^2 =(b-a)C^2$ whereas $(\int C )^2 = (b-a)^2 C^2$. Apr 13, 2015 at 18:50
• Thanks for all of your comments. I corrected the question. Apr 13, 2015 at 18:53
• This can also be proven using Parsevals theorem. Apr 13, 2015 at 18:59
• Also look for "Jensen's Inequality". Apr 13, 2015 at 20:21

This is a case of equality in the Cauchy-Schwarz Inequality $$\left|\int_{0}^1 f\overline g\right|^2\leq \int_0^1 |f|^2\int _0^1|g|^2$$ where $$g=1$$ is a constant function. And the equality holds if and only if $$f$$ and $$g$$ are dependent,i,e $$f$$ is a scalar multiple of $$g$$.
Note that when we change the bounds to $$a,b$$, the equality in question is not true for constants functions $$f$$