Lesson Explainer: Domain and Range of a Function Mathematics

In this explainer, we will learn how to identify the domain and range of functions from their equations.

Recall that when we want to represent a function, we typically use the following notation: 𝑓𝑋𝑌.

For a function 𝑓, we call 𝑋 the domain of the function and 𝑌 the codomain of the function.

In essence, a function is an operation that can take any element belonging to the domain 𝑋 and send it to some element belonging to the codomain 𝑌. Mathematically, we write this as 𝑓(𝑥)=𝑦, where 𝑥𝑋 and 𝑦𝑌. Therefore, we can think of the domain as being all possible valid inputs of the function.

On the other hand, the range of a function is the set of all possible values 𝑦𝑌 that can be obtained from applying 𝑓 to an element in 𝑋. Another way to think of this is that the range is all the possible outputs of the function. That is to say, if we calculated 𝑓(𝑥) for every possible 𝑥 in the domain and collected those numbers into a set, that set would be the range. Typically, we denote this set by 𝑓(𝑋), and it is a subset of the codomain.

Let us illustrate this idea in the diagram below.

Here, we have a function 𝑓 with a domain of 𝑋={2,1,2} and a codomain of 𝑌={1,0,2,5}. 𝑓 takes elements of 𝑋 and maps them to specific elements of 𝑌. Specifically, we have 𝑓(2)=5,𝑓(1)=2,𝑓(2)=5.

So, the range of the function is 𝑓(𝑋)={2,5}, since only 2 and 5 can be obtained by applying 𝑓 to elements in 𝑋. Note that in this case, the range is a proper subset of the codomain, since it contains fewer elements.

Additionally, we note that we can also represent this function as a set of ordered pairs as follows: 𝑓={(2,5),(1,2),(2,5)}.

In general, to write a function as a set of ordered pairs, we construct a set containing elements of the form (𝑥,𝑓(𝑥)), for every 𝑥 in the domain.

Having seen a basic example of the domain and range of a function, let us now concretely define them.

Definition: Domain and Range of a Function

For a function 𝑓𝑋𝑌, the domain 𝑋 is the set of all possible values such that 𝑓(𝑥) is valid. We can define it mathematically as 𝑋={𝑥𝑓(𝑥)}.

The range 𝑓(𝑋) is the set of all values we can get from applying 𝑓 to elements of 𝑋. Mathematically it is defined by 𝑓(𝑋)={𝑓(𝑥)𝑥𝑋}.

It is worth emphasizing that in the above definition, we specify that the domain has to only contain values such that 𝑓(𝑥) is valid. This raises the question, in what situation might 𝑓(𝑥) not be valid? One simple example of that is the function 𝑓(𝑥)=𝑥.

Since we can only take the square root of a nonnegative number, this function is not defined for any negative values. Hence, the domain has to be the nonnegative numbers, .

We note that in some cases, as in the previous example, we can arbitrarily restrict the domain 𝑋 of a function to a small set of numbers, or an interval (in this case it is not the true domain; rather it is a subset of the complete domain). In many cases, however, we want 𝑋 to be the largest possible set of values for which 𝑓(𝑥) is valid. To present a much more typical example of a domain and range we might encounter, suppose we have the function 𝑓𝑋𝑌 defined by 𝑓(𝑥)=𝑥+2.

Here, the domain is the largest set of values 𝑋 such that 𝑓(𝑥)=𝑥+2 is a defined operation for every 𝑥 in 𝑋. Were we to take the set we considered above, 𝑋={2,1,2}, we would naturally see that 𝑥+2 is defined for every element of this set. However, since this function clearly works for any real number, it makes more sense to take 𝑋=, the set of real numbers, so 𝑓 can be applied to any number we want.

What about the range? The range is always dependent on whatever the domain is. If it had been 𝑋={2,1,2}, the resulting range would have been 𝑓(𝑋)={𝑓(𝑥)𝑥𝑋}={𝑥+2𝑥{2,1,2}}={0,3,4}.

On the other hand, if we had chosen 𝑋=, the range would be 𝑓(𝑋)= too. This is because every real number can be written in the form 𝑓(𝑥)=𝑥+2; that is, given a real number 𝑦, there is always a real number 𝑥, such that 𝑥+2=𝑦.

As a side note, the codomain 𝑌 can be any set big enough to contain the range. In this instance, we can see that 𝑌= is sufficient, and in almost all instances this will be the default value we take. However, choosing the codomain to be equal to the range is in many cases the best option, as it eliminates any ambiguity.

For our first example, let us return to the idea of writing a function as a set of ordered pairs that we touched on earlier and make use of what we have learned about the domain and range.

Example 1: Identifying the Ordered Pairs of a Function given its Domain and Equation

𝑋 and 𝑌 are two sets of numbers where 𝑋={10,1,2,8} and 𝑌={12,7,60,6,48,4}. The function 𝑓(𝑥)=6𝑥, where 𝑓𝑋𝑌. Find the ordered pairs that satisfy the function and its range.


To find the set of ordered pairs that represents 𝑓, we just take each element in the domain 𝑋, apply 𝑓 to them one by one, and make pairs of the form (𝑥,𝑓(𝑥)). The domain 𝑋 is the elements {10,1,2,8}.

Let us take the first element 10. Applying 𝑓 to it, where 𝑓(𝑥)=6𝑥, we get 𝑓(10)=6×10=60.

Therefore, the first ordered pair is (10,60). For the second pair, we repeat this for every element in the set. This gives us the pairs {(10,60),(1,6),(2,12),(8,48)}.

Now, the range is the set of all values we get from applying 𝑓 to elements of 𝑋. Specifically, these values are the second elements in each of the above pairs: {60,6,12,48}.

Putting this together, the function is 𝑓={(10,60),(1,6),(2,12),(8,48)} and the range ={60,6,12,48}.

Just as we can find the range of a function given its domain and equation, we can also use its graph to find the domain and the range. This can be done by examining the graph closely and finding what values the points or lines correspond to. We demonstrate this below.

Example 2: Identifying the Range of a Discrete Function given its Graph

The figure below shows the graph of a function 𝑓.

What is the range of the function?


We note that in this example, the 𝑥-axis corresponds to the domain, 𝑋, and the 𝑦-axis corresponds to the range, 𝑓(𝑋). Every point on this graph is one instance of 𝑥 being mapped to 𝑓(𝑥). For instance, take the leftmost point, shown below.

Here, the 𝑥-value is 1 and the 𝑦-value is 2. This corresponds to the following relation between the input and the output: 𝑓(1)=2.

To get the range of this function, we take the 𝑦-value of every point on the graph and form a set. Altogether, the four points give us four 𝑦-values: 2,3,0,3.

Thus, the range is the set of these values, after removing the repeated numbers: 𝑓(𝑋)={3,2,0}.


We can also find the domain of the function in a similar way. The domain is the set of 𝑥-values of points on the graph. That is, 𝑋={1,2,3,4}.

So far we have mostly looked at discrete functions in our examples (ones where we have a finite number of values in the domain and range). Mostly, however, we want to consider continuous functions (ones with an infinite number of values in the domain and range). When considering continuous functions, we often have to consider intervals of values. Recall that an interval is the set of all real numbers between two values. For example, 𝑋=[5,7[ is the interval of all real numbers between 5 and 7, with 5 included. We can also use the notation 𝑋=]4,[ to mean all the real numbers between 4 and , that is, all the numbers greater than 4.

In the next example, we will consider the domain and range of a continuous function, where we have to consider the correct intervals based on the graph.

Example 3: Identifying the Domain of a Continuous Function given its Graph

Determine the domain of the function represented in the graph below.


Let us denote the above function by 𝑓. Following the usual convention, we note that the 𝑥-axis in this question corresponds to the domain of the function, 𝑋, and the 𝑦-axis corresponds to the range of the function, 𝑓(𝑋). Each point on the curve relates a point 𝑥 to a point 𝑦=𝑓(𝑥). We also note that the arrow on the curve shows that as 𝑥 increases toward , 𝑓(𝑥) continues in the same direction, that is, remains constant. On the other end, the curve ends in a solid dot, signifying that 𝑥=4 is included in the curve.

We can determine the domain of this function by considering how the points on the curve correspond to the 𝑥-axis, as shown below.

As we can see, the domain corresponds exactly to the 𝑥-values that are underneath the graph. The curve starts at 𝑥=4, and it continues onward as 𝑥 increases. Thus, the domain is the interval 𝑋=[4,[.


Although not required by the question, just as we found the domain of the function, we can find the range by projecting the curve on to the 𝑦-axis. We can see that the curve starts at 𝑦=1, then increases to 𝑦=9, where it remains constant. Thus, the range of 𝑓 is the interval given by 𝑓(𝑋)=[1,9].

We have now seen examples where we are given the domain of a function and need to calculate the range, but what about the opposite case? If we are given the equation for a function, and its range, can we calculate the domain?

The answer is, yes we can, by working backward and figuring out what values make sense. Suppose we had a function, 𝑓(𝑥)=2𝑥, and we were given that the range is [4,12]. Well, we know that the range is the possible values we can get out of the equation after applying 𝑓 to any 𝑥 in the domain. The easiest way to see this is with a diagram.

Here, we can see that on the 𝑦-axis, the range[4,12] has been mapped out. Upon following this region to the line 𝑓(𝑥)=2𝑥 and projecting it to the 𝑥-axis, we can find that the domain of the function is 𝑋=[2,6] (we note that this is not the full domain for this function of 𝑋=).

Note that it is not strictly necessary to draw a diagram to find this; we could make use of the fact that 𝑓(𝑥)=2𝑥 is an increasing function and that the endpoints 𝑓(𝑥)=4 and 𝑓(𝑥)=12 correspond to 𝑥=2 and 𝑥=6, so the domain has to lie between 2 and 6. However, it is always useful to be able to see what is going on.

In our next example, we will apply this and consider a problem where we have to find the domain of a function (possibly restricted), given its range.

Example 4: Identifying the Domain of a Function given its Range and Equation

Find the domain of the function 𝑓(𝑥)=𝑥+2, given that the range is [2,[.


The best way to approach this kind of question is to start off by determining what possible values can go into the function and drawing a graph of it.

When taking the square root of a number, it is necessary for that number to be nonnegative for the result to be a real number. Thus, we have the requirement 𝑥+20𝑥2.

Let us now sketch the graph of this function. It does not need to be exact, but to get an idea of what this graph looks like, we could plot some preliminary points and see how they join up. For example, we have


and so on. Seeing that the curve continues upward, with a slope that is decreasing, we get the following diagram.

Now recall that the range is [2,[. The range corresponds to the 𝑦-axis on the graph, so we begin by marking 𝑓(𝑥)=2, and everything above it, on the 𝑦-axis. We note that the interval is closed on the left; hence, 2 is included in this region.

We then draw a line segment from the 𝑦-axis to the curve and project this region on to the 𝑥-axis. This region corresponds to the domain. Putting this information on the diagram, we get the following.

The dotted line segment, which represents the lower bound of the domain/range, intersects the 𝑦-axis at 2 and the 𝑥-axis at 2. This point corresponds to 𝑓(2)=2, which we calculated in the table above. Since 𝑓(2) is included in the range, 2 must be included in the domain too. On the other hand, the domain and range clearly have no upper bound.

In conclusion, we can say that the domain must be 𝑋=[2,[.

Now, we have seen that it is possible to find the domain of a function given its range and equation, but what if we only have the equation? Previously, we have dealt with questions where the domain and/or range may be restricted compared to the full domain and range. However, typically speaking, the domain refers to the largest possible valid set of inputs for a function, and the range corresponds to that.

Let us consider an example of this below.

Example 5: Identifying the Domain and Range of a Function given its Equation

Determine the domain and the range of the function 𝑓(𝑥)=𝑥+1.


Here we are effectively being asked to find the largest possible set of input values of the function and the resulting set of outputs.

First of all, we have to ask ourselves, are there any values of 𝑥 for which 𝑓(𝑥) is not defined? That is, given some 𝑥, can we follow the steps below? 𝑥𝑥,𝑥+1.squareaddonetoresult

Both of the above operations can be done for any 𝑥. Therefore, the domain is the largest set possible, 𝑋=.

To find the range, we need to find the possible range of outputs after applying 𝑓 to any 𝑥. Probably the best way to do this is to draw a graph to see how 𝑓(𝑥) behaves for different values of 𝑥. Since it might not be immediately obvious how to draw it, we begin by marking some preliminary points:


If we join these points up and continue the graph onward, we get the following graph.

We note that 𝑥=0 seems to be the lowest point on the curve, giving 𝑦=1, and that, on either side, the curve continues upward. We can confirm that this is the case by noting the fact that 𝑥0 for all 𝑥. Consequently, 𝑥0𝑥+11.

So, 𝑓(0)=1 must be the minimum point. To find the range, we have to find all the possible values 𝑥+1 can take. Since 𝑓(0)=1 is the smallest value and as 𝑥 increases (or decreases), 𝑓(𝑥) increases, we can conclude that the range must be the interval from 1 to infinity. That is, 𝑓(𝑋)=[1,[.

In conclusion, the domain of 𝑓 is and the range is [1,[.

Let us recap the key points we have learned during this explainer.

Key Points

  • For a function 𝑓𝑋𝑌, the domain 𝑋 is the set of all possible values such that 𝑓(𝑥) is valid: 𝑋={𝑥𝑓(𝑥)}.
  • The range 𝑓(𝑋) is the set of all values we can get from applying 𝑓 to elements of 𝑋: 𝑓(𝑋)={𝑓(𝑥)𝑥𝑋}.
  • We can find the domain by figuring out what values of 𝑥 are valid for 𝑓.
  • We can find the range by calculating the possible values 𝑓(𝑥) can take, given its domain.
  • Graphs can be crucial for helping us to find the domain and range of a function. The 𝑥-axis typically corresponds to the domain and the 𝑦-axis to the range.

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.