Let $S$ be a compact surface and $f:S\rightarrow \mathbb{R}$ that have at most $3$ critical points, i want to proof that $S$ has to be connected.
I know that possible because $S$ is compact and $f$ continuous, so when can assume the critical points, looking in a geomtric way i can see that, but how can i show that with definitions and calculus?
Assume $S$ is not connected, say $S=U\cup V$ where $U,V$ are non-empty, disjoint, relatively open subsets of $S$. Then $U,V$ are also compact surfaces. Note that each consists of more than one point. On each of $U$ and $V$, $f$ assumes its (restricted) maximum and minimum, and each point where an extremum is assumed, is critical. We conclude that one of $U,V$ has only one critical point. But that means that minimum and maximum coincide, i.e, $f$ is constant on that part - but than all points in that part are critical.