$\int_a^b f(x) g'(x) dx = 0$ implies $f$ is constant Given $f$ is continuous on $[a,b]$, $\forall g$ which is a continuously differentiable function on $[a,b]$, with $g(a)=g(b)=0$, the following equation is satisfied:
$\int_a^b f(x) g'(x) dx = 0$.
I want to show that $f$ is a constant.
This is a question similar to this, but that question ask $\int_a^b f(x) g(x) dx = 0$.
I have tried taking $g = (x-a)(b-x)$, but since I don't know whether $f(x)$ is differentiable, I cannot take $g = f(x-a)(b-x)$ as in that question.
Thank you.

Let $I=\int_a^b f(s)ds$.
Let also $$g(x) = \int_a^x \left(f(s) - \frac{I}{b-a}\right)ds.$$
Clearly, $g(a)=g(b)=0$. On top of that $g'(x) = f(x)-\frac{I}{b-a}$.
$$\int_a^b f(x)g'(x)dx = \int_a^bf^2(x)dx-\frac{I^2}{b-a},$$or
$$\int_a^bf^2(x)dx = \frac{1}{b-a}\left(\int_a^bf(x)dx\right)^2.$$
By the Cauchy-Schwarz inequality this implies that the functions $x\to f(x)$ and $x\to 1$ are linearly dependent, hence $f$ is constant.
