Let $f: M \to N$ be continuous and onto, and let $M$ be compact. Prove that $A$ is closed in $N$ if and only if $f^{-1}(A)$ is closed in $M$. Prove that if $f$ is also one-to-one, then $f^{-1}:N \to M$ is continuous.
Just want to confirm that $(b)$ is right.
(a) ($\Leftarrow$) We prove the contrapositive: if $A$ is open in $N$, then $f^{-1}(A)$ is open in $M$. This is the definition of continuity, so we're done. $(\Rightarrow)$ Suppose $A$ is closed in $N$ $\Longleftrightarrow$ $A^c$ is open in $N$. By the proof in the $(\Leftarrow)$ direction, we know that $f^{-1}(A^c)$ is open in $M$. Because $f^{-1}(A^c) = M \setminus f^{-1}(A)$, we know that $f^{-1}(A)$ is closed in $M$.
(b) Suppose $f$ is also one-to-one. To show $f^{-1}$ is continuous, we want to show that for any open set $B$ in $M$, $(f^{-1})^{-1}(B) = f(B)$ is an open set in $N$. Let's prove the contrapositive, so suppose $f(B)$ is a closed set in $N$ $\Longleftrightarrow$ $f^{-1}(f(B)) = B$ is closed in $M$
As Rob Arthan points out in the comments, the $(\impliedby)$ direction in (a) is incorrect. The statement that requires showing is
However, you try to show
Note that the statement you have shown is equivalent to the $(\implies$) direction, which is
where the equivalence follows from the fact that openness implies the closeness of the complement, and vice versa. This is why you were able to invoke the proof in one direction to show the other.
Coincidentally, the reasoning for your proof is correct: if $f$ is continuous and the image of $f$ is closed, then its pre-image is also closed, which proves $(\impliedby)$. For $(\implies)$, note that $A = f(f^{-1}(A))$, i.e., $A$ is the image of $f^{-1}(A)$. Since $A$ is closed and $f$ is continuous, it follows from $(\impliedby)$ that $f^{-1}(A)$ is closed, as desired.
For (b), we need to use the compactness of $M$. Following the beginning of your proof, it suffices to show that for any open set $B \subset M$, $(f^{-1})^{-1}(B) = f(B) \subset N$ is open. Observe that $B^\complement$ is a closed subset in a compact set $M$, and thus $B^\complement$ is compact. Therefore, $f(B^\complement)$ is also compact, and in particular, closed. Then by the bijectivity of $f$, $f(B^\complement)^\complement = f(B)$ is open, as desired.