When does the integral vanish?

Let $\mu$ be a positive Borel measure on $(0,1)$ and $g \in L^2(\mu)$ be such that $\|g\|_2 = 1.$ Then does there exist $f \in C_0 ((0,1))$ such that $\int_{(0,1)} |g|^2 (f - 1)\ d\mu = 0\ $?

If we can show that the above integral is zero iff $f - 1 = 0$ almost everywhere then by continuity of $f$ we have $f \equiv 1$ on $(0,1).$ But then $f \notin C_0((0,1))$ for otherwise it approaches to $0$ near the endpoints which is not the case.

Any help would be appreciated.


I suppose $C_0(0,1)$ stands for continuous functions on $(0,1)$ which tend to $0$ as $x \to 0$ or $x \to 1$. Take $f(x)=cx(1-x)$ You can quickly solve the given equation for $c$. Note that $\int_0^{1} x(1-x)|g(x)|^{2}dx \neq 0$.

[ We need $c \int_0^{1} x(1-x)|g(x)|^{2}d\mu =\int |g|^{2}d\mu$ which is satisfied when $c=\frac {\int |g|^{2}d\mu} {\int_0^{1} x(1-x)|g(x)|^{2}d\mu}$]