Union of Mappings which Agree is Mapping

Theorem
Let $A, B, Y$ be sets.

Let $f: A \to Y$ and $g: B \to Y$ be mappings.

Let $X = A \cup B$.

Let $f$ and $g$ agree on $A \cap B$.

Then $f \cup g: X \to Y$ is a mapping.

Proof
By definition, $f \cup g$ is a relation whose domain is $X = A \cup B$.

Let $\left({x, y_1}\right) \in f \cup g$ and $\left({x, y_2}\right) \in f \cup g$.

At least one of the following must be true:
 * $(1): \quad \left({x, y_1}\right) \in f, \left({x, y_2}\right) \in f$
 * $(2): \quad \left({x, y_1}\right) \in g, \left({x, y_2}\right) \in g$
 * $(3): \quad \left({x, y_1}\right) \in f, \left({x, y_2}\right) \in g$
 * $(4): \quad \left({x, y_1}\right) \in g, \left({x, y_2}\right) \in f$

Because $f$ and $g$ are mappings, $(1)$ and $(2)$ imply that $y_1 = y_2$.

If $(3)$ holds, then $y_1 = f \left({x}\right)$ and $y_2 = g \left({x}\right)$.

But then $x \in A \cup B$.

So by hypothesis:
 * $y_1 = f \left({x}\right) = g \left({x}\right) = y_2$

Similarly if $(4)$ holds.

Thus in all cases:
 * $\left({x, y_1}\right), \left({x, y_2}\right) \in f \cup g \implies y_1 = y_2$

and so by definition $f \cup g: X \to Y$ is a mapping.