## Domain, Codomain, Range

A function in mathematics is defined within a specified range, and we define domain terms for that. However, this topic is not only limited to this aspect. It would help if you dive in to understand it in a better way. First, you need to understand the proper definition for a function, its domain, range and codomain. Considering the simplest form of a function, it is defined as the values that can satisfy a function's conditions. The range is defined as the output that we get after solving a function.

### How will you Define a Function for a Domain Range?

A function is a way to relate input to get its output. In real-time, functions are the necessary part of understanding and implementing. Also, functions are required for methodical applications. Thus, you can solve different real-world problems with it.

If you want to understand a function and relation between two functions, this is possible with a cartesian product. The basic points to define a function includes:

A function may not satisfy all mathematical values.

You can define a function with the help of sets.

A function will relate each value of one set to the values of another set. It can be the same set or the different one. A set is the collection of values, numbers or things.

Consider the below diagram:

[Image will be Uploaded Soon]

In the above diagram, X and Y are two sets and function is defined from values of X to that of Y.

### Domain and Range of a Function

Not all the values are specified for a function. Some specifications define it as what can be put into a function to get the desired results. There are three terms that are to be defined for a function:

### Domain, Codomain and Range

The domain is defined as the set, which is to be input in a function. Or, we can say input values that satisfy a function. According to the above diagram, a function's values are defined by the values present in the left set.

The range is defined as the actual output you are supposed to get by entering the function's domain. The range is all dependent upon the function variables.

Codomain is defined as the total values that are present in the right set that is set Y. These define the possible values expected to come out after entering domain values.

Consider the example for the below sets of a function to understand the concept of domain, codomain and range.

[Image will be Uploaded Soon]

According to the diagram, Domain is the entire set A and codomain is set as the whole B, and Range is the outcome after entering domain values. Or simply saying, the range is the pointed values of set B.

### How to Relate Codomain and Range?

In short terms, we can say that range is the subset of the codomain. It is not important that a function might satisfy all the values of the codomain. However, the values that we get after entering domain values in a function are the range. Thus, it is part of the codomain set.

### Difference Between Codomain and Range

Without a doubt, both codomain and range are present on the output side. However, there is a difference between the two of them. Codomain is defined as the possibility of the values as an outcome. Thus we can say that codomain is one part while defining a function. However, on the other hand, the range is the actual output that we are supposed to get.

Q1. What is the Difference Between Domain, Codomain and Range?

In simple terms, domain relates to the input of the function and codomain and range are associated with the output of a function. However, the basic difference between the three is defined with the help of the below example:

In terms of mathematics, suppose we define a function f as:

f: N → N

where f is the function and N is the domain that is input values are natural numbers. Codomain is also N present on the right-hand side of the arrow that is also natural numbers. Now consider function f as:

f : x → x²

Here x is the domain and x² is the codomain of the function f.

Also, the range is not necessarily x² for a function. The range is the subset of the codomain, which is defined as the square of x.

Q2. How to Find the Domain and Range of a Function?

The domain is the values that you can use in the independent variables. There must be no zero at the bottom of the fraction. There are special restrictions that are applied to find the domain of the function. Suppose we are given a function f(x) as:

f(x) = 2x + 5 of f(x) = x² - 2

Here, it satisfies all conditions to define a domain for a set of real numbers. Codomain will also be a real number in the result. However, range will be defined from values of function from -1 to infinity.

Thus range is the set of values from the codomain set that is actually possible to get as the output. These are the values that we get after we substitute domain values in the function. Suppose we represent f(x) = y. Here y is the range of the function f(x) from the codomain as real numbers.