## integrals squared

I'm working through a proof for part of my university project and I'm a little stuck understanding part of it:
if:
$\int_0^1 (f(x))^2 dx =\left(\int_0^1 f(x)dx \right)^2
$

then f(x) = constant
why does this prove f(x) is constant?
Thankyou