If $A$ and $B$ are finite sets, show that $A \cup B$ is finite If $A$ and $B$ are finite sets, show that $A \cup B$ is finite
I already found the bijection to be 
$h: A \cup B \rightarrow \big\{1,\ldots , n+m \big\}$
$$h(x)= \begin{cases}
f(x),&\text{if }x\in \big\{1,\ldots,n\big\}\\
m+g(x),&\text{if }x\in \big\{n+1,\ldots ,n+m\big\}
\end{cases}$$
here $f$ is a bijection from $A \rightarrow \big\{1,\ldots ,n \big\}$
and g is a bijction from $B \rightarrow \big\{1, \ldots ,m \big\}$
What i'm really asking is how do i show $h(x)$ is onto and one-to-one. Can someone walk me through the steps. Piece wise functions confuse me 
 A: I want to suggest proving it in the following way, which I think is less confusing. I'm assuming that $A$ and $B$ are subsets of a single set, in which case $A \cap B$ may not be empty, and the number of elements in $A \cup B$ may not be $m + n$.


*

*$A \cup B = (A \setminus B) \cup (B \setminus A) \cup (A \cap B)$.

*Subsets of finite sets are finite.

*Disjoint unions of finite sets are finite.

A: You could argue by induction on the size of the finite set $B$. If $|B|=0$, then $B=\varnothing$. Therefore $A\cup B$ is finite (completing the base case). Now assume that $A\cup B$ is finite for $|B|\le k$. Then you have to show that $A\cup B$ is finite for $|B|=k+1$. [Hint: $B=\{x\}\cup(B\setminus\{x\})$ for some $x\in B$]
A: You have the right idea but you are confusing whether $x \in A \cup B$ or $x \in \mathbb N$.  If $f| A \rightarrow \{1,...., n\}$ then you can't say $x \in  \{1,...., n\}$.  And if $g(x)| \{1,...., m\}\rightarrow B$ then you can't say $h(x) = m + g(x)$ because $g(x)$ is not a number.
Let $f:A \rightarrow \{1...n\}$ be a bijection to $A$, a set with $n$ elements and $g:B\rightarrow\{1....m\}  $ be a bijection to the $m$ elements of $B$.
Let $h:A\cup B\rightarrow \{1...n+m\}$
$h(x) = f(x)$ if $x \in A$.
$h(x) = n + g(x)$ if $x \not \in A$.
Note: the function will NOT be a bijection.  It will be injective but it will not be surjective.  This is fine, because have an injective function to a finite set means the set is finite.
Let $h(x) = h(y)$.  If $x \in A$ but $y \not \in A$ (or vice versa) then $h(x) = f(x) \le n$.  $h(y) = n + g(x) > n$.  So $h(x) = h(y)$ only if both $x$ and $y$ are both in $A$ or both not in $A$.
If $x,y \in A$ then $h(x) = f(x)$ and $h(y) = f(y)$. As $f$ is bijection $x = y$.
If $x,y \not \in A$ then $h(x)=n + g(x)$ and $h(y) = n+g(y)$ so $g(x) = g(y)$ and $x = y$ as $g$ is bijection.
So $h$ is an injective map from $A\cup B$ to the finite set $\{1,... n+ m\}$ so $A \cup B$.
postscript: note, if $x \in A \cap B$ and if $f(x) \ne g(x)$, then $h(x) = f(x) \ne g(x)$.  There is no $y \in A \cup B$ so the $h(x) = g(x)$.  So $h$ is not surjective. 
