 # What is a function in Math – Definition, Example, and graph

What is a function in Math?

A function is just like a machine that takes input and gives an output.

To understand this concept lets take an example of the polynomial: ${ x }^{ 2 }$.

Now think ${ x }^{ 2 }$ is a machine.

In this machine, we put some inputs (say x) and we will see the outputs (say y).

Commonly we write a function as $y=f(x)$ i.e., $y$ as a function of $x$.

Now look at the results on the above table.

Here we give inputs $x$ and the function (i.e. the machine/ relationship) squares the number inside ( ) and we get the value (i.e., output as $y$) of the function.

If we take $x=7$ then we get $y=f(x)=f(7)={ x }^{ 2 }={ 7 }^{ 2 }=7\times 7=49$ .

Here the function squares the number 7 and the value of the function becomes 49.

The same happens for other inputs $2, 0, -2, -5$.

## Function definition

In a simple word the answer to the question “What is a function in Math?” is:

A function is a rule or correspondence by which each element x is associated with a unique element y.

Let $A$ and $B$ be two non-empty sets of real numbers.

Let $f$ be a rule or correspondence by which each element $x\epsilon A$ is associates with a unique element $y\epsilon B$, then $f$ is called a function defined on $A$ into $B$ and we write $y=f(x)$.

## Understand the function definition

A relation $f$ between $A$ and $B$ is shown on the image given below.

We will verify that this relation is a function or not by using the definition of the function.

Here

• $7$ is related to $49$,
• $2$ is related to $4$,
• $0$ is related to $0$,
• $-2$ is related to $4$,
• $-5$ is related to $25$.

You can see that element $4$ of the set $B$ is associated with two different numbers $2$ and $-2$ of the set $A$.

In other words, both the numbers $2$ and $-2$ are related to the same number $4$.

Is it confusing?

Are they obeying the function definition?

Yes, both $2$ and $-2$ are obeying the function definition as each of them corresponds to a unique number i.e. $4$.

If $2$ corresponds with two different numbers (say $4$ and $8$) then it disobeys the rule of function.

But here $2$ corresponds with a unique element (not with two or more elements) and follows the rule of function.

The same happens with the element ‘$-2$‘.

Therefore the above relation is a function.

🚀 Result 🚀

👉 Two or more different elements from the set $A$ can correspond to an element of set $B$.

## What is function notation?

Common function notation is $y=f(x)$ and we read this as f of x.

We can write the above function as $f(x)=x^{2}$

Sometimes we notify the function as $g(x), \: h(x), \: f(\theta ),\: g(u)$ etc.

For example,

• $g(x)=x+1$ ,
• $h(x)=2x-7$ ,
• $f(\theta )=\sin { \theta }$ ,
• $g(u) = 2u^{2}-7u+3$ .

Later we will deeply discuss different examples of function with different factors.

## Dependent and Independent variable

In the beginning of this discussion we took the function $y=f(x)=x^{2}$. Here the functional value y=f(x) is dependent on x.

In mathematics x is called the independent variable and y is called the dependent variable.

Some more examples:

## Domain, Codomain, and Range of a function

You can see in the above image there are two sets A={-5, -2, 0, 2, 7} and B={0, 2, 4, 25, 49}.

What is the domain, codomain, and range of the function $f$?

Here f(-5)=25, f(-2)=4, f(0)=0, f(2)=4, f(7)=49 i,e, all the elements of set A are correspond to a unique element of set B i.e., f(A)={0, 4, 25, 49} and the element 2 of B is not related to any element of A.

Here the set A={-5, -2, 0, 2, 7} is called domain of the function $f$ , set f(A)={0, 4, 25, 49} (a subset of set B) is called range of the function $f$ and set B={0, 2, 4, 25, 49} is called codomain of the function $f$.

The set f(A)={$f(x) : \forall x\epsilon \mathbb{R}$} is a subset of B, and is called the range of $f$ denoted by f(A).

With the concept of domain and codomain, we symbolically write the function $f:A\rightarrow B$ ( f maps A into B).

In later discussion we will denote domain as the capital letter D.

## This relation is a function

Example 1

This relation is an example of function because each element of set A is related to a unique element of set B, i.e.,

• element ‘a’ of set A is related to element ‘1’ of set B,
• element ‘b’ of set A is related to element ‘2’ of set B,
• element ‘c’ of set A is related to element ‘3’ of set B,
• element ‘d’ of set A is related to element ‘4’ of set B,
• every element of the set A is related to a unique element of set B and no element of A has more than one relationship.

You can notice in the above function that each one element of set A is related to one single element of set B. This kind of function is known as one to one function.

Example 2

The above example of a relation is the same as of example 1 except there are two extra elements ‘5’ and ‘6’ are given in set B and no elements of set A are related to these elements.

But it is clear that all the elements of set A are related to a unique element of set B as we mentioned in example 1.

Hence the relation given in example 2 follows the rule and definition of function and consequently it is a function (no matter there are two extra elements in set B with no relationship to any element of set A).

This type of function is also called “one to one function“.

Example 3

Here each element of set A is related to a unique element of set B, i.e.,

• element ‘a’ of set A is related to element ‘1’ of set B,
• element ‘b’ of set A is related to element ‘1’ of set B,
• element ‘c’ of set A is related to element ‘2’ of set B,
• element ‘d’ of set A is related to element ‘3’ of set B.

You can notice that element ‘a’ and ‘b’ are related to a single element ‘1’ of set B.

But this is not a violation of the definition of function because every element of the set A is related to a unique element of set B and no element of A has more than one relationship.

Therefore the above relation is an example of a function.

The above kind of function is known as “many to one function“.

Here the term ‘many’ refers to the elements of set A and ‘one’ refers to the elements of set B.

Example 4

This relation is also an example of “many to one function“.

This is a similar example like example 2 and 3 as there are two elements ‘4’ and ‘5’ and no elements of the set A are related to these elements.

But this fact does not violets the definition of function because every element of set A is related to a unique element of set B and no element of set A has more than one relationship.

## What is not a function?

There are some relations that does not obey the rule of a function. These relations are not Function.

The examples given below are of that kind.

Example 1

Look at the above relation.

Are you thinking this is an example of one to one function?

Then observe these six points

1. ‘a’ is not related to any element of B.
2. ‘b’ of A is related to ‘1’ of B,
3. ‘c’ of A is related to ‘2’ of B,
4. ‘d’ of A is related to ‘3’ of B,
5. ‘e’ of A is related to ‘4’ of B,
6. ‘k’ is not related to any element of B.

The elements b, c, d, and e obeys the definition of function.

But the elements ‘a’ and ‘k’ of set A are not related to any element of set B and this fact violets the function definition.

Therefore this relation is not a function.

Example 2

Like the above relation. This is also not a function because

• the element ‘a’ of A is not related to any element of B,
• also the element ‘k’ is not related to any element of B.

Example 3

Look at the relation of the elements below:

1. the element ‘a’ of A is related to two different elements ‘1’ and ‘2’ of B,
2. the element ‘b’ of A is related to a unique element ‘3’ of B,
3. the element ‘c’ of A is related to a unique element ‘4’ of B.

In the above-mentioned relation 2nd and 3rd points obeys the definition of a function.

But the 1st point does not obey the rule of function as we know an element of set A can not correspond to more than one element of set B and ‘a’ corresponds to two different elements of B and breaks the rule of uniqueness.

Therefore the relation is not a function.

## Ordered pair

Let us again take the function $y=f(x)=x^{2}$.

Here x is input (independent variable) and y is output (dependent variable).

The ordered pair is written as

(input, output)

where input is written first and output comes second.

So it looks like

(x,y)

or ( x,f(x) )

Now if the function takes the input 0, the output comes 0 and the ordered pair looks like

(0,0)

If the function takes -2 as input then 4 becomes the output and the ordered pair looks like (-2,4).

(2,4) is an ordered pair where 2 is input and the output is 4.

### Set of Ordered pairs

Above discussion we get 3 ordered pairs: (0,0), (-2,4) and (2,4).

Using these 3 ordered pairs we can define the function $y=f(x)=x^{2}$ as the set {(0,0), (-2,4), (2,4)}.

Here the set of input values is {-2, 0, 2} which is the domain of $y=f(x)=x^{2}$.

The set of the output values of {0, 4} which is the range of $y=f(x)=x^{2}$.

## Implicit and Explicit function

The division of functions into explicit and implicit usually refers to functions specified analytically:

### Explicit function

We may express y directly in terms of x (the argument) by an analytical expression in x. We then call y an explicit function of x

Example:

• $y=x^{2}$,
• $y=x+\sqrt{x}$,
• $y=x-7$ etc.

### Implicit function

When a function (y) is not directly written as a function x but written as a function of x and y then it is called an Implicit function.

Example:

• $y^{2}+3xy-x^{2}=1$,
• $y^{2}-4x=0$,
• $\frac{x^{2}}{4}+\frac{y^{2}}{9}=1$

### Implicit vs Explicit functions

A relation between two variables (say x and y) which is solved for either of them, can be expressed more than one explicit functions.

For example, for the function $y^{2}-4x=0$ can be expressed as two functions of x (taking x as independent variable and y as dependent variable i.e., y as a function of x) as

$y=+2x$ and $y=-2x$

and as a function of y (taking y as independent variable and x as dependent variable i.e., x as a function of y) as

## Algebraic operations on functions with graph

Now we will discuss different algebraic operations on function (sum, product, scalar multiplication, and quotient) on function.

Let $D\subset \mathbb{R}$ and $f:D\rightarrow \mathbb{R}$ and $g:A\rightarrow \mathbb{R}$ be two functions on D. Then

For a better understanding of the graphs given below, the graph of each function is shown with their respective color.

### 1. Sum of two functions

The sum function f+g is defined on D by

$(f+g)(x) = f(x) + g(x), x\epsilon D$

Example : Let ${\color{Magenta} f(x)=x^{2}}, x\epsilon \mathbb{R}$ and ${\color{Orange} g(x)=\sqrt{x}}, x\geqslant 0$.

Then the sum function is ${\color{Green} (f+g)(x)=x^{2}+\sqrt{x}}, x\geq 0$

### 2. Product of two functions

The product function $f\times g$ is defined on D by

$f\times g(x) = f(x)\times g(x), x\epsilon D$

Example : Let ${\color{Magenta} f(x)=x^{2}}, x\epsilon \mathbb{R}$ and ${\color{Orange} g(x)=\sqrt{x}}, x\geqslant 0$.

Then ${\color{Green} (f\times g)(x)=x^{2}\times \sqrt{x}=x^{\frac{5}{2}}}, x\geq 0$

### 3. Scalar multiplication of a function

Let $k\epsilon \mathbb{R}$ . The function $kf$ is defined on D by

$kf(x)=kf(x), x\epsilon D$

Example: Let $k\epsilon \mathbb{R}$ and ${\color{Magenta} f(x)=x^{2}},x\epsilon \mathbb{R}$.

Take k=3.

Then ${\color{Green}3f(x)=3x^{2}},x\epsilon \mathbb{R}$

### 4. The quotient of two functions

If $g(x)\neq 0,x\epsilon D$, the quotient $\frac{f}{g}$ is defined on D by

$\frac{f}{g}(x)=\frac{f(x)}{g(x)}, x\epsilon D$

Example: Let ${\color{Magenta} f(x)=x^{2}}, x\epsilon \mathbb{R}$ and ${\color{Orange} g(x)=\sqrt{x}}, x\geqslant 0$.

Then ${\color{Green} \frac{f}{g}(x)=\frac{f(x)}{g(x)}=\frac{x^{2}}{\sqrt{x}}=x^{\frac{3}{2}}},x\epsilon \mathbb{R}$

## Function examples

Example 1. $y=x-2$.

In this function

• y is the dependent variable,
• the independent variable is x,
• 2 is a constant,
• domain = $\mathbb{R}$, the set of real numbers,
• codomain = $\mathbb{R}$,
• range = $\mathbb{R}$,
• this is an explicit function.

Example 2. $z=2u$.

In this function

• the dependent variable is z,
• the independent variable is u,
• domain = $\mathbb{R}$, the set of real numbers,
• codomain = set of even real numbers,
• range = set of all even real numbers,
• this function is an explicit function.

Example 3. $w=v^{2}$.

In this function

• w is the dependent variable,
• v is the independent variable,
• domain = $\mathbb{R}$, the set of real numbers,
• codomain = {1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, ……} = set of all square numbers,
• range = {1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, ……} = set of all square numbers,
• explicit function.

Example 4. $y=ax^{2}+bx+c$

• the dependent variable is y,
• the independent variable is x,
• explicit function

Example 5. $x^{2}+y^{2}=4$

• this is an example of implicit function
• we can not directly say which is independent or dependent variable,
• if we write $x^{2} = 4-y^{2} \: or,\: x = \pm \sqrt{4-y^{2}}$ (i.e., as an implicit function), then y is the independent variable and x is the dependent variable.
• again if we write $y^{2} = 4-x^{2} \: or,\: y = \pm \sqrt{4-x^{2}}$ , then x is independent and y is dependent.

Some more examples of implicit functions are

Example 6. $x^{3}+y^{3}=3axy$

Example 7. $xy-2^{x}+2^{y}=0$

Example 7. $x^{2}+y^{2}+2gx+2fy+c=0$