Injectivity and surjectivity of a function with constants I have the function $$f(x)=\frac{a}{x}-\frac{b}{x^2}$$
how can I prove/disprove that it's injective and surjective over $\mathbb{R}$ for all $a$ and $b$?
Edit: Someone at another forum suggested that I use $$x=\frac{2b}{a\pm 2bc}$$
to prove that it's not injective, and it works! However, I do not know how he arrived to said solution in the first place.
 A: First, suppose $b=0$. Then the function is not surjective since $f(x)=a/x\neq0$ for all $x$. It is however injective if $a\neq0$.
Now suppose $b\neq0$. Solve the equation $f(x)=y$ for $y\neq0$:
$$
x=\frac{a\pm\sqrt{a^2-4by}}{2y}
$$
The only way that $f$ is injective is that $\sqrt{a^2-4by}=0$ so that we get only one value for $x$. But there are obviously values of $y$ for which $\sqrt{a^2-4by}\neq0$. So $f$ is not injective if $b\neq0$. Similarly, there are many values of $y$ for which $a^2-4by<0$ so there are no solutions for $x$. Hence, if $b\neq0$, then $f$ is not surjective.
So it is never surjective, and it is injective if and only if $b=0$ and $a\neq0$.
A: To arrive at the solution, you just need some simple calculation:
Let $f(x)=f(y)$ and $x \neq y$
$\frac{a}{x}-\frac{b}{x^2} = \frac{a}{y}-\frac{b}{y^2}$
$a(\frac{1}{x}-\frac{1}{y})=b(\frac{1}{x^2}-\frac{1}{y^2})$
$\frac{a}{b} = \frac{1}{x}+\frac{1}{y}$
All we need is let $\frac{1}{x}=\frac{a-c}{2b}$ and $\frac{1}{y}=\frac{a+c}{2b}$ to get some easy solutions.
A: First of all, the function $f$ is defined on $\mathbb{R} \setminus \{0\}$ instead of $\mathbb{R}$. 
Second, by definition $f$ is injective if and only if there does not exist $x_1 \neq x_2$ such that $f(x_1) = f(x_2)$. On the other hand, if $b = 0$, then $f(x) = \frac{a}{x}$ is injective if $a \neq 0$. If $b \neq 0$, then $f(x)$ is a quadratic function in $\frac{1}{x}$, and by high-school mathematics for some values $y$ there exists $z_1 \neq z_2$ such that $az_1 - bz_1^2 = y = az_1 - bz_1^2$. Letting $x_1 = \frac{1}{z_1}$ and $x_2 = \frac{1}{z_2}$ we see $f$ is not injective. Therefore

$f$ is injective if and only if $a \neq 0, b = 0$.

Third, to say whether $f$ is surjective you have to specify what the codomain of $f$ is. If $f$ is from $\mathbb{R} \setminus \{0\}$ to $\mathbb{R}$, then $f$ is not surjective. But if the codomain is $f(\mathbb{R} \setminus \{0\})$, then $f$ is surjective trivially.
