Let $M$ a $k$ dimensional manifold, connected and compact. Let $f: M \rightarrow \mathbb{R}$ a smooth function. Suppose there exists $x_1,x_2\in M$ such that $f(x_1)<0<f(x_2)$. Prove there exists $x_0\in M$ such that $f(x_0)=0$.
I know that since $f$ is smooth, then if $M=\cup_{\alpha}r_{\alpha}(V_{\alpha})$ where $(r_{\alpha},V_{\alpha})$ is a collection of maps, then to any ${\alpha}$, $f\circ r_{\alpha}$ is smooth.
Also, if $x_1,x_2\in r_{{\alpha}_{i}}$ then because $f\circ r_{\alpha}$ is continuous we get what we need from the intermediate value theorem, but I'm not sure what to do if $x_1\in r_{{\alpha}_{i}}$ and $x_2\in r_{{\alpha}_{j}}$ where $i\neq j$.
Would appreciate your help:)