Domain
The domain is the set of all inputs for which a function is defined. An input outside this set cannot be evaluated by that function.
Finding the Domain Example
Consider the function:
For AI agents: use /llms.txt for the Nakafa content index.
The rule divides by the input. At input , the denominator becomes zero:
Division by zero is undefined, so is excluded while every other real number is allowed.
So, the domain of the function is all real numbers except .
Another example:
This rule takes the square root of its input. Testing gives:
Over the real numbers, a square root requires a nonnegative radicand. Therefore, only and positive inputs are allowed.
So, the domain of the function is all real numbers greater than or equal to ().
The codomain is the target set declared as part of a function's definition. Every output must belong to this set, but the function does not have to reach every member of it.
For example, define a function .
We specify the Domain (input) as the set of natural numbers:
Then, we specify the codomain as the set of integers:
By choosing the integers as the codomain, we declare the set in which every value of must lie. For natural-number inputs, the function actually produces only positive even numbers. Those attained values form the range:
The chosen codomain is valid because every actual result in the range is an integer.
The codomain therefore describes the permitted target space. It is not a list of values the function necessarily produces.
The Range is the collection of all output values that are actually produced by the function when we input all members of the domain. The Range is part of (or sometimes exactly the same as) the Codomain.
Example:
For this example, the domain and codomain of are the integers.
When we input values from the domain:
The values that actually come out as output are , and so on (non-negative square numbers).
So, the Range of this function (with this domain) is the set:
Notice that this range () is a part (subset) of the codomain we defined (integers):
Not all members of the codomain are part of the range.
Domain, codomain, and range answer different questions. The domain prevents invalid inputs such as division by zero. The codomain declares the target space, while the range identifies the values the function actually reaches.
Mathematically, a function maps every element from the set Domain () to one element in the set Codomain (). This is often written as:
The Range () is the set of all actual results for every in the Domain. In other words:
The range is always a subset of the codomain:
Every value actually reached by the function must belong to the codomain. The reverse is not required: a codomain value may never occur as an output.
Let be defined by .
At , the denominator is zero:
The expression is undefined, so cannot be in the domain.
No. A fraction with numerator cannot equal .
Every nonzero real value is reached. Given , choosing gives . Thus:
Published: . Updated: .