How do I prove this function is injective and surjective:
$h(n)=\begin{cases}f((n+1)/2),&\text{ if }n\text{ is odd}\\ g(n/2),&\text{ if }n\text{ is even}\end{cases}$
How do I prove this function is injective and surjective:
$h(n)=\begin{cases}f((n+1)/2),&\text{ if }n\text{ is odd}\\ g(n/2),&\text{ if }n\text{ is even}\end{cases}$
The details will depend on $f$ and $g$, but the general procedure is no different from the one that you’d use if the function were not defined by cases.
To show that $h$ is injective, show that if $h(m)=h(n)$, then $m=n$. This potentially involves considering three cases: $m$ and $n$ both odd, $m$ and $n$ both even, and one of $m$ and $n$ odd and the other even.
To show that $h$ is surjective (onto what set?), you have to show that for each $x$ in the codomain of $h$ there is an integer $n$ such that $h(n)=x$. Typically this will be done by working out what things are in the ranges of $f$ and $g$ and showing that each $x$ in the codomain of $h$ really can be ‘hit’ by one of the cases.