Let $\mathcal{T}$ be the collection of open subsets of a metric space $M$ and $\mathcal{K}$ the collection of closed subsets. Show that there is a bijection from $\mathcal{T}$ to $\mathcal{K}$.
My attempt If $U$ is open, $U^{c}$ is closed and if $F$ is closed, $F^{c}$ is open, then I can characterize the function through complements. So, define $f: M \to M$ by $f(U) = U^{c}$, then:
If $f(U) = f(V)$ then $U^{c} = V^{c}$ and so $(U^{c})^{c} = (V^{c})^{c}$. Thus, $U = V$.
If $F \in \mathcal{K}$, $F^{c}$ is open. So, $f(F^{c}) = (F^{c})^{c} = F$.
Is correct? Therefore, $f$ is bijective.
You made a mistake when defining the map: the domain should not be $M$. Rather, you should show that
$$\mathcal{T} \to \mathcal{K}: A \mapsto A^c$$ is a well-defined bijection.
(Just change the $M$ in your proof and everything will work out)