Show $\pi: A \times B \to A$ defined by $ \pi (a,b)=a$ is a surjection, but not an injection. Let $|A|>1$ and $|B|>1$. 
Show $\pi: A \times B \to A$ defined by $ \pi (a,b)=a$ is a surjection, but not an injection. 
My attempt: 
Surjection: For any $(a,b) \in A \times B, \exists  a \in A$ such that $\pi (a,b)=a$. Thus, $\pi$ is surjective.  Is this correct? 
Not injective: Suppose $(a,b)$ and $(a_1, b_1) \in A \times B$ and $ \pi (a,b)=\pi (a_1, b_1)$, then $a=a_1$. I know this is wrong, because I am suppose to show that it is NOT injective. 
Any help is appreciated. 
 A: For surjective, you should say: For any $a \in A$ there exists $(x,y) \in A \times B$ such that $\pi (x,y)=a$, namely $x = a$ and $y$ is any element in B (which we know exists since $|B|>1$ ). Thus, $\pi$ is surjective. 
For not injective, take $(a,b)$ and $(a,b')$ with $b \not = b'$. We know such different $b$ and $b'$ exists since $|B|>1$. Since both $\pi(a,b) = \pi(a,b') = a$, we have two different elements mapping to the same element. So it is not injective.
A: The first proof is not correct, for if $B$ is empty, then $\pi$ is not surjective...but your proof never uses the nonemptiness of $B$. 
A: 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.$
