Let $\;f:(a,b)\rightarrow \mathbb R^n\;$ such that $\;f\in W^{1,2}_{loc} (a,b)\;$ and $\;g:\mathbb R^n \rightarrow [0,+\infty)\;$ be a continuous function and suppose:
$\;\int_{x_0}^{x_1} \frac {{f'}^2(x)}{2}+g(f(x))\;dx=0\;\;\forall x_0,x_1:\;a\lt x_0 \lt x_1 \lt b\;$
Then $\; \frac {{f'}^2(x)}{2}+g(f(x))=0\;\;\;a.e\;$ in $(a,b)\;$
I know that since $\;f\in W^{1,2}_{loc} (a,b) \Rightarrow f,f'\in L^2_{loc} (a,b)\;$ . Searching here I came across with this post Showing that $f = 0 $ a.e. if for any measurable set $E$, $\int_E f = 0$ and I was wondering if there is any connection between that and my question.To be honest, I believe it does but I miss the key points as it seems.
I'm new to $\;L^p\;$ and measure theory so I apologize in advance if my question is trivial. I'm having a really hard time understanding how do we result in the "almost everywhere" statement from the above integral.
Any help would be valuable! Thanks