Relationship between Transitive Closure Definitions

Theorem
Let $x$ be a set.

Let $a$ be the smallest set such that $x \in a$ and $a$ is transitive.

Let $b$ be the smallest set such that $x \subseteq b$ and $b$ is transitive.

Then $a = b \cup \{x\}$.

Proof
First note that $x \in a$ and $a$ is transitive, so $x \subseteq a$.

Thus by the definition of $b$ and of smallest, $b \subseteq a$.

Since we also have $x \in a$, $b \cup \{x\} \subseteq a$.

$x \in \{x\}$, so $x \in b \cup \{x\}$.

$b \cup \{x\}$ is transitive:

If $p \in b$ then $p \subseteq b \subseteq b \cup \{x\}$.

If $p \in \{x\}$ then $p = x$, so $p \subseteq b \subseteq b \cup \{x\}$ by the definition of $b$.

Thus by the definition of $a$, $a \subseteq b \cup \{x\}$.

Thus the theorem holds by Equality of Sets.