Find a function that is surjective and not injective Rules:


*

*No piecewise functions.

*The function must be even, odd, or both even and odd. It cannot be neither.

*If this is impossible, prove why.


This is just something I came up with for fun while studying for my Algebra II & trigonometry final.
 A: I think any polynomial with odd degree that is an odd degree with at least 3 real roots will work, but I have no proof of this fact.
Meanwhile I'll start creating a list of function which fill these requirements:


*

*$f(x) = x^5 - 2 x^3$. Surely it's odd, there are three real roots, thus it is not injective but let $y \in \mathbb{R}$ then we can solve $x^5 - 2x^3 - y = 0$ for $x$ to obtain an $x$ so that $f(x) = y$. Note that this will indeed have a real solution because complex roots come in pairs.

A: I just posted this in my class' Facebook group and someone responded with a really nice answer:
"I don't think an even function could fit those requirements, but I think an odd one can. For example: f(x)=x(x+1)(x-1). It's an odd function: 
f(-x)=-x(-x+1)(-x-1)=-x(-(x-1))(-(x+1))=-1(-1)(-1)x(x+1)(x-1)=-x(x+1)(x-1)=-f(x). Since there are two intervals in which the function is positive ([-1, 0] and [1, infinity]), the function can't be injective. Since it's an odd degree polynomial, the long run behavior is that as x approaches -infinity, f(x) does the same, and as x approaches +infinity, f(x) does the same. So the range is all the real numbers, which is also the codomain, and the function is therefore surjective."
He then added:
"Just to clarify, those square brackets should be parentheses. Also, to prove that it's not injective in a simpler way, it has 3 roots, which means that 3 inputs produce 0 as the output, and it is therefore not injective."
A: (x^2)cos(x) for an example that is an even function.
