Domain and Range of a Set is a Set

Definition
Let $S$ be a set. Define its range as $\text{Ran}(S) = \{y : \exists x : (x, y)\in S\}$ and domain as $\text{Dom}(S) = \{x : \exists y : (x, y)\in S\}$.

Compare for definition of codomain of a relation and domain of a relation. Observe that $\text{Ran}(S)$ and $\text{Dom}(S)$ are classes.

Theorem
If $S$ is a set then $\text{Ran}(S)$ and $\text{Dom}(S)$ are sets.

Proof
From axiom of union, $\bigcup\bigcup S$ is a set.

Suppose that $y\in \text{Ran}(S)$, then there is $x$ such that $(x, y)\in S$, so from Kuratowski's definition of an ordered pair we obtain $\{x, y\}\in \bigcup S$ so that $y\in \bigcup\bigcup S$. Similarly, if $x\in\text{Dom}(S)$, then $x\in\bigcup\bigcup S$.

From axiom schema of specification it follows that $\text{Ran}(S)$ and $\text{Dom}(S)$ are sets.

That is, since we can write $\text{Ran}(S) = \{y\in \bigcup\bigcup S : \exists x : (x, y)\in S\}$ and $\text{Dom}(S) = \{x\in \bigcup\bigcup S : \exists y : (x, y)\in S\}$, we see that the codomain and domain of a set are sets themselves.