 # How to Calculate Domain and Range in Math

When working with functions, you often need to provide $x$-values and $y$-values in your answer. In mathematics, the term domain is used for the set of $x$-values that fit in the problem, and range is used for the corresponding set of $y$-values. Formally, they are referred to as this:

Theory

### DomainandRange

The set of all $x$-values that fit in a function $f$ is called the domain of $f$ and is written ${D}_{f}$.

The set of all $y$-values determined by ${D}_{f}$ is called the range of $f$ and is written ${R}_{f}$.

These are the most common examples:

• For linear functions, the range is the set of all real numbers. You write ${R}_{f}=ℝ$.

• For quadratic functions, the range is either all numbers from the minimum and upwards, or all numbers from the maximum and downwards. You then write either ${R}_{f}=\phantom{\rule{-0.17em}{0ex}}\left[a,\infty \right)$ or ${R}_{f}=\phantom{\rule{-0.17em}{0ex}}\left(-\infty ,a\right]$, where $a$ is the $y$-value of the extremum.

• For rational functions expressed as

 $f\left(x\right)=\frac{ax+b}{cx+d},$

the range is all numbers except the $y$-value where the denominator is zero, that is, the horizontal asymptote. You can write it as

 ${R}_{f}=ℝ\setminus \phantom{\rule{-0.17em}{0ex}}\left\{\frac{a}{c}\right\},$

since $\frac{a}{c}$ is the horizontal asymptote.

Example 1

Robert is on land and throws a rock into the water. The stone follows a path given by the function $f\left(x\right)$, where $x$ is the distance from Robert to the stone in the horizontal direction, and $y$ is the height the stone has above the water at all times. You will learn that the height of the stone follows the function

 $f\left(x\right)=\text{}-0.1\text{}{x}^{2}+x+2$

Find the domain ${D}_{f}$ and the range ${R}_{f}$ for the function so that the throw makes sense.

To find the domain ${D}_{f}$ you must find the smallest and largest value that $x$ can have. You see that $x$ must be greater than 0. If you allow $x$ to be less than zero, Robert will end up throwing the stone further ashore and that does not match the exercise.

You must now find the largest value of $x$. The throw ends when the stone hits the water surface and that happens when $y=0$. You must therefore solve the equation

 $f\left(x\right)=0.$

Since $f\left(x\right)$ is a quadratic function you can use the quadratic formula to solve this equation. The solutions are therefore ${x}_{1}=-1.71$ and ${x}_{2}=11.71$. Since the domain starts at 0, you can ignore ${x}_{1}$ since ${x}_{1}$ is negative. The stone will hit the water after $11.71$ meters. The domain is therefore

 ${D}_{f}=\phantom{\rule{-0.17em}{0ex}}\left[0,11.71\right].$

To find the range ${R}_{f}$, you need to find the smallest and largest value $y$ can be from the $x$-values you found for ${D}_{f}$. The smallest $y$-value is when the rock hits the water surface. This happens at $y=0$— that is, at 0 meters above the water.

To find the largest $y$-value, you must find the $y$-value when the rock is at its greatest height above the water surface. This can be found by reading the $y$-value at the maximum of the function.

You can find the maximum by drawing the function or by using derivation. Regardless of the method you choose, the greatest height the stone will be is $4.5$ m. The range is then

 ${R}_{f}=\phantom{\rule{-0.17em}{0ex}}\left[0,4.5\right].$

Theory

### Asymptotes,DomainandRange

• A vertical asymptote intersects the $x$-axis. The mathematical way of writing a vertical asymptote is $x=a$, where $a$ is the number where the vertical asymptote intersects the $x$-axis. The domain of the function with a vertical asymptote does not contain $a$.

• A horizontal asymptote intersects the $y$-axis. The mathematical way of writing a horizontal asymptote is $y=a$, where $a$ is the number where the horizontal asymptote intersects the $y$-axis. The range of the function with a horizontal asymptote does not contain $a$.

Example 2

Find the domain and the range of $f\left(x\right)=\frac{2x+3}{x-1}$

You can find the domain ${D}_{f}$ by looking at the $x$-values where the function makes sense, that is, where you can insert an $x$-value and get an answer. You know that you can’t have zero in the denominator of a fraction. For this reason the function is not defined for the $x$-value that makes the denominator 0. Therefore you get

 $x-1=0⇔x=1.$

The domain is then all values of $x$ except the $x$-value of the vertical asymptote, in this case $x=1$. You write this mathematically

 ${D}_{f}=ℝ\setminus \phantom{\rule{-0.17em}{0ex}}\left\{1\right\}.$

You find the range ${R}_{f}$ by finding the horizontal asymptote. That is to say, the range is all real numbers except the horizontal asymptote. Since $f$ describes a hyperbola (as you can see from the function), you find the horizontal asymptote using the formula

 $y=\frac{a}{c}.$

Then you get

 $y=\frac{2}{1}=2.$

The range is then: All real numbers except the $y$-value of the horizontal asymptote, in this case $y=2$. You write this mathematically as

 ${R}_{f}=ℝ\setminus \phantom{\rule{-0.17em}{0ex}}\left\{2\right\}.$