We have a function $\pi: A \times B \rightarrow A$ defined as $\pi(a,b) = a$. Some additional terminology, just to be perfectly clear:
- The domain of $\pi$ is $A \times B$
- The codomain of $\pi$ is $A$
- The range of $\pi$ is a subset of the codomain, and is the set of all points that the domain gets mapped to, i.e. $\{\pi((a,b)) : (a,b) \in A \times B\}$.
A point worth noting is that saying a function is surjective is equivalent to saying that its range is exactly equal to its codomain.
Proof of surjectivity: consider any arbitrary $y \in Range(\pi)$. As you mentioned, we want to show there exists an $(a,b) \in Domain(\pi) = A \times B$ such that $\pi((a,b)) = y$ in order to show that our function is surjective. Since $Range(\pi) \subseteq Codomain(\pi) = A$, since $y \in Range(\pi)$, then $y \in A$. Notice that $f((y,b)) = y$, for any $b \in B$. Therefore any element of the form $(y,b)$ where $b \in B$ gets mapped to $y$. Since our choice of $y \in Range(\pi)$ was arbitrary (i.e. we did not assume anything about $y$ other than it is in the range), we have proven our claim for all $y \in Range(\pi)$. Therefore $\pi$ is subjective.
Proof that $\pi$ is not injective: we can directly show that $\pi$ is not injective by producing two elements $x, x^\prime$ in the domain such that $\pi(x) = \pi(x')$ but $x \not = x^\prime.$ Pick any $a \in A.$ Now pick two different elements $b, b^\prime \in B$. Important: this is where we use the assumption that |B| > 1. If we did not have this assumption, for example if there were only one element in $B$, we would not be able to pick two different elements from it. Then set $x = (a, b)$ and set $x^\prime = (a, b^\prime)$. Therefore, $\pi(x) = \pi(x^\prime) = a$ but $x \not = x^\prime.$