# Injective, Surjective and Bijective

"Injective, Surjective and Bijective" tells us about how a function behaves.

A function is a way of matching the members of a set "A" to a set "B":

A General Function points from each member of "A" to a member of "B".

A function never has one "A" pointing to more than one "B", so one-to-many is not OK in a function (as we would have something like "f(x) = 7 or 9")

But more than one "A" can point to the same "B" (many-to-one is OK)

Injective means that every member of "A" has its own unique matching member in "B".

As it is also a function one-to-many is not OK

And we won't have two "A"s pointing to the same "B", so many-to-one is NOT OK.

But we can have a "B" without a matching "A"

Injective functions can be reversed!

If "A" goes to a unique "B" then given that "B" value we can go back again to "A" (this would not work if two or more "A"s pointed to one "B" like in the "General Function")

Injective is also called "One-to-One"

Surjective means that every "B" has at least one matching "A" (maybe more than one).

There won't be a "B" left out.

Bijective means both Injective and Surjective together.

So there is a perfect "one-to-one correspondence" between the members of the sets.

(But don't get that confused with the term "One-to-One" used to mean injective).

## On The Graph

Let's see on a graph what a "General Function" and a "Injective Function" looks like:

 General Function "Injective" (one-to-one)

In fact we can do a "Horizontal Line Test":

To be Injective, a Horizontal Line should never intersect the curve at 2 or more points.

(Note: Strictly Increasing (and Strictly Decreasing) functions are Injective, you might like to read about them for more details)

## Formal Definitions

OK, stand by for some details about all this:

### Injective

A function f is injective if and only if whenever f(x) = f(y), x = y.

Example: f(x) = x+5 from the set of real numbers to is an injective function.

This function can be easily reversed. for example:

• f(3) = 8

Given 8 we can go back to 3

Example: f(x) = x2 from the set of real numbers to is not an injective function because of this kind of thing:

• f(2) = 4 and
• f(-2) = 4

This is against the definition f(x) = f(y), x = y, because f(2) = f(-2) but 2 ≠ -2

In other words there are two values of "A" that point to one "B", and this function could not be reversed (given the value "4" ... what produced it?)

BUT if we made it from the set of natural numbers to then it is injective, because:

• f(2) = 4
• there is no f(-2), because -2 is not a natural number

### Surjective (Also Called "Onto")

A function f (from set A to B) is surjective if and only for every y in B, there is at least one x in A such that f(x) = y, in other words  f is surjective if and only if  f(A) = B.

So, every element of the range corresponds to at least one member of the domain.

Example: The function f(x) = 2x from the set of natural numbers to the set of non-negative even numbers is a surjective function.

However, f(x) = 2x from the set of natural numbers to is not surjective, because, for example, nothing in can be mapped to 3 by this function.

### Bijective

A function f (from set A to B) is bijective if, for every y in B, there is exactly one x in A such that f(x) = y

Alternatively, f is bijective if it is a one-to-one correspondence between those sets, in other words both injective and surjective.

Example: The function f(x) = x2 from the set of positive real numbers to positive real numbers is injective and surjective. Thus it is also bijective.

But not from the set of real numbers because we could have, for example, both

• f(2)=4 and
• f(-2)=4