## What is a Function?

A function in mathematics is a mapping that maps all the elements of a set to the elements in another set. It can be expressed as a graph.

The mathematical function works just like a machine. Suppose you go to a juice shop and you want to drink apple juice. You might have noticed the shopkeeper put the apple slices in a juice maker. After grinding, the apple slices turn into juice and now he can serve you the juice. So the input here was apple slices and the machine used for grinding is a mixer. The output is apple juice.

This is exactly how mathematical functions work. We give some input value and some operation happens. After the operation is done we get the output. The elements in set X are written as the symbol x. If x is the input from the set X, we get the result as f(x).

## Components of a Function

The expression we get as the output is called the image. The collection of all the outputs of the mapping is defined as the range. Consider a function $f:X\to Y$. The function is the operator defined here. The result f(x) is an element of the set Y expressed as$f\left(x\right)=y$. The set X is defined as domain and set Y is defined as codomain. The codomain set has all the elements of Y. An element from set X that is mapped to an element of set Y is called a pre-image. The range, which is a part of Y, has all the elements of Y which have pre-images in X.

### Example

Let f be a mathematical function mapping the elements in the set X to the set Y. Suppose that it is defined as $f\left(x\right)=2x$. 2x is an expression in algebra. It means that $f\left(x\right)=y$ returns twice the value of x. If the input is $x=2$, then the output is $f\left(x\right)=4$. Here number 4 is the image of number 2 and number 2 is the pre-image of number 4. It can be written as an ordered pair with two elements namely the input x and output y as $\left(2,4\right)$.

If the input is $x=8$, then the output is $f\left(x\right)=16$. Here, number 16 is the image of number 8 and number 8 is the pre-image of number 16. This can be written as an ordered pair $\left(8,16\right)$. If the input is $x=10$, then find the output$f\left(x\right)$. Also find what is image, pre-image and how it can be written as an ordered pair.

This is a part of the product of X and Y which gives all possible ordered pairs of X and Y, that is $X×Y$.

### Cartesian Product

The product of two sets X and Y, called the Cartesian product $X×Y$, results as the collection of all possible ordered pairs $\left(x,y\right)$, where x is a part of X $\left(x\in X\right)$ and y is a part of Y $\left(y\in Y\right)$.

If X equals the collection of integers 1, 2, and 3 and the set Y equals the integers 7 and 8, the product of X and Y results as the collection of all ordered pairs $\left(1,7\right),\left(1,8\right),\left(2,7\right),\left(2,8\right),\left(3,7\right),\left(3,8\right)$. Thus, the product is written as $X×Y=\left\{\left(1,7\right),\left(1,8\right),\left(2,7\right),\left(2,8\right),\left(3,7\right),\left(3,8\right)\right\}$.

Note that for a function each $x\in X$ is defined to exactly one pair $\left(x,y\right)$. A function from X to Y is a subset of $X×Y$and cannot have the ordered pairs $\left(1,7\right)$ and $\left(1,8\right)$, since $1\in X$ cannot be paired with two elements of Y in a function.

The elements 1, 2, and 3 of X should be paired with exactly one element of Y. Let set S to be a part of $X×Y$ such that $S=\left\{\left(1,7\right),\left(3,8\right)\right\}$. Then S is not a mathematical function from X to Y because the element $2\in X$ has not been paired with any element of Y. In other words, 2 has no image.

The subset $R=\left\{\left(1,7\right),\left(2,7\right),\left(3,8\right)\right\}$ of $X×Y$ is a mathematical function because all the elements belonging to X are paired with only one element of Y (1 is mapped with 7 alone and not 8, 2 is mapped with 7 alone and 3 is mapped with 8 alone) and all the elements of X has an image in Y.

Functions

Not functions

## Relation

We shall see the difference between relations and functions in mathematics.

In mathematics, a relation by definition is a collection of ordered pairs with some relationship. If $M=\left\{1,4,5\right\}$ and $N=\left\{4,9,16,25\right\}$ then the product of M and N results in a collection of all possible ordered pairs of M and N.

$M×N=\left\{\left(1,4\right),\left(1,9\right),\left(1,16\right),\left(1,25\right),\left(4,4\right),\left(4,9\right),\left(4,16\right),\left(4,25\right),\left(5,4\right),\left(5,16\right),\left(5,25\right)\right\}$

Define a relation R with a rule that the element $n\in N$ is square of $m\in M$.

Then $R=\left\{\left(4,16\right),\left(5,25\right)\right\}$.

R is a subset of $M×N$. But this is not a function because 1 has no image.

## Types of Mappings

Having known about the relations and functions let us look at some mappings from set X to set Y to check which relations are functions and which relations are not functions.

There are 4 types of mappings. They are

1. One-to-one
2. One-to-many
3. Many-to-one
4. Many-to-many

### One-to-One Mapping (1-1)

In mathematics, a relation from X to Y has called a one-to-one mapping if each element in the range maps exactly one point in the domain. A pictorial example is given below.

Domain=$\left\{1,2,3\right\}$. Co-domain=$\left\{D,B,C,A\right\}$. The range set= $\left\{D,B,A\right\}$. The range by definition is the collection of all $y\in Y$such that $y=f\left(x\right)$ for some $x\in X$. $D\in Y$ has only one pre-image 1. $B\in Y$has exactly one pre-image 2. Now guess how many pre-images A has and the pre-image/pre-images. This can be expressed in a graph.

Let us look into another example and find point out if it is a 1-1 mapping or not.

Domain=$\left\{1,2,3,4\right\}$. The range set= $\left\{D,B,C\right\}$. $D\in Y$ has only one pre-image 1. $B\in Y$has exactly one pre-image 2. But C has 2 pre-images namely 3 and 4. Therefore this is not a 1-1 mapping.

Now let us check if 1-1 mapping is a function. For a mapping to be a function we must check two conditions from the definition. All the elements in X must have an image in Y and any element $x\in X$should have one and only one image in Y. The 1-1 mapping satisfies both the conditions.

Therefore, 1-1 mapping is a mathematical function.

### One-to-Many Mapping

In mathematics, a relation from X to Y is called a one-to-many mapping if the elements in the X have more than one image in the range. But is this a function? Note that every element in the domain should have only one image in the codomain of a function. In a one-to-many mapping there can be more than one image. Therefore, this is not a mathematical function.

In the above representation, 3 has two images b and c. This is not a mathematical function.

### Many-to-One Mapping

In mathematics, a relation R from X to Y is called a many-to-one function if any element in the codomain has multiple pre-images.

2 and 3 from the domain have the same image Q in the codomain. The relation satisfies the definition of the function. In the relation $R=\left\{\left(1,P\right),\left(2,Q\right),\left(3,Q\right)\right\}$, 1 has one image P, 2 has one image Q and 3 has one image Q. All the elements in the domain have an image.

Therefore many to one mapping is a mathematical function.

### Many-to-Many Mapping

In mathematics, a relation from X to Y is called a many-to-many mapping if an element in the domain has many images and an element in the codomain has many pre-images.

In the above mapping, the relation $R=\left\{\left(0,2\right),\left(0,3\right),\left(1,3\right),\left(2,4\right),\left(3,4\right),\left(3,5\right)\right\}$.

The element $0\in X$ has two images namely $2\in Y$ and $3\in Y$. The element $3\in X$ has two images namely $4\in Y$ and $5\in Y$.

Similarly, the element $3\in Y$ has two pre-images namely $0\in X$ and $1\in X$. The element $4\in Y$ has two pre-images$2\in X$ and $3\in X$.

Guess if the relation is a function. This is not a function because some elements in the domain have more than one image.

Therefore, a many-to-many mapping is not a function.

## Onto Function

A mathematical function mapping from X to Y is onto if for each element y in the codomain Y, there are one or more pre-images in the domain X. Here, the codomain is the range because all elements have at least one pre-image.

In the above representation, all the elements in the codomain have at least one pre-image. This can be expressed as a graph also.

Therefore this is onto.

In the above representation, $R\in Y$ has no pre-image. Thus, it is not an onto function. Such a function is called an into function.

## Common Mistakes

Note that in mathematics a function is a special type of relation. This is a special type because even though all functions are relations yet all relations are not functions.

## Context and Applications

This topic is significant in the professional exams for both undergraduate and graduate courses, especially for:

• Bachelor of Science in Mathematics
• Master of Science in Mathematics

### Want more help with your calculus homework?

We've got you covered with step-by-step solutions to millions of textbook problems, subject matter experts on standby 24/7 when you're stumped, and more.
Check out a sample calculus Q&A solution here!

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.

### Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

Tagged in
MathCalculus