Hey Guys, I am new here and I hope that I have posted this in the right place.

I'm in a serious dilemma regarding understanding how to do Injective and Surjective functions. To be more precise, how to do them formally the formal definition). I am given this as an example from my lecturer

What I am failing to understand isLet f : A → B be a function.

We call f an INJECTIVE (or ONE-TO-ONE) function if f(a1) = f(a2) ⇒ a1 = a2 for all a1,a2 ∈A.

Since this is logically equivalent to the statement a1 ≠ a2 ⇒ f(a1) ≠ f(a2), an injective function never repeats values. In other words, different inputs give different outputs.

We call f a SURJECTIVE (or ONTO) function if the range of f coincides with the codomain of f.

This means that for every b∈B there exists an a∈A with b = f(a). In other words, each element in the codomain is a value of the function..⇒ a1 = a2 for all a1,a2 ∈Af(a1) = f(a2)

Does this mean that f(a1) and f(a2) have the be the same value like f(2) = f(2)???

I would a appreciate a few examples of both Injective and Surjective functions in order to help me understand this better because I am really stressed out.

Thanks