Home » Math Theory » Graphs and Charts » Domain, Co-Domain and Range of a Function

Domain, Co-Domain and Range of a Function

Quick answer

For a function f : A → B, the domain is A, the set of allowed inputs; the co-domain is B, the set the outputs are taken from; and the range is the set of outputs that actually occur, {f(x) : x ∈ A}. The range is always part of the co-domain. Example: f(x) = x² from {1, 2, 3} to {1, 2, …, 10} has range {1, 4, 9}.

Reviewed by the Helping with Math Team · Updated 10 October 2026

What are the domain, co-domain and range?

Functions form one of the most important building blocks of Mathematics. The word “ Function “ has been derived from a Latin word meaning operation and the words mapping and map are synonymous with it. There are many standard defined functions that we use such as modulus functions, logarithmic functions, exponential functions etc.

Domain, co-domain and range: definitions

Domain – The set of all possible values which qualify as inputs to a function is known as the domain of the function. In other words, the domain of a function can be defined as the entire set of values possible for independent variables.

Co-domain – the set that a function’s outputs are allowed to come from. For f : A → B, the co-domain is B. It is chosen when the function is defined, and not every element of it has to be used.

Range – the set of outputs the function actually produces when every element of the domain is put in. The range is always a subset of the co-domain; it can be the whole co-domain or only part of it.

Mathematically, the domain, co-domain and range of a function can be defined as –

Let f : A → B. then the set A is known as the domain of f and the set B is known as the co-domain of f. The set of all f-images of elements of A is known as the range of f or image set of A under f and is denoted by f ( A ).

Thus f ( A ) = { f (x) : x ∈ A } = Range of f

In simple terms, we can thus define domain, co-domain and range of a function as –

Domain refers to what can go into a function. Codomain on the other hand refers to what may possibly come out of a function. The range of a function refers to what actually comes out of a function.

Mapping diagram for f(x) = 2x

f(x) = 2x
Domain = {1, 2, 3, 4}. Co-domain = {1, 2, …, 12}.
Range = {2, 4, 6, 8} (blue).

Try it: pick a rule. Arrows send each input in the domain A = {1, 2, 3, 4} to its output in the co-domain B = {1, …, 12}; the outputs actually hit (blue) form the range.

Let us now understand, the domain, co-domain and range of some common functions.

Modulus function

The modulus (absolute value) function is defined by

$f(x) = |x| = \begin{cases} -x, & x \lt 0 \\ x, & x \ge 0 \end{cases}$

Domain and range of the modulus function

Any real number can go in, so the domain is ℝ, the set of all real numbers. The output is never negative, so the range is the set of non-negative real numbers, [0, ∞) = { x ∈ ℝ : x ≥ 0 }.

Graph of y = |x|xy−4−22424(0, 0)y = |x|Domain: all real numbersRange: y ≥ 0, that is [0, ∞)
y = |x| is a V with its corner at the origin. Every x can go in (domain ℝ); the outputs are 0 and above (range [0, ∞)).

For x ≥ 0 the graph is the line y = x, and for x < 0 it is the line y = −x, giving a V shape with its corner at the origin.

Logarithmic function

If a > 0 and a ≠ 1, the function $f(x) = \log_a x$, defined for x > 0, is called the logarithmic function with base a.

It is the inverse of the exponential function: if f : A → B is a bijection, the function g : B → A that sends each y ∈ B to the unique x ∈ A with f(x) = y is the inverse of f. For logarithms this means

$\log_a x = y \iff x = a^{y}$

Domain and range of the logarithmic function

Only positive numbers have a logarithm, so the domain is (0, ∞). Every real number is the logarithm of some positive number, so the range is ℝ.

Case 1: a > 1. $\log_a x \lt 0$ for 0 < x < 1, loga 1 = 0, and $\log_a x \gt 0$ for x > 1. The graph rises from left to right.

Case 2: 0 < a < 1. $\log_a x \gt 0$ for 0 < x < 1, loga 1 = 0, and $\log_a x \lt 0$ for x > 1. The graph falls from left to right.

Graphs of log base 2 and log base one halfxy2468−4−224y = log₂ xy = log½ xDomain: x > 0 (dashed line x = 0 is never reached)Range: all real numbers. Both pass through (1, 0).
log₂ x (green, a > 1) rises and log½ x (blue, 0 < a < 1) falls. Both pass through (1, 0) and hug the y-axis without touching it. Domain (0, ∞), range ℝ.

Exponential function

A function f : ℝ → ℝ defined by $f(x) = a^{x}$, where a > 0 and a ≠ 1, is called the exponential function with base a. The base must be positive: with a negative base such as (−2)x, values like x = ½ do not give a real number.

The shape of the graph depends on the base a: it rises when a > 1 and falls when 0 < a < 1.

Domain and range of the exponential function

Any real number can be an exponent, so the domain is ℝ. A positive base raised to any power is positive, and every positive number is reached, so the range is (0, ∞).

Case 1: a > 1. $a^x \lt 1$ for x < 0, a0 = 1, and $a^x \gt 1$ for x > 0. The values grow quickly as x increases.

Case 2: 0 < a < 1. $a^x \gt 1$ for x < 0, a0 = 1, and $a^x \lt 1$ for x > 0. The values shrink toward 0 as x increases, but never reach it.

Graphs of 2 to the x and one half to the xxy−4−2242468y = 2ˣy = (½)ˣDomain: all real numbers. Both pass through (0, 1).Range: y > 0 (dashed line y = 0 is never reached)
2ˣ (green, a > 1) rises and (½)ˣ (blue, 0 < a < 1) falls; both pass through (0, 1) and approach the x-axis without touching it. Domain ℝ, range (0, ∞).

Comparing bases: $2^x \lt 3^x \lt 4^x$ for all x > 0; $2^0 = 3^0 = 4^0 = 1$; and $2^x \gt 3^x \gt 4^x$ for all x < 0.

Real functions

A function f : A → B is called a real function, if B is a subset of R ( set of all real numbers ). If A and B are subsets of R, then f is called a real function.

Domain and Range of Real Functions

To define a function we have to give its domain, co-domain and the images of elements in its domain either by giving a general formula or by listing them one by one. As the domain and codomain of real functions are subsets of R, therefore, conventionally real functions are described by providing the general formula for finding the images of elements in it. In such cases, the domain of the real function f ( x ) is the set of all those real numbers for which the expression for f ( x ) or the formula for f ( x ) assumes real values only. In other words, the domain of f ( x ) is the set of all those real numbers for which f ( x ) is meaningful.

Let us understand it through an example.

Suppose we have a real function described by the formula, f ( x ) = $\frac{3 x -2}{x^2-1}$ . This function assumes the real values of all x ∈ ℝ except x = ±1 because the denominator of $\frac{3 x -2}{x^2-1}$ becomes zero for x = ±1. Therefore, the domain of f ( x ) will be the set of all real numbers other than – 1 and 1, i.e. Domain ( f ) = R – {- 1,1}

The range of a real function of a real variable is the set of all real values taken by f ( x ) at points in its domain. The following algorithm is used to find the range of a real function f ( x ) –

  1. Put y = f ( x )
  2. Solve the equation y = f ( x ) for x in terms of y. let x = ∅ ( y )
  3. Find the values of y for which the values of x obtained from x = ∅ ( y ) are real in the domain of f.
  4. The set of values obtained in the above step is the range of f.

Solved examples

Example 1

Find the domain and range of f ( x ) given by f ( x ) = $\frac{x-2}{3-x}$

Solution

We have been given the function f ( x ) = $\frac{x-2}{3-x}$ and we need to find its domain and range. Let us find them one by one.

Domain of f

We can see that f is defined for all x satisfying 3 – x ≠ 0. This means that x ≠ 3. Therefore, the domain of the function f ( x ) = $\frac{x-2}{3-x}$ will be Domain ( f ) = R – { 3 }

Range of f

We shall use the method discussed above to find the range of the given function.

Let y = f ( x ). Then, we have

y = $\frac{x-2}{3-x}$

⇒ y ( 3 – x ) = x – 2

⇒ 3 y – x y = x – 2

⇒ x ( y + 1 ) = 3 y + 2

⇒ x = $\frac{3 y+2}{y+1}$ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ( 1 )

We can see from equation ( 1 ) that x assumes real values of all y except y + 1 = 0. This means that y = – 1

Hence, the range of the function f ( x ) = $\frac{x-2}{3-x}$ will be Range ( f ) = R – { – 1 }

Example 2

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

Solution

We have been given the function f ( x ) = $\frac{1}{2-sin 3 x}$ and we need to find its domain and range. Let us find them one by one.

Domain of f

We know that $-1 \le \sin 3x \le 1$ for all $x \in \mathbb{R}$

$\Rightarrow -1 \le -\sin 3x \le 1$

$\Rightarrow 1 \le 2 – \sin 3x \le 3$

The denominator is never 0, so f(x) is defined for every real x.

Hence, the domain of f is ℝ.

Range of f

Taking reciprocals of $1 \le 2 – \sin 3x \le 3$ reverses the inequalities:

$\Rightarrow \frac{1}{3} \le \frac{1}{2 – \sin 3x} \le 1$

Both ends are reached: f = 1 when sin 3x = 1 and f = ⅓ when sin 3x = −1.

Hence, the range of f is $\left[\frac{1}{3}, 1\right]$.

More practice: graphing functional relationships worksheets, addition of functions worksheets and understanding basic concepts of relations and functions worksheets.

Domain, Co-domain and Range FAQs

What is the difference between co-domain and range?

The co-domain is the set of outputs allowed by the definition f : A → B (it is B). The range is the set of outputs that actually occur. The range is inside the co-domain and can be smaller: f(x) = x² from ℝ to ℝ has co-domain ℝ but range [0, ∞).

How do you find the domain of a function?

Start with all real numbers and remove values that break the rule: values that make a denominator 0, make an even root of a negative number, or make a logarithm’s input 0 or negative.

How do you find the range of a function?

Write y = f(x), solve for x in terms of y, and see which y-values give a valid x in the domain. Or read it from the graph: the range is every height the graph reaches.

What are the domain, co-domain and range of a function?

For a function f: A → B, the domain is the set A of inputs, the co-domain is the set B that outputs come from, and the range is the set of outputs f(x) actually produced. Example: f(x) = x² from {1, 2, 3} to {1, …, 10} has range {1, 4, 9}.

What are the domain and range of f(x) = 2ˣ?

Domain: all real numbers. Range: all positive real numbers, (0, ∞). The graph gets close to the x-axis but never touches it.

Practise with worksheets

Link/Reference Us

We spend a lot of time researching and compiling the information on this site. If you find this useful in your research, please use the tool below to properly link to or reference Helping with Math as the source. We appreciate your support!

  • "Domain, Co-Domain and Range of a Function". Helping with Math. Accessed on December 1, 2026. https://helpingwithmath.com/domain-co-domain-and-range-of-a-function/.

  • "Domain, Co-Domain and Range of a Function". Helping with Math, https://helpingwithmath.com/domain-co-domain-and-range-of-a-function/. Accessed 1 December, 2026.

  • Domain, Co-Domain and Range of a Function. Helping with Math. Retrieved from https://helpingwithmath.com/domain-co-domain-and-range-of-a-function/.