How would you prove that this function is a surjection? I know how to explain it but I need to somehow prove it mathematically
$f:\mathcal{P}(\mathbb{N})×\mathbb{N}\to\mathcal{P}(\mathbb{N})\setminus\{\emptyset\}$
$f(\mathrm{X},n)=\mathrm{X}\cup\{n\}$
The way to attempt to prove this is say. Let $A \in P(\mathbb N)$ be an arbitrary subject. Then try to find a solution for $B$ and $n$ so that
$f(B,n) = B\cup \{n\} = A$.
Then that requires that $n$ must be an element of $A$. Any element of $A$ can do but we must realize that $A$ must have elements in the first place. If $A = \emptyset$ there is no $n\in A$ and $n \in B\cup \{n\} = f(B,n) \not \subset A = \emptyset$ for any set $B$ and any element $n$...
So $f$ is not onto as $f(B,n) = \emptyset$ has no solution.
However if we consider $g:P(\mathbb N) \times N \to P(\mathbb N)\setminus \{\emptyset\}$ via $g(X,n) = X \cup \{n\}$ we can attempt to solve for any $A \subset \mathbb N$ where $A \ne \emptyset$, $g(B, n) = A$.
For $g(B, n) = B \cup \{n\} = A \ne \emptyset$ then we must have $n \in A$. $n$ may be any element and we must have $A\setminus\{n\}\setminus B\subset A\setminus\{n\}$.
So $g(A, n) = A \cup \{n\} = A$ or $g(A\setminus \{n\},n) = (A\setminus \{n\},n)\cup \{n\} = A.$ For any $n \in A$ for any nonempty subset of $\mathbb N$.
So $g$ is onto.