Continuous Compact implies fixed point

calculusgeneral-topology

I am trying to solve problem 24.3 on Munkres General Topology. The question states

Let $f:X\rightarrow X$ be continuous. Show that if $X=[0,1]$ then there is a point x such that $f(x)=x$. I figure since $f$ achieves its min and max on a compact set then this implies that it must cross the line $f(x)=x$ in at least one point. When $X=(0,1)$ or $X=[0,1)$ the same conclusion does not apply as can have the situation where the function never crosses $f(x)=x$

My attempt of a proof:

Consider the function $g:[0,1]\rightarrow [-1,1]$ with

$$g(x)=f(x)-x$$

Since $X$ is compact it achieves its min and max in $X$ which implies there exists an $x_1$ and $x_2$ such that $g(x_1)<0$ and $g(x_2)>0$ by the intermediate value theorem there exists an $x^*$ such that $g(x^*)=0$ i.e. $f(x^*)=x^*$.

I am almost sure that compactness of $X$ implies the existence of $x_1$ and $x_2$ but I am having trouble showing it.

Best Answer

If $f(0) = 0$ or $f(1) = 1$ we are done, so let us assume this does not happen. Now we set $$g(x) = f(x) - x.$$ By assumption, $g(0) > 0$ and $g(1) < 0$. Now you can apply the intermediate value theorem to conclude.