A function from to assigns exactly one element of to each element of . The picture below is the whole story: the left set is the domain , the right set is the codomain , and each arrow is the rule.
When is it even a function?
A mapping fails to be a function as soon as one input points to two outputs. In the first panel, one element of has two arrows leaving it, so it is not a function. Every other panel sends each to a single , so all of them are functions.
Injective (one-to-one)
A function is injective when no two inputs share an output:
Each element of gets at most one arrow. Some elements of can stay untouched, and that is fine. Because no output is reused, you can trace any arrow backwards, which is what lets an inverse exist.
Surjective (onto)
A function is surjective when every element of gets hit. The image covers the whole codomain:
Several inputs can share the same output; nothing in is left without an arrow.
Bijective
A function is bijective when it is injective and surjective at the same time: each pairs with one , and each with one . This perfect one-to-one pairing is exactly what a true inverse needs to exist.