Domain and Range Calculator

Every restriction found and solved, denominators, roots, and logs, with the graph to confirm.

Domain and Range Calculator

What Are Domain and Range?

The domain of a function is the set of inputs it accepts; the range is the set of outputs it actually produces. Together they are a function's passport, before calculus can differentiate, integrate, or take limits of f, it has to know where f exists. Most domain questions reduce to three prohibitions inherited from arithmetic:

No dividing by zero. No even roots of negatives. No logarithms of non-positive numbers.

Everything a first course needs flows from enforcing those three rules on the pieces of a formula: collect each restriction, solve it, and intersect the results. The range is generally harder, it asks what the graph's shadow on the y-axis is, which may require knowing the function's minimum, maximum, and asymptotic behavior, and is often best read from a graph or, later, found with derivative tools.

How to Use This Calculator

Enter a formula. The tool inspects the expression tree and lists every symbolic restriction it finds, each denominator that must avoid zero, each square-root argument that must stay non-negative, each log argument that must stay positive, then verifies the picture numerically, scanning [−10, 10] to report the actual defined intervals and the range of outputs over that window. The graph shows the function living exactly on its domain, with gaps where it doesn't exist.

Worked Example

Take f(x) = √(x − 2). The single restriction is x − 2 ≥ 0, so the domain is [2, ∞). For the range: √ produces exactly the non-negative reals as its argument sweeps [0, ∞), so the range is [0, ∞). The graph confirms both, the curve is born at (2, 0) and climbs forever, slowing as it goes.

The second chip is richer: f(x) = 1/(x² − 4) demands x² − 4 ≠ 0, deleting x = 2 and x = −2 and splitting the domain into three intervals: (−∞, −2) ∪ (−2, 2) ∪ (2, ∞). The range has a subtlety worth internalizing: outputs cover (0, ∞) from the outer branches and (−∞, −1/4] from the middle one, the value 0 is never reached (the numerator can't vanish), and neither is anything in (−1/4, 0). Ranges of rational functions can have gaps in unexpected places; the graph is the fastest way to spot them.

The Restriction Checklist

For hand work, run every formula through this list: denominators set each ≠ 0 and exclude the roots; even roots set the inside ≥ 0 and solve the inequality; logarithms inside > 0, strictly; inverse trig arcsin and arccos need arguments in [−1, 1]; tangent and secant exclude odd multiples of π/2. Compound formulas intersect their restrictions: ln(9 − x²) (the third chip) needs 9 − x² > 0, giving the open interval (−3, 3), and √(x)/(x − 5) needs both x ≥ 0 and x ≠ 5, giving [0, 5) ∪ (5, ∞). When restrictions come from an application, time can't be negative, lengths must be positive, the practical domain may be smaller than the algebraic one, and it's the practical one an optimization problem must respect.

Common Mistakes to Avoid

  • Solving √-inequalities with an equals-only mindset. x − 2 ≥ 0 includes the boundary: the domain of √(x − 2) contains 2. But ln(x − 2) excludes it, the difference between ≥ and > is the difference between a closed and open endpoint.
  • Forgetting that restrictions compound. Every piece of the formula gets a vote, and the domain is the intersection of them all. A single overlooked denominator quietly poisons a whole solution.
  • Reporting the range of the formula rather than the function. x² + 3 has range [3, ∞), not ℝ, the output floor at the vertex matters. Ranges come from graphs, vertices, and asymptotes, not from wishful symmetry with the domain.
  • Trusting a numeric window as the whole truth. This tool scans [−10, 10]; a function like √(x − 50) is empty there but perfectly alive beyond it. The symbolic restrictions are global; numeric scans are a local confirmation.

Real-World Applications

Domain analysis is the modeling discipline of "for which inputs does this formula mean anything?" A projectile-height formula applies between launch and landing; a demand curve applies for non-negative prices; the barometric formula applies above ground level. Writing down the domain is how engineers and economists prevent a model from being quoted outside its jurisdiction, most infamous "model failures" are extrapolations beyond the fitted domain.

In software, domain restrictions become input validation and guard clauses: the same three prohibitions (division by zero, negative square roots, non-positive logs) are the exceptions and NaNs of every numerical library, and data scientists sanitize features with exactly this page's checklist before feeding models. Range analysis, meanwhile, is output specification, knowing a sigmoid's range is (0, 1) is what lets it represent probability, and knowing a sensor model's range determines the dynamic range the hardware must capture.

Frequently Asked Questions

How do I write domains in interval notation?

Square brackets include the endpoint, parentheses exclude it, ∪ joins pieces: [2, ∞) for √(x − 2), (−3, 3) for ln(9 − x²), (−∞, −2) ∪ (−2, 2) ∪ (2, ∞) for 1/(x² − 4). Infinity always gets a parenthesis, it isn't a number to include.

Why is finding range harder than finding domain?

Domain is local bookkeeping: each restriction is read directly off the formula. Range requires global understanding, extreme values, asymptotes, gaps, which is genuinely the harder problem (calculus's critical point machinery exists largely to answer it). A reliable elementary route: graph, then read the y-shadow.

What's the domain of a composition f(g(x))?

All x in g's domain whose output g(x) also lands in f's domain, two gates, both enforced. For √(ln x): need x > 0 (for ln) and ln x ≥ 0 (for √), i.e. x ≥ 1. The composite function calculator works through this chaining.

Do odd roots restrict the domain?

No, cube roots (and all odd roots) happily accept negatives: ∛(−8) = −2. Only even roots carry the non-negativity restriction. Watch notation, though: x^(1/3) computed via logarithms in some software refuses negatives even though the mathematical cube root exists.

Can a domain be a single point, or empty?

Both occur: √(x) + √(−x) is defined only at x = 0, and √(−1 − x²) is defined nowhere real, its restriction −1 − x² ≥ 0 has no solutions. Empty domains usually signal a modeling error upstream, which is precisely why checking is worthwhile.

How do piecewise functions affect domain and range?

The domain is the union of the pieces' intervals (watch for deliberate gaps), and the range is the union of each piece's outputs over its own interval. The piecewise grapher draws these and checks the seams for continuity.