# Surjective function: Discrete Maths

How to know whether this function is surjective or not? I know that we have represent x in terms of y and then substitute some value of y for which the domain of x is not satisfied, but for this sum, how to represent x in terms of y?

The function is surjective if the equation $$x^2+2x-y=0$$ has real solutions no matter what real value y takes.

Take $$y=-2$$ and the equation does not have real roots. Therefore the function $$y=x^2+2x$$ is not surjective.

• How you got this value $y=-2$? Commented Nov 11, 2019 at 16:09
• I use the quadratic formula to find the x and observe that for y=-2 I do not obtain a real value for x Commented Nov 11, 2019 at 16:11

Note the definition of surjectivity:

For a function $$f:A\to B$$ to be surjective, we need that for every $$y \in B$$ there exists an $$x\in A$$ such that $$f(x) = y$$.

If $$f$$ is a function such that $$f:\mathbb R \to \mathbb R$$ $$f(x) = x^2 + 2x,$$ then note that if $$f$$ were surjective, we should be able to take any number (let's say) $$-5\in \mathbb R$$ (which is our $$B$$ here) such that an $$x\in \mathbb R$$ (which is also our $$A$$) makes $$f(x) = -5$$. But can $$f$$ ever reach $$-5$$?

• Got it, thanks..but it looks more or less like trial and error, is there any particular approach? Commented Nov 11, 2019 at 16:10
• @HIRAKMONDAL, the trick to solving these kinds of problems is to try and solve the equation $y = x^2 + 2x$ explicitly for $x$. Solving this equation for $x$ yields $x = \pm\sqrt{y + 1} - 1$, which introduces the nasty $\pm$; this is a tell-tale sign that the function cannot be surjective. Once you know that, you just need to pick some $y$ value that you know the function can never reach. In this case, I just pick some number lower than the minimum (which is $-1$) from the codomain, which is all reals. I need to be able to pick any number from the codomain and solve for $x$ explicitly. Commented Nov 13, 2019 at 4:43
• @HIRAKMONDAL. I ran out of characters in the last comment. If you can explicitly solve the equation for $x$, then you may run the $x$ through the function to show that it equals $y$. For example, we can show that the function $f:\mathbb R \to \mathbb R$ with $f(x) = 2x+3$ is surjective because if we take $y = 2x + 3$ and solve for $x$, we get $x = {y - 3\over 2}$, which we could explicitly solve for $x$. If we run the $x$ through $f$, we should be able to show that we can get whatever $y$ we choose: $$f(x) = f\left({y-3\over2}\right) = 2\left({y-3\over2}\right) + 3 = y - 3 + 3 = y.$$ Commented Nov 13, 2019 at 4:52

As far as I understand, the purpose of this exercise is to use familiar functions to help students develop a better understanding of the concept of surjectivity. One idea is that for functions $$y=f(x)$$ from $$\color{blue}{\mathbb{R}}$$ to $$\color{magenta}{\mathbb{R}}$$, you can use the usual graph of the function to see if the function is surjective or not.

Plot the graph of $$y=f(x)$$, such as $$y=x^2+2x$$ in this example (I bet you know its shape), and see what its range is. Such a function is surjective precisely when for each $$y\in\color{magenta}{\mathbb{R}}$$ there's at least one point $$x\in\color{blue}{\mathbb{R}}$$ such that $$f(x)=y$$. That's a mouthful, but it's the same as saying that the range of the function is the entire $$\color{magenta}{\mathbb{R}}=(-\infty,+\infty)$$. For functions in the Cartesian $$x,y$$-plane, it's the Horizontal Line Test.