Let $f: X \to Y$ be a continuous surjection between two topological spaces. Show that $Y$ compact is, given that $X$ compact is.
My attempt:
Let $\mathcal{G}$ be an open cover of $Y$. Then, $\bigcup \mathcal{G} = Y$ and
$$X = f^{-1}(Y) = f^{-1}(\bigcup\mathcal{G}) = \bigcup f^{-1}(\mathcal{G})$$
and because $f$ is continuous, it follows that $f^{-1}(\mathcal{G})$ is an open cover of $X$. By compactness, there exist $G_1 \dots,G_n \in \mathcal{G}$ such that $X = \bigcup_{i=1}^n f^{-1}(G_i)$ and hence $Y = \bigcup_{i=1}^nf(f^{-1}(G_i)) = \bigcup G_i$ (here we used that $f$ is surjective) and we conclude that $\{G_i\mid i=1, \dots n\}$ is a finite subcover of $\mathcal{G}$, and we deduce that $Y$ is compact.
Is this correct?
Yes, it is correct. That's how I would have done it. Note that at no point of the proof the surjectivity of $f$ is mentioned. However, you use it (implicitely) when assuming that $f\bigl(f^{-1}(\mathcal{G}_i)\bigr)=\mathcal{G}_i$.