Consider A and B as two non empty sets. We know that f which associates to each element x ∈ A is a unique element which is denoted by f(x) of B is a function from A to B and we write it as
f: A → B
So the domain, co domain and range of function f: A → B where A is the domain of f, B is the codomain of f and f(A) = {f(x): x ∈ A} is the range of f.
Example:
Consider A = {1, 2, 3, 4} and B = {1, 4, 9, 16, 25}
We know that f: A → B: f(x) = x2 Ɐ x ∈ A
All the elements of A has unique image in B where f is a function from A to B
By substituting the value
f(1) = 12 = 1
f(2) = 22 = 4
f(3) = 32 = 9
f(4) = 42 = 16
dom (f) = {1, 2, 3, 4} = A
codom (f) = {1, 4, 9, 16, 25} = B
range (f) = {1, 4, 9, 16}
Here, 25 ∈ B does not have pre image in A.