Let $\phi \in C_{c}^{\infty}\mathbb{(R)}$ . I need to show that $\int_{\mathbb{R}} \phi (x) dx = 0$ iff there exists a function $\psi \in C_{c}^{\infty}\mathbb{(R)}$ such that $\phi(x) = \psi ' (x)$.
I have absolutely no clue how to begin. Any help with this is appreciated!
Hint:
Say $\operatorname{supp}\psi \subseteq [-M, M]$. Then, it follows $$ \int_{\mathbb R} \phi = \int_{\mathbb R} \psi' = \int_{-M}^M \psi' = \psi(M) - \psi(-M). $$
On other hand, assume $\operatorname{supp} \phi \subseteq [-M, M]$. Then, $$ \psi(x) = \int_{-M}^x \phi $$ has compact support if and only if $$ \psi(M) = \int_{\mathbb R} \phi = 0. $$