Function in Mathematics: Definition, Types, and Examples

Function in Mathematics: Definition, Types, and Examples

10 mins read456 Views Comment
Vikram
Vikram Singh
Assistant Manager - Content
Updated on May 7, 2024 16:54 IST

A relation from a non-empty set A to a non-empty set B is said to be a function from A to B if and only if every element of the domain is mapped to one and only one element in the co-domain. This article will briefly discuss what is function, different types of function with the help of example.

2022_12_MicrosoftTeams-image-108-1.jpg

Functions in Mathematics are the rule that defines a relationship between the dependent variable and the independent variable. These functions are widely used in Data Science and Machine Learning. Every machine learning model uses different types of functions, such as linear regression uses a linear function, and logistic regression uses a logistic sigmoid function (sigmoid function is a relational function that has an exponential function in the denominator). Once the model is built, we use different evaluation metrics to evaluate the performance of the model. These evaluation metrics uses different function such as the absolute function (Mean Absolute Error), Squared Function ( Mean Squared Error), Square Root Function ( Root Mean Square Error), log function (log mean squared error), and relational function (R-squared and Adjusted R-squared).

This article will briefly discuss different types of functions, examples, and their properties.

So, without further delay, let’s explore the functions of mathematics.

Table of Content

Before discussing functions, let’s first discuss cartesian products and relations since functions are special relations.

Cartesian Product of Set

Let A and B be two non-empty sets, then the set of all ordered pairs (x, y), where x belongs to A, and y belongs to B, is called the cartesian product of A and B.

Mathematical Representation

2022_12_image-86.jpg

Example: A = { 1, 2, 3}, B = {a, b, c}

A x B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c), (3, a), (3, b), (3, c)}

Relation

A relation from set A to set B is the subset of the cartesian product set A x B, and these subsets are derived by defining a relationship between the elements of the ordered pair.

Example: R = {(1, a), (2, a), (3, a)} is a relation from A to B

Note:

  1. Domain: The set of all first elements in the relation
    1. Domain in the above example: {1, 2, 3}
  2. Range: The set of all the second elements in the relation
    1. Range in the above example: {a}
  3. If n(A) = m and n(B) = k, then n (A x B) = mp
    1. The total number of possible relations between set A and set B is 2(mp).

Now, let’s move to our main topic, i.e., functions.

Function

A relation from a non-empty set A to a non-empty set B is said to be a function from A to B if and only if every element of the domain is mapped to one and only one element in the co-domain, i.e., a function is a relation such that no two pairs in the relation have the same first element.
Confuse!!
Let’s take an example,

2022_12_image-87.jpg

The first relation {(A, A), (B, B), (C, B), (D, D)} is a function. Here every element from the domain is mapped to one and only one element in the co-domain.

The second relation {(A, A), (B, C), (C, B), (C, C), (D, D)} is not a function since two pair ({C, B), (C, C)} has a same first element or in simple term, an element from the domain is mapped to two different elements in the co-domain.

Notation: A function f from A to B is represented by:

f: A -> B,

where,

A: domain of f

B: co-domain of f

Note: The set of all values of f(x) taken together is called the range of f.

Symbolically,

2022_12_image-88.jpg

Example: f: {1, 2, 3} -> N such that f(x) = x2. Find the range.

Answer: 

f(1) = (1)2 = 1

f(2) = (2)2 = 4

f(3) = (3)2 = 9

In this example, domain = {1, 2, 3}, co-domain = N, and range = {1, 4, 9}.

Now, we will discuss the different types of functions that we use.

Types of Function

Even and Odd Function

Even Function: A real-valued function f(x) is said to be an even function if it satisfies:

f(x) = f(-x)

i.e., for an even function, if we replace the input value x with -x it will produce the same output. The graph of the even function is symmetric about the y-axis.

Example: f(x) = x2

Answer: f(-x) = (-x) 2 = x 2 = f(x)

=> f(-x) = f(x)

Hence, f(x) is an even function.

Now let’s have a look at the graph of f(x) = x 2 .

2022_12_image-90.jpg

The graph of f(x) = x2 is symmetric about y-axis.

Odd Function: A real-valued function f(x) is said to be an odd function if it satisfies:

-f(x) = f(-x)

i.e., for an odd function, if we replace the input value x with -x it will produce the output equal to the negative of f(x). The graph of the even function is symmetric about the origin.

Example: (x) = x3

Answer: f(-x) = (-x) 3 = -x 3 =- f(x)

=> f(-x) = -f(x)

Hence, f(x) is an odd function.

Now let’s have a look at the graph of f(x) = x 3

2022_12_image-91.jpg

The graph is symmetric about the origin.

Note: It may be possible that the function is neither even nor odd.

Example: f(x) = x2 + x

Monotonic Function

A function is said to be monotonic if it is increasing or decreasing in a given interval.

Let a, b are two points in an interval such that a < b, then 

  • A function is said to be increasing if f(a) < f(b).
  • A function is said to be decreasing if f(a) > f(b).

Example: f(x) = x4 – 8x2for x in (-5, -2).

Answer: let a = -3 and b = -4, i.e., a > b

then

f(a) = f(-3) = (-3)4 – 8(-3)2 = 81 – 72 = 9

f(b) = f(-4) = (-4)4 – 8(-4)2 = 256 – 128= 128

=> f(a) < f(b) for a > b 

Hence, f(x) is decreasing in the interval (-5, -2).

Now, let’s take the same example with a different domain.

Example: f(x) = x4 – 8x2for x in (2, 5).

Answer: let a = 3 and b = 4, i.e., a < b

then

f(a) = f(3) = (3)4 – 8(3)2 = 81 – 72 = 9

f(b) = f(4) = (4)4 – 8(4)2 = 256 – 128= 128

=> f(a) < f(b) for a < b

Hence, f(x) is increasing in the interval (2, 5).

Derivative Test for Increasing and Decreasing

Let f(x) be any differentiable function on an interval, and if

  • f’(x) > 0, for all x in interval, then f(x) is increasing
  • f’(x) < 0, for all x in interval, then f(x) is decreasing.

One-one and Onto Function

One-One Function: A function is said to be a one-one function if each element in the domain has a unique (distinct) image in the co-domain.

Example: 

2022_12_image-92.jpg

Onto Function: A function is said to be an onto function if each element in the co-domain has at least one pre-image in the domain.

Example: 

2022_12_image-93.jpg

Note: If a function is both one-one and onto, then that function is said to be a Bijective Function.

2022_12_image-94.jpg

Special Functions

Exponential Function:

The mathematical function of form f(x) = ax is known as the exponential function, where x is an independent variable and a is a constant, such that a > 0 but a is not equal to 1.
Example:

2022_12_image-95.jpg

But the most common choice of base (b) in the exponential function is e, i.e., f(x) = ex  is the most commonly used exponential function. The graph of f(x) = ex.

2022_12_image-96.jpg

Properties of f(x) = ex

  • Domain = (-inf, inf)
  • Range = (0, inf)
  • e(x+y) = ex.ey
  • e(rx) = (ex)r
  • d/dx(e(ax)) = ae(ax) 

Logarithmic Function

The mathematical function of form f(x) = loga(x), where a > 0, is known as a logarithmic function. A logarithmic function is the inverse of an exponential function. 

Example

2022_12_image-97.jpg

Properties of y = log_a(x)

  • Domain = (0, inf)
  • Range = R (set of all real numbers)
  • log(x) is increasing for a > 0 and decreases for 0 < a < 1.
  • log(ab) = log(a) + log (b) 
  • xloga = logax
  • log (a/b) = log(a) – log(b)
  • logb(a) = logc(a) / (logc(b))

Polynomial Function

A polynomial of degree n is a function of the form:

f(x) = a0 + a1x + a2x2 + a3x3 + ….. + anxn

where, 

  •  a0, a1, ….., an are real number constant.
  • an can’t be zero since it is a leading coefficient
  • n is a non-negative integer

Example 

1.  f(x) = x2 + 2x + 1 

2. g(x) = x7 – 4x5 + 1

3. h(x) = 4x7 + x(½) -1

In the above three examples, first, two are polynomial functions, while the third function is not a polynomial function since the function contains the square root.

Note: 

Degree: The degree of the polynomial is the highest power of x in its expression.

  • In the above example (1 & 2), the degree of the polynomial functions is 2 and 7, respectively.

Types of Polynomial Functions

There are various types of polynomials, but the most commonly used are:

  • Zero-Polynomial Function: p(x) = 0
  • Constant Polynomial Function: p(x) = ax0
  • Linear Polynomial Function: p(x) = ax + b
  • Quadratic Polynomial Function: p(x) = ax2 + bx + c
  • Cubic Polynomial Function: p(x) = ax3 + bx2 + cx + d

Relational Function

A relational function is defined as the ratio of two polynomial functions, i.e., if p(x) and q(x) are two polynomial functions, then r(x) is said to be a relational function, if:

r(x) = p(x) / q(x)

where q(x) is not equal to zero for any value of x in the domain.

Example-1: f(x) = 1/xx != 0

Example-2: f(x) = 3x^3 + 5x + 3 / (x+1), x != -1

Absolute Value Function

A mathematical function that is defined as:

f(x) = x, if x > 0

       = 0, if x = 0

       = -x, if x < 0

Notation: The absolute value function f(x) is given by f(x) = |x|.

Example: 

x -3 -2 -1 0 1 2 3
f(x)= |x| 3 2 1 0 1 2 3

Graphical Representation of f(x) = |x|

2022_12_image-98.jpg

Conclusion

In this article we have briefly discussed what function is, different types of function such as: Even and Odd Function, Monotonic Function, One-one and onto function with the help of examples, and at the end of article, we have also discussed some special functions such as exponential, logarithmic, polynomial, and absolute value function.

Hope you will like the article.

Top Trending Article

Top Online Python Compiler | How to Check if a Python String is Palindrome | Feature Selection Technique | Conditional Statement in Python | How to Find Armstrong Number in Python | Data Types in Python | How to Find Second Occurrence of Sub-String in Python String | For Loop in Python |Prime Number | Inheritance in Python | Validating Password using Python Regex | Python List |Market Basket Analysis in Python | Python Dictionary | Python While Loop | Python Split Function | Rock Paper Scissor Game in Python | Python String | How to Generate Random Number in Python | Python Program to Check Leap Year | Slicing in Python

Interview Questions

Data Science Interview Questions | Machine Learning Interview Questions | Statistics Interview Question | Coding Interview Questions | SQL Interview Questions | SQL Query Interview Questions | Data Engineering Interview Questions | Data Structure Interview Questions | Database Interview Questions | Data Modeling Interview Questions | Deep Learning Interview Questions |

FAQs

What is a function in Mathematics?

A relation from a non-empty set A to a non-empty set B is said to be a function from A to B if and only if every element of the domain is mapped to one and only one element in the co-domain, i.e., a function is a relation such that no two pairs in the relation have the same first element.

What is a cartesian product of two sets?

Let A and B be two non-empty sets, then the set of all ordered pairs (x, y), where x belongs to A, and y belongs to B, is called the cartesian product of A and B.

What is a relation in mathematics?

A relation from set A to set B is the subset of the cartesian product set A x B, and these subsets are derived by defining a relationship between the elements of the ordered pair.

About the Author
author-image
Vikram Singh
Assistant Manager - Content

Vikram has a Postgraduate degree in Applied Mathematics, with a keen interest in Data Science and Machine Learning. He has experience of 2+ years in content creation in Mathematics, Statistics, Data Science, and Mac... Read Full Bio