In its simplest form the domain is all the values that go into a function, and the range is all the values that come out.
But in fact they are very important in defining a function. Read on!
Functions
A function relates an input to an output:
Example: this tree grows 20 cm every year, so the height of the tree is related to its age using the function h:
So, if the age is 10 years, the height is h(10) = 200 cm
Saying «h(10) = 200» is like saying 10 is related to 200. Or 10 → 200
Input and Output
But not all values may work!
So we need to say all the values that can go into and come out of a function.
A set is a collection of things, such as numbers.
Here are some examples:
In fact, a function is defined in terms of sets:
Formal Definition of a Function
A function relates each element of a set with exactly one element of another set (possibly the same set).
Domain, Codomain and Range
There are special names for what can go into, and what can come out of a function:
What can go into a function is called the Domain
What may possibly come out of a function is called the Codomain
What actually comes out of a function is called the Range
Example
• The set «A» is the Domain,
• The set «B» is the Codomain,
• And the set of elements that get pointed to in B (the actual values produced by the function) are the Range, also called the Image.
Part of the Function
. but WE can define the Domain!
In fact the Domain is an essential part of the function. Change the Domain and we have a different function.
Example: a simple function like f(x) = x 2 can have the domain (what goes in) of just the counting numbers <1,2,3. >, and the range will then be the set
Even though both functions take the input and square it, they have a different set of inputs, and so give a different set of outputs.
In this case the range of g(x) also includes 0.
Also they will have different properties.
For example f(x) always gives a unique answer, but g(x) can give the same answer with two different inputs (such as g(-2)=4, and also g(2)=4)
So, the domain is an essential part of the function.
Does Every Function Have a Domain?
Yes, but in simpler mathematics we never notice this, because the domain is assumed:
But in more advanced work we need to be more careful!
Codomain vs Range
The Codomain and Range are both on the output side, but are subtly different.
The Codomain is the set of values that could possibly come out. The Codomain is actually part of the definition of the function.
And The Range is the set of values that actually do come out.
Example: we can define a function f(x)=2x with a domain and codomain of integers (because we say so).
But by thinking about it we can see that the range (actual output values) is just the even integers.
So the codomain is integers (we defined it that way), but the range is even integers.
The Range is a subset of the Codomain.
Why both? Well, sometimes we don’t know the exact range (because the function may be complicated or not fully known), but we know the set it lies in (such as integers or reals). So we define the codomain and continue on.
The Importance of Codomain
Let me ask you a question: Is square root a function?
The reason is that there could be two answers for one input, for example f(9) = 3or-3
But it can be fixed by simply limiting the codomain to non-negative real numbers.
√ In fact, the radical symbol (like √x) always means the principal (positive) square root, so √x is a function because its codomain is correct.
So, what we choose for the codomain can actually affect whether something is a function or not.
Notation
Mathematicians don’t like writing lots of words when a few symbols will do. So there are ways of saying «the domain is», «the codomain is», etc.
This is the neatest way I know:
this says that the function «f» has a domain of «N» (the natural numbers), and a codomain of «N» also.
and either of these say that the function «f» takes in «x» and returns «x 2 «
Dom(f) or Dom f meaning «the domain of the function f»
Ran(f) or Ran f meaning «the range of the function f»
How to Specify Domains and Ranges
Learn how to specify Domains and Ranges at Set Builder Notation.
Three common terms come up whenever we talk about functions: domain, range, and codomain. This post clarifies what each of those terms mean.
Before we start talking about domain and range, lets quickly recap what a function is:
A function relates each element of a set with exactly one element of another set (possibly the same set).
That is, a function relates an input to an output. But, not all input values have to work, and not all output values. For example, you can imagine a function that only works for positive numbers, or a function that only returns natural numbers. To more clearly specify the types and values of a functions input and output, we use the terms domain, range, and codomain.
Speaking as simply as possible, we can define what can go into a function, and what can come out:
The difference between domain and range are somewhat obvious, but the difference between a codomain and range are subtle. More concretly, the codomain is the set of values that could possibly be output, while the range is the set of values that actually do come out. The range is actually a subset of the codomain. The distinction is interesting because sometimes we do not know the exact range of a function (say it is sufficiently complex) but we do know the codomain (such as all real numbers). In these cases, specifying the codomain is still useful, so we do that.
In functional programming, the domain and range are typically specified as expected data types that are input to and returned from a function. Other than this distinction, you can treat any discussions about domain, codomain, and range using the knowledge from this post.
When working with functions, we frequently come across two terms: domain & range. What is a domain? What is a range? Why are they important? How can we determine the domain and range for a given function?
Definition of Domain
Domain: The set of all possible input values (commonly the «x» variable), which produce a valid output from a particular function. It is the set of all values for which a function is mathematically defined. It is quite common for the domain to be the set of all real numbers since many mathematical functions can accept any input.
For example, many simplistic algebraic functions have domains that may seem. obvious. For the function \(f(x)=2x+1\), what’s the domain? What values can we put in for the input (x) of this function? Well, anything! The answer is all real numbers. Only when we get to certain types of algebraic expressions will we need to limit the domain.
For other linear functions (lines), the line might be very, very steep, but if you imagine «zooming out» far enough, eventually any x-value will show up on the graph. A straight, horizontal line, on the other hand, would be the clearest example of an unlimited domain of all real numbers.
What kind of functions don’t have a domain of all real numbers? What would stop us, as algebra students, from inserting any value into the input of a function? Well, if the domain is the set of all inputs for which the function is defined, then logically we’re looking for an example function which breaks for certain input values. We need a function that, for certain inputs, does not produce a valid output, i.e., the function is undefined for that input. Here is an example:
This function is defined for almost any real x. But, what is the value of y when x=1? Well, it’s \(\frac<3><0>\), which is undefined. Division by zero is undefined. Therefore 1 is not in the domain of this function. We cannot use 1 as an input, because it breaks the function. All other real numbers are valid inputs, so the domain is all real numbers except for x=1. Makes sense, right?
Division by zero is one of the very most common places to look when solving for a function’s domain. Look for places that could result in a division by zero condition, and write down the x-values that cause the denominator to be zero. Those are your values to exclude from the domain.
If division by zero is a common place to look for limits on the domain, then the «square root» sign is probably the second-most common. Of course, we know it’s really called the radical symbol, but undoubtedly you call it the square root sign. Why does that cause issues with the domain? Because, at least in the realm of real numbers, we cannot solve for the square root of a negative value.
What if we’re asked to find the domain of \(f(x)=\sqrt\). What values are excluded from the domain? Anything less than 2 results in a negative number inside the square root, which is a problem. Therefore the domain is all real numbers greater than or equal to 2.
Definition of Range
Range: The range is the set of all possible output values (commonly the variable y, or sometimes expressed as \(f(x)\)), which result from using a particular function.
The range of a simple, linear function is almost always going to be all real numbers. A graph of a typical line, such as the one shown below, will extend forever in either y direction (up or down). The range of a non-horizontal linear function is all real numbers no matter how flat the slope might look.
There’s one notable exception: when y equals a constant (like \(y=4\) or \(y=19\)). When you have a function where y equals a constant, your graph is a truly horizontal line, like the graph below of \(y=3\). In that case, the range is just that one and only value. No other possible values can come out of that function!
Many other functions have limited ranges. While only a few types have limited domains, you will frequently see functions with unusual ranges. Here are a few examples below. The blue line represents \(y=x^2-2\), while the red curve represents \(y=\sin\).
How can we identify a range that isn’t all real numbers? Like the domain, we have two choices. We can look at the graph visually (like the sine wave above) and see what the function is doing, then determine the range, or we can consider it from an algebraic point of view. Variables raised to an even power (\(x^2\), \(x^4\), etc. ) will result in only positive output, for example. Special-purpose functions, like trigonometric functions, will also certainly have limited outputs.
Summary: The domain of a function is all the possible input values for which the function is defined, and the range is all possible output values.
If you are still confused, you might consider posting your question on our message board, or reading another website’s lesson on domain and range to get another point of view. Or, you can use the calculator below to determine the domain and range of ANY equation:
Domain and Range Calculator
Summary
The inputs to a function are its domain. The possible outputs are the range.
Let’s return to the subject of domains and ranges.
When functions are first introduced, you will probably have some simplistic «functions» and relations to deal with, usually being just sets of points. These won’t be terribly useful or interesting functions and relations, but your text wants you to get the idea of what the domain and range of a function are. Small sets of points are generally the simplest sorts of relations, so your book starts with those.
Content Continues Below
MathHelp.com
State the domain and range of the following relation. Is the relation a function?
(It is customary to list these values in numerical order, but it is not required. Sets are called «unordered lists», so you can list the numbers in any order you feel like. Just don’t duplicate: technically, repetitions are okay in sets, but most instructors would count off for this.)
State the domain and range of the following relation. Is the relation a function?
this relation is indeed a function.
By the way, the name for a set with only one element in it, like the «range» set above, is «singleton». So the range could also be stated as «the singleton of 5 «
Content Continues Below
There is one other case for finding the domain and range of functions. They will give you a function and ask you to find the domain (and maybe the range, too). I have only ever seen (or can even think of) two things at this stage in your mathematical career that you’ll have to check in order to determine the domain of the function they’ll give you, and those two things are denominators and square roots.
Determine the domain and range of the given function:
The domain is all the values that x is allowed to take on. The only problem I have with this function is that I need to be careful not to divide by zero. So the only values that x can not take on are those which would cause division by zero. So I’ll set the denominator equal to zero and solve; my domain will be everything else.
Then the domain is «all x not equal to –1 or 2 «.
The range is a bit trickier, which is why they may not ask for it. In general, though, they’ll want you to graph the function and find the range from the picture. In this case:
the range is «all real numbers».
Determine the domain and range of the given function:
The domain is all values that x can take on. The only problem I have with this function is that I cannot have a negative inside the square root. So I’ll set the insides greater-than-or-equal-to zero, and solve. The result will be my domain:
Then the domain is «all x ≤ 3/2 «.
The range requires a graph. I need to be careful when graphing radicals:
The graph starts at y = 0 and goes down (heading to the left) from there. While the graph goes down very slowly, I know that, eventually, I can go as low as I like (by picking an x that is sufficiently big). Also, from my experience with graphing, I know that the graph will never start coming back up. Then:
the range is «all y ≤ 0 «.
Determine the domain and range of the given function:
y = –x 4 + 4
the domain is «all x «.
The range will vary from polynomial to polynomial, and they probably won’t even ask, but when they do, I look at the picture:
The domain of a function is the complete set of possible values of the independent variable.
In plain English, this definition means:
The domain is the set of all possible x-values which will make the function «work», and will output real y-values.
Graphing Calculator
Need a graphing calculator? Read our review here:
When finding the domain, remember:
Example 1a
Here is the graph of `y = sqrt(x+4)`:
Interactive examples
Don’t miss the applet exploring these examples here:
The domain of this function is `x ≥ −4`, since x cannot be less than ` −4`. To see why, try out some numbers less than `−4` (like ` −5` or ` −10`) and some more than `−4` (like ` −2` or `8`) in your calculator. The only ones that «work» and give us an answer are the ones greater than or equal to ` −4`. This will make the number under the square root positive.
Notes:
How to find the domain
In general, we determine the domain of each function by looking for those values of the independent variable (usually x) which we are allowed to use. (Usually we have to avoid 0 on the bottom of a fraction, or negative values under the square root sign).
Range
The range of a function is the complete set of all possible resulting values of the dependent variable (y, usually), after we have substituted the domain.
In plain English, the definition means:
The range is the resulting y-values we get after substituting all the possible x-values.
How to find the range
Example 1b
Let’s return to the example above, `y = sqrt(x + 4)`.
We notice the curve is either on or above the horizontal axis. No matter what value of x we try, we will always get a zero or positive value of y. We say the range in this case is y ≥ 0.
The curve goes on forever vertically, beyond what is shown on the graph, so the range is all non-negative values of `y`.
Example 2
The graph of the curve y = sin x shows the range to be betweeen −1 and 1.
The domain of y = sin x is «all values of x«, since there are no restrictions on the values for x. (Put any number into the «sin» function in your calculator. Any number should work, and will give you a final answer between −1 and 1.)
Where did this graph come from? We learn about sin and cos graphs later in Graphs of sin x and cos x
Note 1: Because we are assuming that only real numbers are to be used for the x-values, numbers that lead to division by zero or to imaginary numbers (which arise from finding the square root of a negative number) are not included. The Complex Numbers chapter explains more about imaginary numbers, but we do not include such numbers in this chapter.
Note 3: We are talking about the domain and range of functions, which have at most one y-value for each x-value, not relations (which can have more than one.).
Finding domain and range without using a graph
It’s always a lot easier to work out the domain and range when reading it off the graph (but we must make sure we zoom in and out of the graph to make sure we see everything we need to see). However, we don’t always have access to graphing software, and sketching a graph usually requires knowing about discontinuities and so on first anyway.
As meantioned earlier, the key things to check for are:
Example 3
Find the domain and range of the function `f(x)=sqrt(x+2)/(x^2-9),` without using a graph.
Solution
The denominator (bottom) has `x^2-9`, which we recognise we can write as `(x+3)(x-3)`. So our values for `x` cannot include `-3` (from the first bracket) or `3` (from the second).
To work out the range, we consider top and bottom of the fraction separately.
Numerator: If `x=-2`, the top has value `sqrt(2+2)=sqrt(0)=0`. As `x` increases value from `-2`, the top will also increase (out to infinity in both cases).
Denominator: We break this up into four portions:
When `x=-2`, the bottom is `(-2)^2-9=4-9=-5`. We have `f(-2) = 0/(-5) = 0.`
Between `x=-2` and `x=3`, `(x^2-9)` gets closer to `0`, so `f(x)` will go to `-oo` as it gets near `x=3`.
For `x>3`, when `x` is just bigger than `3`, the value of the bottom is just over `0`, so `f(x)` will be a very large positive number.
For very large `x`, the top is large, but the bottom will be much larger, so overall, the function value will be very small.
So we can conclude the range is `(-oo,0]uu(oo,0)`.
Have a look at the graph (which we draw anyway to check we are on the right track):
We can see in the following graph that indeed, the domain is `[-2,3)uu(3,oo)` (which includes `-2`, but not `3`), and the range is «all values of `f(x)` except `F(x)=0`.»