How to Find the Domain and Range of a Function
Every function comes with two questions: which inputs is it allowed to take, and which outputs can it produce? The domain answers the first — it is the set of all x-values a function can accept. The range answers the second — the set of all y-values it can produce. This calculator takes a function f(x) and works out both, showing the reasoning step by step. Three things can break a domain: division by zero, an even root of a negative number, and a logarithm of a non-positive number. Check for those three first, and most domain problems solve themselves.
The Definitions, Formally
Formally, the domain of f is the set {x ∈ ℝ | f(x) is defined}: every real x for which the rule produces an output. The range is {y ∈ ℝ | y = f(x) for some x in the domain} — the outputs actually hit, which can be smaller than you might first assume. This tool reports its answers in words and in interval notation: parentheses exclude an endpoint, brackets include it, and ∪ joins separate pieces, so “all real numbers except x = 2” is written (−∞, 2) ∪ (2, ∞). In set-builder notation that same answer reads {x | x ≠ 2}.
Interval Notation Basics
- Parentheses ( ) exclude an endpoint: (2, 5) means 2 < x < 5.
- Brackets [ ] include an endpoint: [0, ∞) means x ≥ 0.
- Infinity always gets a parenthesis: (−∞, ∞) is the whole real line.
How to Use the Calculator
- Type your function into the single Function f(x) box, using x as the variable: write division as 1/(x-2), a square root as sqrt(x), and logs as ln(x) or log(x).
- Press Find Domain & Range. The Domain and Range lines appear in the results panel.
- Read the Reasoning steps underneath — they name the restriction that fired, such as “denominator must not equal zero”, so you can see why values were excluded.
- For unusual functions, confirm the range with a sketch, since the reasoning is symbolic for common forms.
Worked Example 1: f(x) = 1/(x − 2)
- Spot the restriction: the function divides by (x − 2), and division by zero is undefined.
- Exclude the bad value: set x − 2 = 0, giving x = 2. That single value is banned; every other real x works.
- Domain: (−∞, 2) ∪ (2, ∞).
- Range: the output is a fraction with numerator 1, so it can never equal 0 — no input makes 1 divided by something equal zero. As x approaches 2 the outputs shoot off to ±∞, and every other real value is hit exactly once.
- Range, concluded: (−∞, 0) ∪ (0, ∞). Notice the symmetry: the excluded input and the excluded output match.
Worked Example 2: f(x) = x² − 4x + 7
- Domain first: this is a polynomial — no division, no roots, no logarithms — so nothing restricts x. Domain: (−∞, ∞).
- Complete the square to find the vertex: x² − 4x + 7 = (x − 2)² + 3.
- Read the minimum: a square is always ≥ 0, so (x − 2)² + 3 ≥ 3, with equality at x = 2. Check: f(2) = 4 − 8 + 7 = 3. ✓
- Range: the parabola opens upward from its vertex (2, 3), so the range is [3, ∞). Spot-check the symmetry: f(0) = 7 and f(4) = 16 − 16 + 7 = 7, equal heights either side of x = 2. ✓
Range Strategies
For a parabola, complete the square to find the vertex — the range starts or ends there. For 1/x style rational functions, the range is everything except the horizontal asymptote value. When in doubt, sketch the graph: the range is simply how far the curve stretches vertically.
When Domain and Range Matter Outside Class
A programmer validating inputs for a pricing model needs to know exactly which values keep a formula defined, so the code can reject the rest instead of crashing. A physics student using t = √(2h/g) for a falling object needs h ≥ 0 before the formula means anything. Anyone plotting a function — in a spreadsheet, a graphing app, or a report — has to choose an x-window, and that choice is the domain. And inverse functions swap domain and range, so this analysis is the entry ticket to that whole topic.
Common Mistakes
- Mixing up strict and non-strict inequalities. A radicand may equal zero, so square roots give ≥ and a bracket: [3, ∞). A logarithm's argument may not, so logs give > and a parenthesis. Swapping them flips whether the endpoint is included.
- Forgetting the range has exclusions too. Students carefully ban x = 2 from 1/(x − 2) and then state the range as “all real numbers”, missing that y = 0 is never produced.
- Giving every parabola the range (−∞, ∞). Only lines do that. A quadratic stops at its vertex value — find the vertex before claiming anything about the outputs.
Working with equations? Try our linear equation solver or the derivative calculator to locate maxima and minima.