A function is a particular relation. So, if f is a function from A into B then
f ⊏ A x B

for every a ∈ A, there is a unique b ∈ B such that (a,b) ∈ f.
In general, we denote f is a function from A to B as
f: A →B
and we say that f maps A into B or f transforms A into B.
A function is also called a mapping or a correspondence.
If f: A →B is a mapping (function) and (a,b) ∈ f, then we write f(a)=b, f(a) is called the image of a.
A is called the domain of f and B is called the codomain of f.
The set f(A) of all images of A under the mapping f is called the
range of f.
Note that the range and the codomain are not always equal.
Consider the following examples.

Let A represent the set of articles in a supermarket and B the set of their prices. There is a correspondence
between the articles and their prices.

Let X represent the set of schools in Texas and Y the set of their principals. There is a correspondence
between each school and its principal.
Let N={1,2,.........} be the set of natural numbers and S={1,8,27,....} be the set of the cubes of each natural
number.
Example 1:
Suppose A = {1,2,3} B = {a,b,c,d}
A rule f is given by
f(1) = b
f(2) = c
f(3) = a
f(3) = d
Is f a function?
According to what we have learned about functions, for every
a ∈ A there exists a unique b ∈ B. But f(3) = a and
f(3) = d. Since 3 is assigned to two elements of B, f is not a function.
Example 2:
Let f: Z →Z where Z is the set of integers. We define f as
f(x) = 1 if x is even
f(x) = 1 if x is odd
f is a function.
The domain of f is Z
The codomain of f is Z
But the range of f = {1, 1}
Example 3:
Which of the following are functions?
I II
III IV
V
The relations f, g and q send every member of A into a unique member of B. So f, g & q are functions.
h is not a function since 10 corresponds to c as well as d and p is not a function because c is not assigned to any member of D.
Definition:
Let A and B be two nonempty sets. A function f from A to B, denoted by f: A→B, is a rule that assigns each member of A to a unique member of B.
A is called the domain of f
B is called the codomain of f and
f(A) is called the range of f
Or,
a relation is called a function if and only if no two different ordered pairs in the relation have the same first coordinate.
If f maps A into B, where A,B are two nonempty sets such that x ∈A is associated with y ∈B then y is called the
f image of x or just the image of x, and is written as f(x)=y. Also, x is called the preimage or inverse image of y.
Example 4:
Let A = {1,2,3} B = {4,5}
How many different functions can be had from A into B ?
List them all.
Solution:
I II
III IV
V VI
VII VIII
There are eight possible functions from A into B.
Notice that n(A) = 3
n(B) = 2
number of functions = 23 = 8.
In general, if n(A) = m and n(B) = n then the number of possible mappings from A to B is nm.
Try these questions

Show that f(x) + f(1/x) = 0.
Solution:

Let f: R →R defined by
f(x) = x + 2 if x ≥3
= x  x if 3≤x <3
= 1  x if x≤3
Find f(2), f(5), f(4), f(1.6.....)
Solution:
Consider f (2) 2 < 3
∴ f(x) = x  x
∴ f(2) = 2  2
= 2  2 = 0
Consider f (5) 5 > 3
use f(x) = x+2
f(5) = 5+2 = 7
Consider f (4) 4 < 3
∴ we use f(x) = 1x
f(4) = 1  (4)
= 1 + 4
= 5
Consider f(+1.6 . . . ) 3 < +1.6 . . < 3
We use f(x) = x  x
f(+1.6 . . . ) = +1.6 . . .  +1.6 . . . 
= +1.6 . . .  [+(+1.6. . .)]
= +1.6 . . .  1.6 . . .
= 0