a) $f: \mathbb{Q}\rightarrow\mathbb{Q}, f(x)=x^2$
b) $g: \mathbb{N}\rightarrow\mathbb{Z}, g(x)=\begin{cases}-\frac{x}{2} &\text{if x is even}\\\frac{x-1}{2}&\text{if x is not even}\end{cases}$
c) Let $M$ be the set of all humans, $V\subset M$ the set of all fathers and $h: M\rightarrow V$ be the function which associates each human to their biological father.
Bonus question:
d) One can also associate each human to their siblings, does this define a function $i: M\rightarrow M$?
Please examine my attempts at solving these exercises.
a) This function is neither injective nor surjective.
It is not injective since $f(-x)=x^2$ and $f(x)=x^2$ and as such $f(x_1)=f(x_2)\not\Rightarrow x_1=x_2$. For example $f(-2) = f(2) = 4$.
It is not surjective since no $x\in X$ exists for $f(x)<0$, for example $f(x)\neq 4$ for any $x\in X$, since $f^{-1}(-4)=\sqrt(-4)=\emptyset$ in $\mathbb{Q}$.
b) This function is bijective. This is my attempt.
Injectivity:
Case 1, $g(x)=-\frac{x}{2}$.
$-\frac{x_1}{2}=-\frac{x_2}{2} \Leftrightarrow -x_1=-x_2 \Leftrightarrow x_1=x_2$.
Case 2, $g(x)=\frac{x-1}{2}$.
$\frac{x_1-1}{2}=\frac{x_2-1}{2} \Leftrightarrow x_1-1=x_2-1 \Leftrightarrow x_1=x_2$.
Surjectivity:
Case 1. $-\frac{x}{2} = y \Leftrightarrow x=-2y$.
Case 2. $\frac{x-1}{2}=y \Leftrightarrow x=2y+1$.
Is this sufficient or even the correct approach?
c) This function is not injective, but surjective.
It is not injective because at least one father exists who has multiple children and as such for $f(x_1)=f(x_2)\not\Rightarrow x_1=x_2$ with $x_1$ being the sibling of $x_2$.
It is surjective because it follows from the definition of being a father that any father in $V$ must have at least one child in $M$.
d) No, it would not define a function, since not every person has a sibling they can be associated to. And as such there is no $f(x)$ for some $x\in M$.
All of your complete answers are completely correct and well put. For (b), you do not need induction. Injectivity can be shown in two cases. Assume $f(x)=f(y)$. Since $f(x)$ and $f(y)$ both have the same sign, $x$ and $y$ are either both even or both odd. In either case, you can substitute the appropriate formula for $f$ and proceed to prove $x=y$. To prove surjectivity, given $y\in \mathbb Z$, you must find $x$ so $f(x)=y$. Again, break into two cases based on the sign of $y$ to determine which form of $f$ to use.