How to determine function is onto Consider the below function 
$f(x)=\frac{x}{2x+1}\{x \neq- \frac{1}{2}\}$
Onto functions are those $\forall y \exists x(f(x)=y)$, means for all elements in co-domain we have a pre-image in the domain.
I particularly get stuck how to determine when a function is onto especially when the function is given as a mathematical expression.
Please guide.
 A: 
"I particularly get stuck how to determine when a function is onto especially when the function is given as a mathematical expression."  

As well you should as the codomain is not stated. It's impossible to state if the function is onto if the codomain is not stated.
The domain is $\mathbb R\setminus \{-\frac 12\}$ so if $f:\mathbb R\setminus \{-\frac 12\}\to \mathbb R$ this may or may not be onto.  If $f:\mathbb R\setminus \{-\frac 12\}\to \mathbb C$ it most certain is not onto.  ($f(x) = i$ has no solution) and if $f:\mathbb R\setminus \{-\frac 12\}\to f(\mathbb R\setminus \{-\frac 12\}) = \{f(x)|X\in \mathbb R\setminus \{-\frac 12\}\}$ must certainly is.
The unstated assumption is:
$f:\mathbb R\setminus \{-\frac 12\}\to \mathbb R$ 
and we need to prove/disprove for any $y \in \mathbb R$ that there exists one or more $x$ so that $f(x) = y$.
So if $\frac x{2x + 1} = y$ then $x = y*(2x+1)$ and...
$x = y*2x + y$
$x - 2yx = y$
$x(1-2y) = y$.  If $1 - 2y\ne 0$ we have
$x = \frac {y}{1-2y}$ and so $f( \frac {y}{1-2y}) = y$ is possible so long as $\frac y{1-2y} \ne -\frac 12$.
i.e. if $2y = 2y - 1$ which would mean $0 = -1$ which is impossible.
So as long as $1-2y\ne 0$ then $x =\frac y{1-2y}$ is a solution to $f(x) = y$.
But what if $1-2y=0$ or $y=\frac 12$.  Is it possible for 
$\frac x{2x + 1} = \frac 12$? That would mean $2x = 2x + 1$ and that would mean $0 = 1$ which is impossible.  So $f(x) = \frac 12$ has no solution.  It is not onto if the codomain is $\mathbb R$.
However if $f:\mathbb R\setminus \{-\frac 12\}\to \mathbb R\setminus\{\frac 12\}=f(\mathbb R\setminus \{-\frac 12\})=\{f(x)|x \in \mathbb R\setminus \{-\frac 12\}\}$ then it is onto as for all $y\in \mathbb R; y \ne \frac 12$ then $\frac y{1- 2y}\in R\setminus \{-\frac 12\}$ and $f(\frac y{1-2y}) = y$
But it is conventional to assume the co-domain is, if not specified otherwise, is $\mathbb R$.
FWIS: All functions can be made onto by simply restricting them to the image of the function. That is to say $f: D \to f(D) = \{f(x)|x \in D\}$ is, by definition, onto.  But it is conventional to assume the co-domains is $\mathbb R$ and not usually $f(D)$.
A: As noticed a function is completely defined when we specify what domain and codomain are that is
$$f:A\to B$$
Here we are assuming $A=\mathbb{R}$ but we need also to specify $B$.
Note that any function is by definition onto if and only if $B\subseteq$ range. Therefore in that case the key point is to determine what the range of $f$ is and then compare that with the codomain we are assuming for $f$. 
As an alternative given the codomain if we can find a value $y$ such that $\not \exists x$ such that $y=f(x)$ it suffices to prove that $f$ is not onto.
