# Why is there an extra step for showing f is surjective?

Let $f:\mathbb R\setminus \{-2\}\to \mathbb R\setminus \{4\}$ be a function defined by $f(x)=\dfrac{4x}{x+2}$. Show that $f$ is surjective.

Ok so this is a pretty straightforward question, I did the necessary steps like

Let $y\in \mathbb R\setminus\{4\}$ such that $x=\dfrac{-2y}{y-4}$. Then,

$\displaystyle f(x)=f\left(\frac{-2y}{y-4}\right)=y.$

Therefore, $f$ is surjective, as there exists an $x\in \mathbb R\setminus \{-2\}$ for all $y\in \mathbb R\setminus\{4\}$.

But my teacher said, there is another step.

Which step have I left out?

-
I'm almost certain Assaf's answer nails it, but why didn't you ask your teacher? –  DonAntonio Nov 22 '12 at 15:24
Personal reasons. Not of the teacher's fault. –  Yellow Skies Nov 22 '12 at 15:27

You need to show that $x$ is in the domain, namely $x\neq -2$.
If $x$ is not in the domain of $f$ then $f$ is not defined on $x$ (even if we know that it should be defined), and in such case you have not shown that $y\in\operatorname{rng}(f)$ as wanted.
You should use the fact that $y\neq 4$ to argue that $x\neq -2$.
What happens if $x$ is not in the domain? –  Yellow Skies Nov 22 '12 at 15:28
@SingaporeanDude: Then the function is not defined for that particular $x$, and therefore $y$ may not be in the range of $f$. –  Asaf Karagila Nov 22 '12 at 15:29