Suppose X and Y are compact and they are Hausdorff topological spaces. Let $f : X \rightarrow Y$ be a continuous surjective function. Prove that any $U \subset Y$ is open if and only if $f^{−1}(U)$ is open.
I got stuck here because I don't know how to use compactness. Can someone help please? Thanks
If $U$ is open then $f^{-1}(U)$ is open by the definition of continuity.
On the other hand, if $f^{-1}(U)$ is open, then its complement $X\setminus f^{-1}(U)$ is closed, hence compact because $X$ is compact.
Therefore $f(X\setminus f^{-1}(U))$ is compact because $f$ is continuous, and since $Y$ is Hausdorff this implies that $f(X\setminus f^{-1}(U))$ is closed. Finally $f(X\setminus f^{-1}(U))=Y\setminus U$ since $f$ is surjective, hence $U$ is open.
The reason compactness is important here is that the image of a closed set under a continuous function need not be closed.