{%hackmd 5xqeIJ7VRCGBfLtfMi0_IQ %}
# Is this function surjective?
## Problem
Let
$$
A = \begin{bmatrix}
1 & 1 & 1 \\
1 & 1 & 2 \\
1 & 2 & 2 \\
2 & 2 & 2
\end{bmatrix}\text{ and }
B = \begin{bmatrix}
1 & 1 & 2 \\
1 & 2 & 2
\end{bmatrix}.
$$
Define funcitons $f_A: \mathbb{R}^3\rightarrow\mathbb{R}^4$ by $\bx\mapsto A\bx$ and $f_B: \mathbb{R}^3\rightarrow\mathbb{R}^2$ by $\bx\mapsto B\bx$. For each of $f_A$ and $f_B$, determine if it is surjective.
## Thought
Let's recall the definition. To say a function $f: X\rightarrow Y$ is surjective, we have to show that for any $y\in Y$, there is an element $x\in X$ such that $f(x) = y$.
## Sample answer
First we consider $f_A$. Any vector $\by\in\mathbb{R}^4$ has the form
$$
\by = \begin{bmatrix} a \\ b \\ c \\ d \end{bmatrix}.
$$
We may try to solve the equation $A\bx = \by$ by the augmented matrix
$$
\left[\begin{array}{ccc|c}
1 & 1 & 1 & a \\
1 & 1 & 2 & b \\
1 & 2 & 2 & c \\
2 & 2 & 2 & d
\end{array}\right],
$$
which lead to the reduced echelon form
$$
\left[\begin{array}{ccc|c}
1 & 0 & 0 & 2a-c \\
0 & 1 & 0 & c-b \\
0 & 0 & 1 & b-a \\
0 & 0 & 0 & d-2a
\end{array}\right].
$$
Thus, the equation has no solution whenever $d - 2a\neq 0$. For example, when
$$
\by = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix},
$$
it is impossible to find $\bx\in\mathbb{R}^3$ such that $f_A(\bx) = \by$, so $f_A$ is not surjective.
For $f_B$, we may do the same. Any $\by\in\mathbb{R}^2$ has the form
$$
\by = \begin{bmatrix} a \\ b \end{bmatrix}.
$$
Thus, the augmented matrix and its reduced echelon form are
$$
\left[\begin{array}{ccc|c}
1 & 1 & 2 & a \\
1 & 2 & 2 & b
\end{array}\right]\text{ and }
\left[\begin{array}{ccc|c}
1 & 0 & 2 & 2a-b \\
0 & 1 & 0 & b-a
\end{array}\right].
$$
Thus, for any such $\by\in\mathbb{R}^2$, there is $\bx\in\mathbb{R}^3$ such that $f_B(\bx) = \by$. To be more precise, we may choose
$$
\bx = \begin{bmatrix} 2a - b \\ b - a \\ 0 \end{bmatrix}.
$$
## Note
Let $A$ be an $m\times n$ matrix and define $f_A: \mathbb{R}^n\rightarrow\mathbb{R}^m$ by $\bx\mapsto A\bx$. Then you may show that the following are equivalent:
1. $f_A$ is surjective.
2. $\rank(A) = m$.
Think about why they mean the same thing.
*This note can be found at Course website > Learning resources.*