Lemma:
Let $g\in \mathcal{C}([0,1])$ be such that
$\int_{[0,1]}g(x)\chi'(x)dx=0 \ \forall \chi\in\mathcal{C}_c^\infty(0,1)$
Then $g$ is constant on the interval $[0,1]$.
Proof:
Let $f\in\mathcal{C}^1(0,1)$ be a weak derivative of $g$,then
$\int_{[0,1]}g(x)\chi'(x)dx=-\int_{[0,1]}f(x)\chi(x)dx=0 \ \forall\chi\in\mathcal{C}_c^\infty(0,1) $
By the fundamental lemma of the calculus of variations:
$f(x)=0$ a.e. on $[0,1]$ and since $g$ is continuous, we may conclude that $g(x)$ is constant on $[0,1]$. $\square$
Could you please verify my proof, is it valid? Could you please suggest other ways to prove? thank you for your time!