1.3 Types of Functions
Let A be the set of all fifty students of a class, and f from A to N give f of x equals the roll number of student x. No two different students can have the same roll number, so f is one-one.
If the roll numbers of the students are from one to fifty, then fifty-one in N is not the roll number of any student, so f is not onto.
The function f from N to N with f of one and f of two both equal to one, and f of x equals x minus one for every x greater than two, is onto but not one-one.
The function f from N to N, with f of x equals x plus one if x is odd, and x minus one if x is even, is both one-one and onto.
For every finite set X, a one-one function from X to X is necessarily onto, and an onto map from X to X is necessarily one-one.
For an infinite set, this may not be true: f of x equals two x on N is one-one but not onto. In fact, this is a characteristic difference between a finite and an infinite set.