Skip to content
  • Open the math solver
  • Ask the AI tutor
  • Find an AP course
  • Create a quiz
  • Open the calculator
  • Graphing Calculator
  • Browse all calculators
  • Read math guides
↑ ↓Enter to open · Esc to close
Solve a problem

Precalculus

How to Find the Domain and Range of a Function

By MathSolver Pro Editorial Team · Published

The domain is every input a function accepts; the range is every output it can produce. Finding the domain means hunting for forbidden inputs, and finding the range means asking which outputs are actually reachable.

Definitions and notation

A function takes each input from a set called the domain and assigns exactly one output. The set of all outputs that actually occur is the range. For f(x)=x2f(x) = x^2, every real number can be squared, so the domain is all real numbers, but squares are never negative, so the range is [0,∞)[0, \infty).

Domains and ranges are usually written in interval notation. A square bracket includes an endpoint and a round bracket excludes it; infinity always gets a round bracket. Separate pieces are joined with the union symbol ∪\cup, so all real numbers except 3 is written (−∞,3)∪(3,∞)(-\infty, 3) \cup (3, \infty). Set-builder notation, such as {x∣x≠3}\{x \mid x \neq 3\}, says the same thing in words.

If a function is given by a formula and nothing else is said, its domain is the implied or natural domain: the largest set of real numbers for which the formula makes sense. A problem can also restrict the domain on purpose, as in a word problem where a length cannot be negative.

It helps to think of a function as a machine. The domain is the list of inputs the machine accepts without jamming, and the range is the list of everything that can come out. Two functions with the same formula but different domains are, strictly speaking, different functions, which is why the domain is part of the definition and not an afterthought.

Finding the domain: the three restrictions

For the functions met in algebra and precalculus, only three things can go wrong with a real input. Check each one and exclude the values that cause it.

  1. Division by zero: a denominator cannot equal zero.
  2. Even roots of negative numbers: the expression under a square root, fourth root and so on must be at least zero. Odd roots, such as cube roots, accept every real number.
  3. Logarithms of non-positive numbers: the argument of a logarithm must be strictly greater than zero.
AB:B≠0,A:A≥0,log⁡bA:A>0\frac{A}{B}: B \neq 0, \qquad \sqrt{A}: A \ge 0, \qquad \log_b A: A > 0

Polynomials such as 3x4−x+73x^4 - x + 7 have none of these features, so their domain is all real numbers, (−∞,∞)(-\infty, \infty). The same is true for exe^x, sin⁡x\sin x, cos⁡x\cos x, ∣x∣|x| and cube roots.

Domain examples

Example 1: f(x)=x−4f(x) = \sqrt{x - 4}

  1. The expression under the square root must be at least zero: x−4≥0x - 4 \ge 0.
  2. So x≥4x \ge 4, and the domain is [4,∞)[4, \infty).

Example 2: g(x)=x+1x2−9g(x) = \dfrac{x + 1}{x^2 - 9}

  1. Set the denominator equal to zero to find the forbidden values: x2−9=0x^2 - 9 = 0, so x=3x = 3 or x=−3x = -3.
  2. Domain: (−∞,−3)∪(−3,3)∪(3,∞)(-\infty, -3) \cup (-3, 3) \cup (3, \infty).

Example 3: h(x)=ln⁡(5−2x)h(x) = \ln(5 - 2x)

  1. The argument must be positive: 5−2x>05 - 2x > 0.
  2. Solve: −2x>−5-2x > -5, and dividing by −2-2 reverses the sign, so x<52x < \frac{5}{2}.
  3. Domain: (−∞,52)\left(-\infty, \frac{5}{2}\right).

Example 4: k(x)=x+2x−1k(x) = \dfrac{\sqrt{x + 2}}{x - 1}

  1. Square root condition: x+2≥0x + 2 \ge 0, so x≥−2x \ge -2.
  2. Denominator condition: x≠1x \neq 1.
  3. Both must hold at once: [−2,1)∪(1,∞)[-2, 1) \cup (1, \infty).

Example 3 used the rule for dividing an inequality by a negative number. The guide on solving inequalities explains it, together with sign charts for conditions such as x−1x+2≥0\frac{x - 1}{x + 2} \ge 0.

When a function combines several features, list every condition separately, solve each one, and then intersect the results. Most errors come from forgetting one condition, not from solving them.

Finding the range algebraically

The range is often harder, because it asks which outputs are possible rather than which inputs are allowed. Three techniques cover most cases.

First, use known ranges of basic functions. Square roots and absolute values are never negative, exe^x is always positive, and sin⁡x\sin x and cos⁡x\cos x stay between −1-1 and 11. Transformations then shift or stretch these ranges. For f(x)=2x−4+1f(x) = 2\sqrt{x - 4} + 1, the root gives [0,∞)[0, \infty), doubling keeps it [0,∞)[0, \infty), and adding 1 gives [1,∞)[1, \infty).

Second, for quadratics, complete the square to find the vertex. Since a square is never negative, the vertex height is the minimum or maximum.

Example 5: range of f(x)=x2−4x+1f(x) = x^2 - 4x + 1

  1. Complete the square: f(x)=(x−2)2−3f(x) = (x - 2)^2 - 3.
  2. Because (x−2)2≥0(x - 2)^2 \ge 0, the smallest output is −3-3, reached at x=2x = 2.
  3. Range: [−3,∞)[-3, \infty).

Third, solve y=f(x)y = f(x) for xx and find which yy values give a valid xx in the domain.

Example 6: range of f(x)=2x+1x−3f(x) = \dfrac{2x + 1}{x - 3}

  1. Write y=2x+1x−3y = \frac{2x + 1}{x - 3} and multiply up: y(x−3)=2x+1y(x - 3) = 2x + 1.
  2. Collect xx terms: yx−2x=3y+1yx - 2x = 3y + 1, so x(y−2)=3y+1x(y - 2) = 3y + 1 and x=3y+1y−2x = \frac{3y + 1}{y - 2}.
  3. This works for every yy except y=2y = 2. Check directly: 2x+1x−3=2\frac{2x + 1}{x - 3} = 2 would need 2x+1=2x−62x + 1 = 2x - 6, which is impossible.
  4. Range: (−∞,2)∪(2,∞)(-\infty, 2) \cup (2, \infty). The line y=2y = 2 is the horizontal asymptote.

The same approach gives the range of 1x2+1\frac{1}{x^2 + 1}. The denominator is at least 1, so the output is at most 1, and it is always positive but gets as close to 0 as you like. The range is (0,1](0, 1].

Reading domain and range from a graph

On a graph, the domain is the shadow the curve casts on the x-axis, and the range is its shadow on the y-axis. Scan from left to right to find the domain and from bottom to top to find the range. Closed dots mark included endpoints, open dots mark excluded points, and arrows mean the graph continues indefinitely.

Vertical asymptotes mark values missing from the domain, and horizontal asymptotes often mark values missing from the range, as in Example 6. Be careful, though: a graph can cross a horizontal asymptote, so an asymptote alone does not prove a value is excluded. The graphing calculator is a good way to see these features before confirming them algebraically.

Piecewise functions and real contexts

For a piecewise function, the domain is the union of the intervals on which each piece is defined, and the range is the union of the outputs from each piece. Suppose f(x)=x+2f(x) = x + 2 for x<0x < 0 and f(x)=3f(x) = 3 for x≥0x \ge 0. The domain is all real numbers. The first piece produces every value below 2, and the second produces only 3, so the range is (−∞,2)∪{3}(-\infty, 2) \cup \{3\}.

In applications, the context restricts the domain further. The area of a square, A=s2A = s^2, accepts any real ss as a formula, but a side length must be positive, so the practical domain is s>0s > 0 and the range is A>0A > 0. The height of a thrown ball is meaningful only from launch until it lands, so its domain is a closed time interval even though the quadratic formula for height is defined everywhere.

Domain and range in later topics

These ideas return constantly. A function has an inverse on a domain where it is one-to-one, and the inverse swaps domain and range, as explained in inverse functions. Composition f(g(x))f(g(x)) needs each output of gg to lie in the domain of ff; see function composition. Logarithms and exponentials, covered in logarithms, are a classic pair with swapped domains and ranges.

Common mistakes

  • Simplifying before finding the domain. x2−9x−3\frac{x^2 - 9}{x - 3} simplifies to x+3x + 3, but x=3x = 3 is still excluded from the original function.
  • Using >> instead of ≥\ge for square roots, which wrongly removes the endpoint where the root equals zero.
  • Using ≥\ge instead of >> for logarithms, which wrongly includes a zero argument.
  • Assuming the range is all real numbers because the domain is.
  • Writing a square bracket next to infinity.

To check your answers, try the domain and range calculator, which lists each restriction it found and the resulting intervals.

Frequently asked questions

Which inputs does a polynomial accept?

All real numbers, (−∞,∞)(-\infty, \infty). Polynomials involve only addition, subtraction and multiplication, so no input causes division by zero, an even root of a negative number or an undefined logarithm.

Is the range always harder to find than the domain?

Usually, because the range depends on the whole shape of the function. Completing the square, solving for xx in terms of yy, and using known ranges of basic functions handle most cases; a graph is a helpful check.

Does a horizontal asymptote mean a value is not in the range?

Not always. The asymptote describes behaviour far to the left or right, and a graph may cross it at some finite xx. Solve f(x)=cf(x) = c to decide whether the asymptote value cc is actually reached.

How do I write all real numbers except two values?

Use three intervals joined by unions. For example, all reals except −3-3 and 33 is (−∞,−3)∪(−3,3)∪(3,∞)(-\infty, -3) \cup (-3, 3) \cup (3, \infty).

MathSolver Pro Editorial Team

Math content and review

Our editorial team writes every guide to explain the reasoning behind each method, not just the answer. Each worked example is checked against the site's own solver engines and automated tests before it is published, and articles are revised whenever a method or an exam format changes.