Domain and Range Calculator
The tool below finds the domain (all valid inputs) and range (all possible outputs) of a function. Enter the function and the calculator identifies every restriction — divisions by zero, even roots of negatives, logarithms of non-positive numbers — and reports both sets in interval notation with the work shown.
Type a function expression (no equals sign). Type naturally or click ⌨ in the box to use the math keyboard.
Examples: x^2 + 3, 1/(x-2), \sqrt{x-1}.
The domain of a function is the set of every input the function accepts; the range is the set of every output it produces. For \(f(x) = \dfrac{1}{x-2}\), the domain is every real number except \(x = 2\) (where the denominator is zero), and the range is every real number except \(y = 0\). Both sets are usually written in interval notation.
Worked Examples
Three examples worked by hand — the same logic the calculator uses, just spelled out so you can follow it on paper.
Example 1: Polynomial — find the domain and range of \(f(x) = x^2 + 3\)
Polynomials have no restrictions on the input. Any real number squared, plus 3, gives a real number. So the domain is all real numbers:
\[\text{Domain: } (-\infty, \infty)\]
For the range, note that \(x^2 \geq 0\) for every \(x\), so \(x^2 + 3 \geq 3\). The smallest value is 3 (at \(x = 0\)), and the function grows without bound:
\[\text{Range: } [3, \infty)\]
The square bracket on the 3 indicates that 3 is included; the parenthesis on \(\infty\) is always open.
Example 2: Rational function — find the domain and range of \(f(x) = \dfrac{1}{x-2}\)
For the domain, the denominator can't be zero. Set \(x - 2 = 0\) to find the forbidden value: \(x = 2\). Everything else is allowed:
\[\text{Domain: } (-\infty, 2) \cup (2, \infty)\]
For the range, ask which values \(y\) the function actually outputs. Solving \(y = \dfrac{1}{x-2}\) for \(x\) gives \(x = \dfrac{1}{y} + 2\), which works for every \(y \neq 0\). So \(y = 0\) is the horizontal asymptote — the function approaches it but never reaches it:
\[\text{Range: } (-\infty, 0) \cup (0, \infty)\]
Example 3: Square root — find the domain and range of \(f(x) = \sqrt{x-1}\)
For the domain, the expression under an even root must be \(\geq 0\):
\[x - 1 \geq 0 \quad \Rightarrow \quad x \geq 1\] \[\text{Domain: } [1, \infty)\]
For the range, the principal square root produces non-negative values, and as \(x\) increases, so does \(\sqrt{x-1}\). At \(x = 1\), the output is 0; as \(x \to \infty\), the output grows without bound:
\[\text{Range: } [0, \infty)\]
Common Restrictions on the Domain
A quick reference for what to watch for:
| Operation | Restriction |
|---|---|
| Division: \(\dfrac{1}{g(x)}\) | \(g(x) \neq 0\) |
| Even root: \(\sqrt{g(x)}\), \(\sqrt[4]{g(x)}\), … | \(g(x) \geq 0\) |
| Logarithm: \(\ln(g(x))\), \(\log(g(x))\) | \(g(x) > 0\) |
| Tangent: \(\tan(g(x))\) | \(g(x) \neq \dfrac{\pi}{2} + k\pi\) for integer \(k\) |
| Secant, cosecant, cotangent | wherever the underlying cos or sin is zero |
If none of these appear, the domain is usually all real numbers.
Tips for Using the Calculator
- Enter a function expression, not an equation — there's no equals sign
- For powers, use
^:x^2means \(x^2\) - For fractions, use
\frac{a}{b}or justa/b - For square roots, use
\sqrt{x} - For natural log, use
\ln(x); for log base 10, use\log(x) - The output appears in interval notation —
(for an open end,[for a closed end,\cupto join pieces
If you also want to graph the function and see the domain and range visually, try the Equation Grapher. For a deeper conceptual walk-through, see the lesson on Domain and Range.
Frequently Asked Questions
What's the difference between domain and range?
The domain is the set of inputs the function accepts. The range is the set of outputs it can produce. For \(f(x) = x^2\), the domain is every real number (you can square anything), but the range is \([0, \infty)\) because a real number squared is never negative.
How do I write the answer in interval notation?
Use parentheses for ends that are not included and square brackets for ends that are. Always use parentheses around \(\infty\) and \(-\infty\). Use \(\cup\) to join pieces. For example, "all real numbers except 2" is \((-\infty, 2) \cup (2, \infty)\); "\(x \geq 1\)" is \([1, \infty)\).
What restricts the domain of a function?
The three most common restrictions are division by zero (denominators can't equal zero), even roots of negatives (you can't take the square root of \(-4\) in the real numbers), and logarithms of non-positives (you can't take \(\ln(0)\) or \(\ln(-1)\)). Tangent, secant, cosecant, and cotangent also have their own undefined points. If none of these appear, the domain is usually all real numbers.
Why does a square root restrict the domain?
The square root of a negative number isn't a real number. \(\sqrt{-4}\) doesn't exist in the real number system (it lives in the complex numbers as \(2i\)). So whenever a function contains \(\sqrt{g(x)}\), you have to keep \(g(x) \geq 0\) to stay in the reals. Cube roots and other odd roots have no such restriction — \(\sqrt[3]{-8} = -2\) is perfectly fine.
Is finding the range harder than finding the domain?
Usually yes. The domain comes from looking at the expression and listing forbidden inputs — that's mostly mechanical. The range requires understanding the behavior of the function: where does it reach its highest and lowest values, are there horizontal asymptotes, is it bounded above or below? For complicated functions you might need calculus (to find critical points), or you might find it easier to sketch the graph and read the range off.