I have a question related to the surjectivity of a function. I understand what surjectivity is, in the sense that, if $f:X\longrightarrow Y$, then $f$ is surjective if $\forall_{y\in Y}\exists_{x\in X}f(x)=y$, or simpler (using the image) $f(X)=Y$. My troubles seem to lie in actually proving that either of these hold.
For most proofs that I've seen on surjectivity, if the function has an inverse, then they use that and plug it back into the formula for the function to establish that the function is indeed a surjection. This usually goes as follows:
Ex) For $f:\mathbb R\longrightarrow\mathbb R$, $f(x)=\frac{1}{2}x$, you find $x=2y$ for some $x\in\mathbb R$, and say $f(2y)=y$ completes the proof.
I know that, algebraically, plugging in $2y$ into $f$ gives $y$, but I don't understand how showing $f(2y)=y$ completes the proof. Is it related to the fact that all real numbers can be described as 2 times another real number?
Second, the above hinges on the fact that $f$ has an inverse. What if $f$ doesn't have an inverse?
Ex) $f:\mathbb R \longrightarrow \mathbb R$, $f(x)=x^3-x$ does not have an inverse, but if you graph it, it clearly is onto.
In both cases, the second definition provided above, $f(X)=Y$, is extremely easy to understand, but it feels useless - almost as if you know that the image of the domain is equal to the codomain, then you wouldn't need to prove it's onto in the first place.
Any suggestions or help in understanding this would be much appreciated. If it helps, I'll mention that I don't seem to have any problem proving whether a function is injective, or not.