Let $u \in L^¹_{loc}(a,b)$ and $$\int_a^b u(x) \phi'(x) \ dx=0$$ for all $\phi \in C^{\infty}_{c}(a,b)$.
How can I show that there exists a real constant $c$ such that $u(x)=c$ for almost all $x \in [a,b] \ $?
If I chose a function $\phi$ such that $\phi(a)=\phi(b)=0$ I get $$0=\int_a^b u(x) \phi'(x) \ dx=-\int_a^b u'(x) \phi(x) \ dx$$ using partial integration, is that right? How can I now conclude there $u(x)=c$ ? Some hints are much appreciated.
Any $\psi \in C_c^\infty(a,b)$ havng mean zero can be written as $\phi'$ for some $\phi \in C_c^\infty(a,b)$. Thus $u$ satisfies the equation \begin{align} \int_a^b u \psi \, {\rm d}x =0 , \quad \forall \psi \in C_c^\infty(a,b), \int_a^b \psi \, {\rm d}x=0 \,. \end{align} Also by a density argument (test functions are weak-$\star$ dense in $L^\infty$) the above statment must also hold true for any $\psi \in L^\infty(a,b)$ having mean zero. Assume $u$ is not constant a.e., then the set $A:=\{x \in(a,b): u(x) > (b-a)^{-1}\int u\}$ has positive (but not full ) measure (if not then it must hold for $A:=\{x \in(a,b): u(x) < (b-a)^{-1} \int u\}$ and then you can continue with the same arguments). Now let $f= |A|^{-1}\chi_A - |A^c|^{-1}\chi_{A^c} \in L^\infty$, mean zero. Then \begin{align} \int_a^b u f \, {\rm d}x > (b-a)^{-1}\int u - (b-a)^{-1}\int u >0 \end{align} which is a contradiction.