A function is a relation which relates one variable with another variable. We generally denote the function by ‘f' because the word function starts with f. A relation ‘f' is said to be a function if for every values of ‘x' there is a unique value of ‘f(x)'. The input values of a function, i.e. x are real numbers and the output values of a function, i.e. f(x) are unique and real numbers.

Examples of a Function:

1) f(x) = 4x
2) f(x) = x2 - 3

A function is a relation that satisfies two conditions,

1) Every element in the domain has an image.
2) The image is unique.

## What is a Function?

Let us consider two sets A and B. The function f is the rule or definition which helps to map every element of set A to unique elements of set B. The elements of set A are called as the "Domain of the function" and the elements of set B are called as the "Range of the function".

In the above figure we see that every element of set A is mapped to unique element of set B. Thus 'f' is a function

.In the above figure we see that every element a of set A has two images 2 and 4, thus f is not a function.

### Definition of a Function

A function denoted by f : A $\rightarrow$ B is a rule that associates each element in A with a unique element in B.
A is called the domain and B is called the Co domain.
If x is an element in A with image y in B, then x is called the pre-image of y and y is called the image of x.
The set of all images in B are called the Range.

Every function is a relation, but every relation need not be a function.

Example 1:
Let f(x) = 7x2 - 2x + 1 be a function. Find the value of f(2) and f(k).
Solution:
Given that f(x) = 7x2 - 2x + 1, for values of f we replace x by 2 and the x by k.
Put x = 2 then,
f(2) = 7(2)2 - 2(2) + 1
= 28 - 4 + 1
= 25

Again put x = k, then
f(k) = 7k2 - 2k + 1

Example 2:
Find g(2) + g(-3), where g(x) = x3 - 2x.
Solution:
Given that g(x) = x3 - 2x,
now g(2) = 23 - 2(2)
= 8 - 4 = 4
Put x= -3 then,
g(3) = 33 - 2(3)
= 27 - 6 = - 21

So g(2) + g(-3) = 4 - 21 = -17

## Types of Function

We can classified function according to their properties or behavior under certain conditions. In mathematics we have even and odd function, rational function, polynomial function, injective function, bijective function, surjective function, composite function etc.

Even and Odd function:
Let f : A $\rightarrow$ B be a function. Then f is said to be even if for x $\in$ A we have f(-x) = f(x) and is said to be odd if
f(-x) = - f(x).

Example 1:
Let f : R $\rightarrow$ R be a given function defined as f(x) = -x sin x, then if we
replace x by -x, then
f(-x) = -(-x) sin(-x)
= -x sin x
Hence the given function is even function.

Example 2:
If f : R $\rightarrow$ R be a function and defined as f(x) = x3 cos x, then function
is odd function, since we replace x by -x, then
f(-x) = (-x)3 cos (-x)
= -x3 cos x

### Polynomial Function:

If a function define in the form of polynomial is known as polynomial function, like:
(a) f(x) = 3x4 - 4x2 + 1
(b) f(x) = x4 - x3 + x2 +x -1

If we have f(x) = k, then this type of function known as constant function.

### Rational Function:

If a function is in the form of f(x) = $\frac{g(x)}{h(x)}$, where g(x) and h(x) are the polynomial functions and h(x) $\neq$ 0.

Example:
f(x) = $\frac{x^2 + 2}{x - 1}$, where x$\neq$ 1, is a rational function.

### Inverse Function:

Before we learn what is an Inverse function, lets learn some definitions.
One to One function (Injective function)
Let f : A $\rightarrow$ B be a function. Then f is said to be one to one if the distinct elements of A are mapped to the distinct elements of B. That is no two elements in the set A has the same image. The A one to one function is also known as the Injective function.

Onto function (Surjective function)
Let f: A $\rightarrow$ B be a function. Then f is said to be Onto if every element in B has a pre-image associated with it. A Onto function is also known as the Surjective function.
In general in an Onto function, Co domain = Range.

Bijective function
A One to One and Onto function is called as the Bijective function.

Only Bijective functions will have inverse.

Inverse function: Let f : A $\rightarrow$ B be a bijective function. Then the inverse function f -1: B $\rightarrow$ A is defined as f -1(y) = x, if and only if f(x) = y.

### Example 1:

Let A ={a, b, c} and B ={1, 2, 3} be the two sets.
Then f : A $\rightarrow$ B defined by f = {(a, 1), (b, 2), (c, 3)} is a bijective since
the function maps every element to exactly one element and also all elements in
B have an image.

The inverse function of f is given by f -1 = {(1, a), (2, b), (3, c)}

Example 2:
Consider the function y = 2x+3 defined on the set of all real numbers.
To find the inverse of this function, we first write x in terms of y, we have
y = 2x+3
Subtracting 3 on both sides we get y -3 = 2 x

Dividing by 2, we get x =$\frac{y-2}{3}$

Now replace x by f -1(x) and y by x

The required inverse function is
f -1(x) = $\frac{y-2}{3}$

### Composite function:

Consider the functions f : A$\rightarrow$ B and g : B $\rightarrow$ C.
Let a $\in$ A . Then the image of a under f is f(a) and is contained in B. Since the domain of g is B, the image of f(a) under g is g(f(a)) which is in C. The rule which associates a $\in$ A to g( f (a) ) $\in$ C is called composition of the function f and g.

Definition
If f : A $\rightarrow$ B and g : B $\rightarrow$ C are two functions then
gof : A $\rightarrow$ C is defined by gof(x) = g(f(x)).

Example:
Let f : R$\rightarrow$ R and g: R$\rightarrow$ R are the two functions, where
f(x) = x +1 and g(x) = x2 + 1. Then calculate fog(x) and gof(x).
Solution:
Given f : R$\rightarrow$ R and g: R$\rightarrow$ R, where f(x) = x +1 and
g(x) = x2 + 1.

Now fog(x) = f{g(x)}
= f( x2 + 1)
= x2 + 1 + 1
= x2 + 2
Again gof(x) = g{f(x)}
= g(x + 1)
= (x + 1)2 + 1
= x2 + 2x +2

### Absolute Value Function:

Absolute value function is a function, in which the image is always the absolute value of the real number. Absolute value function is called so, because it omits the sign of the pre-image. Absolute value function is the positive distance between two real numbers.

The graph of an absolute value function always lies in the positive region.Lets consider an example:
f(x) = |3x-5|
Put x = 2
Then f(x) = |3*2-5| = |1| = 1
Put x = 4
Then f(x) = |3*4-5| = |7| = 7
The points we have already found are the correct ones.
But unless we don't select points that give a negative value inside the absolute value, we won't get a clear picture of the graph.
So let consider two more values such that we get a negative value inside the absolute value.
Put x = -1
Then f(x) = |3*-1-5|
= |-8|
= 8
Put x = 0
Then f(x) = |3*0-5| = |-5| = 5
Now we plot the points.
The graph is given by:

### Monotonic Function:

A function is known as monotonic function in an interval (a,b) if it is either decreasing or increasing on (a,b).
A function is said to be increasing on an interval (a,b) if the value of the function increase as the independent value increase,
i.e. if x1 > x2 then f(x1) > f(x2).
Function is said to be decreasing on (a,b) if the value of the function decrease as the independent value increase, i.e. x1 > x2 then f(x1) < f(x2).