how does a surjective function not contradict the definition of a function. I was reading up on functions and different types of functions.
From wikipedia :

A function is a process or a relation that associates each element x
  of a set X, the domain of the function, to a single element y of
  another set Y

Surjective function:

a function f from a set X to a set Y is surjective (or onto), or a
  surjection, if for every element y in the codomain Y of f there is at
  least one element x in the domain X of f such that f(x) = y. It is not
required that x be unique; the function f may map one or more elements
of X to the same element of Y.

Can someone explain how these two definitions does not contradict eachother?

A function is a relation that maps every element in the domain to a SINGLE element in the codomain... and it may be the case that 
$1$. elements in the codomain that are mapped to are mapped to only once, or 
$2$. one or more elements in the codomain are mapped to multiple times from DIFFERENT elements in the domain. 
In either case, you would not have a contradiction because each element in the domain still only maps to ONE element in the codomain. In the case of #$2$, you would simply have multiple elements in the domain mapping to THE SAME element in the codomain. 
When #$1$ occurs, we say the function is injective.  When #$2$ occurs, we say the function is not injective. It is injective if and only if every element in the domain maps to a different element in the codomain.
In short, you think there is a contradiction because you are confusing the definition of a function with that of an injective function. And indeed, if that were true then there would be a contradiction! But this is not the case. A function can be injective or not, and in either case it can be surjective or not.
