# Basic Concept of Relations and Functions

### Relations and Functions

Relations and functions – these are the two different words having different meanings mathematically. You might get confused about their difference. Before we go deeper, let’s understand the difference between both with a simple example.

An ordered pair is represented as (INPUT, OUTPUT):

The relation shows the relationship between INPUT and OUTPUT. Whereas, a function is a relation which derives one OUTPUT for each given INPUT.

Note: All functions are relations, but not all relations are functions.

Relations

Relation is helpful to find the relationship between input and output of a function.

A relation R, from a non-empty set P to another non-empty set Q, is a subset of P X Q.

For example, Let P = {a, b, c} and Q = {3, 4} and

Let R = {(a, 3), (a, 4), (b, 3), (b, 4), (c, 3), (c, 4)}

Here R is a subset of A x B. Therefore R is a relation from P to Q.

(i) A relation may be represented either by the Roster form or by the set builder
form, or by an arrow diagram which is a visual representation of a relation.
(ii) If n (A) = p, n (B) = q; then the n (A × B) = pq and the total number of possible
relations from the set A to set B = 2pq.

Ordered Pair

An ordered pair is a pair formed by two elements that are separated by a comma and written inside the parantheses. For example, (x, y) represents an ordered pair, where 'x' is called the first element and 'y' is called the second element of the ordered pair. These elements have specific names according to what context they are being used and they can be either variables or constants. The order of the elements has a certain importance in an ordered pair. It means (x, y) may not be equal to (y, x) all the time.

(2, 5), (a, b), (0, -5), etc are some examples of ordered pairs.

Cartesian products of  two sets
Definition : Given two non-empty sets A and B, the set of all ordered pairs (x, y),
where x ∈ A and y ∈ B is called Cartesian product of A and B; symbolically, we write
A × B = {(x, y) | x ∈ A and y ∈ B}

Example
If A = {1, 2, 3} and B = {4, 5}, then
A × B = {(1, 4), (2, 4), (3, 4), (1, 5), (2, 5), (3, 5)}
and B × A = {(4, 1), (4, 2), (4, 3), (5, 1), (5, 2), (5, 3)}
(i) Two ordered pairs are equal, if and only if the corresponding first elements are
equal and the second elements are also equal, i.e. (x, y) = (u, v) if and only if x =
u, y = v.
(ii) If n(A) = p and n (B) = q, then n (A × B) = p × q.
(iii) A × A × A = {(a, b, c) : a, b, c ∈ A}. Here (a, b, c) is called an ordered triplet

Cardinality of Cartesian Product

The cardinality of Cartesian products of sets A and B will be the total number of ordered pairs in the A × B.

Let a be the number of elements of A and b be the number of elements in B.

So, the number of elements in the Cartesian product of A and B is ab

i.e. if n(A) = a, n(B) = b, then n(A × B) = ab

Relation Representation

There are other ways too to write the relation, apart from set notation such as through tables, plotting it on XY- axis or through mapping diagram.