Domain and Range

Every machine in the world comes with limits. A vending machine happily swallows coins and small notes — but try to feed it a €1,000,000 note and it will spit it straight back out. A jet engine works beautifully at 10,000 metres, but climb too high and the air gets too thin for it to breathe. Your calculator is a machine too: ask it for \sqrt{-9} and it doesn't give you a number — it gives you an error. Machines are picky about what goes in, and they are also constrained in what can come out: no vending machine ever dispenses a helicopter, no matter what you feed it.

A function is a machine, so the same two questions apply. Once we can write a rule with function notation, we should immediately ask: which inputs will this machine accept, and which outputs can it possibly produce? Those two collections are so important they have names.

Picture the machine: the domain is the pile of inputs that fit through the slot, and the range is the pile of outputs that can land in the tray. Notice the word can in the range — the range is not "whatever you'd like to come out" but "whatever is genuinely possible", and finding it takes real detective work, as you'll see below.

Why some inputs are not allowed

For many functions, every real number works — feed in anything and out comes an answer, so the domain is "all real numbers". f(x) = 2x + 1 is like this: doubling and adding one never breaks, whatever x is. But some rules contain hidden trapdoors — inputs for which the arithmetic simply refuses to work — and those inputs are quietly thrown out of the domain. In the world of real numbers there are two classic troublemakers:

When a function is handed to you as a bare formula with no domain attached, the convention is to take the natural domain: every real input for which the formula makes sense. So "find the domain" really means "hunt for the trapdoors and fence them off".

Pick a rule below and slide the input. When the input is outside the domain, the machine flashes a warning instead of an output — the vending machine rejecting the note.

Worked examples: finding a natural domain

Example 1 — a shifted division. Find the domain of f(x) = \dfrac{1}{x - 3}. The only danger is the denominator hitting zero, so ask: when is x - 3 = 0? Exactly when x = 3. Every other input is perfectly fine — f(4) = 1, f(2.9) = -10, f(-100) = -\tfrac{1}{103} — but at x = 3 the machine jams. So the domain is

\text{all real } x \text{ with } x \ne 3.

Example 2 — a shifted root. Find the domain of g(x) = \sqrt{x - 2}. The danger now is the thing under the root going negative, so demand x - 2 \ge 0, i.e. x \ge 2. Check the boundary: at x = 2 we get \sqrt{0} = 0, which is fine — zero under a root is allowed, it's only negatives that break. So the domain is

x \ge 2.

Example 3 — two trapdoors at once. Find the domain of h(x) = \dfrac{\sqrt{x}}{x - 4}. Now both troublemakers are present, and each writes its own rule:

An input must satisfy every rule at once to get through the machine, so the domain is the overlap:

x \ge 0 \ \text{ and } \ x \ne 4.

That's the whole method, whatever the formula: list each thing that could break, turn each into a condition on x, and keep only the inputs that pass them all.

Reading them off a graph

A graph shows domain and range at a glance, if you know where to look. Imagine the sun directly overhead: the domain is the shadow the curve casts down onto the x-axis — the left-to-right spread of inputs that actually get used. Now imagine the sun shining from the side: the range is the shadow cast sideways onto the f(x)-axis — the up-and-down spread of heights the curve actually reaches.

Take the parabola f(x) = x^2. Its downward shadow covers the entire x-axis — every input is allowed, so the domain is all real numbers. But its sideways shadow only covers the axis from 0 upward: the curve touches height 0 (at the vertex) and climbs forever, but it never dips below the axis. So the range is f(x) \ge 0 — and notice the asymmetry: an "anything goes" domain, yet a restricted range. The two are separate questions with separate answers.

Try the same two-shadows reading on any graph you meet. The graph of \sqrt{x} starts at the origin and sweeps up-right: downward shadow x \ge 0 (the domain), sideways shadow f(x) \ge 0 (the range). A gap, a hole or a missing stretch in either shadow is a value excluded from that set.

Hunting a range: argue it, don't guess it

Domains are found by fencing off trapdoors; ranges take a different kind of thinking. To pin down a range you must answer two questions about a candidate output y: can the function produce it, and can you prove the ones it can't? Watch the method on our two stars.

The range of x^2 is exactly [\,0, \infty). Two claims, each needing its own argument:

The range of \dfrac{1}{x} is every real number except 0. Here the surprise is on the output side:

You can see the missing output in the picture: the two branches hug the x-axis ever tighter, but neither one ever touches it. The sideways shadow covers everything except height 0.

Curiously, \tfrac{1}{x} is missing the same number twice over: 0 is its one forbidden input and its one impossible output. That's a coincidence of this function, not a rule — x^2 forbids no inputs at all yet misses infinitely many outputs.

Writing it down: interval notation

Sentences like "every real number from 2 upward" get clumsy fast, so mathematicians compress a stretch of allowed values into interval notation. A square bracket [\;] means the endpoint is included; a round bracket (\;) means it is excluded. The symbol \infty ("infinity") always gets a round bracket, because infinity is a direction, not a number you can reach and include.

x \ge 0 \;\Longleftrightarrow\; [\,0,\ \infty) -2 < x \le 5 \;\Longleftrightarrow\; (-2,\ 5\,]

A set with a piece missing from the middle is written as two intervals glued with the union symbol \cup ("or"). Our worked examples become:

\text{domain of } \tfrac{1}{x-3}: \ (-\infty,\ 3) \cup (3,\ \infty) \text{domain of } \sqrt{x-2}: \ [\,2,\ \infty) \text{range of } x^2: \ [\,0,\ \infty) \qquad \text{range of } \tfrac{1}{x}: \ (-\infty,\ 0) \cup (0,\ \infty)

Read the brackets like a bouncer's guest list: [\,2, \infty) lets 2 itself into the club; (3, \infty) turns 3 away at the door but admits 3.0001. Khan Academy introduces domain and range here:

Three traps catch nearly everyone the first time:

Formulas are cheerfully ignorant of the real world. Suppose a stall sells drinks for €2 each, so the takings are T(n) = 2n for n drinks sold. As pure algebra, T(-3) = -6 and T(2.5) = 5 compute without complaint — but you cannot sell minus three drinks, or two and a half. The situation imposes a domain (n = 0, 1, 2, \ldots) that the formula knows nothing about.

This happens constantly. A function \text{age}(p) for a person's age never outputs a negative; a car's \text{speed}(t) only accepts times while the journey is actually happening; the height of a thrown ball, h(t) = 20t - 5t^2, is only meaningful between launch and landing — plug in t = 10 and the algebra will solemnly report the ball is 300 metres underground. Programmers have a phrase for trusting a machine outside its domain: garbage in, garbage out. Whole industries exist to check inputs before feeding them to formulas — that's what a form on a website is doing when it refuses your birthday in the year 3000.

So a full answer to "what is the domain?" often has two layers: what the algebra allows, and what the situation allows. The stated domain is the smaller of the two.