Definition of a Function: A function is a rule that produces a correspondence between the elements of two sets: D ( domain ) and R ( range ), such that to each element in D there corresponds one and only one element in R.
Definition of a onetoone function: A function is a onetoone if no two different elements in D have the same element in R.
The definition of a one to one function can be written algebraically as follows:
Let x1 and x2 any elements of D
A function f(x) is onetoone
I  if x1 is not equal to x2 then f(x1) is not equal to f(x2)
OR the contrapositive of the above
II  if f(x1) = f(x2) then x1 = x2.
This last property can be useful as we shall see later in the tutorial.
Interactive Tutorial Using Java Applet
 click on the button above "click here to start" and MAXIMIZE the window obtained.
 Select the function f(x) = a*x + b, set parameter a to zero and change b. The graph of f(x) = b ( a constant function )is a horizontal line. It is not a onetoone function. Explain using definition I above.
 Set a to a non zero value and b to any value. It is easy to show that it is a onetoone function using definition II.
start with f(x1) = f(x2), a*x1+b = a*x2+b
which can be written as a*(x1x2) = 0
and this gives x1 = x2.
Now use the slider "y=" to change the position of a horizontal line to test the function for the onetoone property. You can see that the horizontal line intersects the graph of f(x) at one point only as the horizontal line is moved up and down.

Select the (quadratic) function f(x) = a*(xb)^{2} + c. Set parameter a to 1 and b to zero. Set the horizontal line to y = 1 which cuts the graph of f(x) at x = 1 and x = 1. This shows that f(1) = f(1) = 1 which means two different values of x give the same value for the function. This contradicts definition I and shows that f(x) is not onetoone.

Select function f(x) = a*(xb)^{2} + c, if x >= b. A horizontal line test shows that this function is a onetoone function. Explain analytically using definition II starting with f(x1) = f(x2) and show that x1 = x2.
 Select function f(x) = a*x  b + c. Explain graphically and analytically that this function is not a onetoone.

Select function f(x) = a*x^{3} + b*x^{2} + c. Set b to zero and show graphically and analytically that f(x) is a onetoone. Change b so that f(x) is not a onetoone.

Select function f(x) = a*e^{(x  b)} + c . Show graphically that f(x) is a onetoone for any values of a , b and c, with parameter a not equal to zero.
More
Questions on one to one Functions