Determining Domain and Range Using the Graph

A function's graph is a direct visual record of its domain and range. The domain is the shadow of the graph on the x -axis, and the range is the shadow on the y -axis. This section develops that idea through precise procedures and worked examples.

Quick Reference

To find Draw a line Interpret
Domain Vertical lines sweeping all x Domain = x -values where vertical lines hit the graph
Range Horizontal lines sweeping all y Range = y -values where horizontal lines hit the graph

Finding Domain and Range from a Graph

A diagram showing how to determine the domain (projection to x-axis) and range (projection to y-axis) from a function's graph.
The domain is the projection of the graph onto the x -axis; the range is its projection onto the y -axis.
  • To find the domain: for each x -value, draw a vertical line. If it intersects the graph, that x is in the domain. The domain is the set of all x -values that produce an intersection.
  • To find the range: for each y -value, draw a horizontal line. If it intersects the graph, that y is in the range. The range is the set of all y -values that produce an intersection.
Example 1.

The function g is graphed below. Find its domain and range.

A step-like graph of a function g(x) with a hole at x=1.
Graph of y = g ( x ) .
Solution

A vertical line intersects the graph of g ( x ) for every x except x = 1 (there is a hole at x = 1 ). So x = 1 is not in the domain.

Horizontal lines intersect the graph only at y = 1 and y = 2 .

Therefore:

Dom ( g ) = { x x 1 } = { 1 } = ( , 1 ) ( 1 , ) , Rng ( g ) = { 1 , 2 } .
Example 2.

The function ϕ is graphed below. Determine the domain and range of ϕ .

A graph of a piecewise function φ(x) consisting of a horizontal ray for negative x and a rising curve for non-negative x.
Graph of y = ϕ ( x ) .
Solution

A vertical line through any x always hits either the left piece or the right piece of the graph. Therefore, every real number is in the domain:

Dom ( ϕ ) = .

Horizontal lines through y 0 all intersect the right piece, and the horizontal line y = 1 intersects the left piece. No horizontal line through y < 0 and y 1 hits the graph. Therefore:

Rng ( ϕ ) = [ 0 , ) { 1 } .
Example 3.

Find the range of f : [ 1 , 2 ] where f ( x ) = x 2 3 .

Solution

We sketch the graph by building a table of values, making sure to include the endpoints x = 1 and x = 2 :

x 1 0.5 0 0.5 1 1.5 2
f ( x ) 2 2.75 3 2.75 2 0.75 1
Graph of y = x² - 3 on the interval [-1, 2].
Graph of y = x 2 3 on [ 1 , 2 ] .

The function reaches its minimum value of 3 at x = 0 and its maximum value of 1 at x = 2 . From the graph:

Rng ( f ) = [ 3 , 1 ] .

Exercises

Exercise 1.

The graph of a function f is shown. Find Dom ( f ) and Rng ( f ) .

TikZ figure
Answer

Dom ( f ) = [ 3 , 2 ] and Rng ( f ) = [ 1 , 3 ] .

Solution

The domain — sweep vertical lines. Take a vertical line and slide it from far left to far right.

  • For x < 3 it misses the curve completely, so those x are not in the domain.
  • At x = 3 it meets the curve at the solid endpoint ( 3 , 3 ) , so 3 is in the domain.
  • For every x between 3 and 2 it cuts the curve once.
  • At x = 2 it meets the solid endpoint ( 2 , 3 ) , so 2 is in the domain.
  • For x > 2 it misses the curve.

Hence the shadow of the graph on the x -axis is the segment from 3 to 2 , endpoints included:

Dom ( f ) = [ 3 , 2 ] .

The range — sweep horizontal lines. Now slide a horizontal line from bottom to top.

  • Below y = 1 the line misses the curve.
  • At y = 1 it touches the lowest point of the curve, so 1 is in the range.
  • Between y = 1 and y = 3 every horizontal line cuts the curve (in fact twice, once on each side of the dip, but once is enough).
  • At y = 3 it passes through both endpoints ( 3 , 3 ) and ( 2 , 3 ) .
  • Above y = 3 it misses the curve.

Hence

Rng ( f ) = [ 1 , 3 ] .

The two shadows, drawn.

TikZ figure

A caution. A horizontal line meeting the curve twice does no harm here — that only means two inputs share an output. It is vertical lines meeting a curve twice that would stop it from being a graph of a function.

Exercise 2.

The graph of a function g is shown; the hollow dot marks a point that is missing from the graph. Find Dom ( g ) and Rng ( g ) .

TikZ figure
Answer

Dom ( g ) = [ 2 , 1 ) ( 1 , 3 ] and Rng ( g ) = [ 1 , 2 ) ( 2 , 4 ] .

Solution

The domain. Sweeping a vertical line from left to right:

  • for x < 2 it misses the graph;
  • at x = 2 it meets the solid endpoint ( 2 , 1 ) , so 2 is in the domain;
  • for 2 < x < 1 it meets the graph once;
  • at x = 1 it passes exactly through the hollow dot. A hollow dot marks a point that has been removed, so the line meets nothing. Therefore 1 is not in the domain;
  • for 1 < x < 3 it meets the graph once;
  • at x = 3 it meets the solid endpoint ( 3 , 4 ) , so 3 is in the domain;
  • for x > 3 it misses the graph.

Hence

Dom ( g ) = [ 2 , 1 ) ( 1 , 3 ] .

The range. Sweeping a horizontal line from bottom to top:

  • below y = 1 : no intersection;
  • at y = 1 : it meets the solid endpoint ( 2 , 1 ) , so 1 is in the range;
  • between 1 and 2 : one intersection each time;
  • at y = 2 : the only point of the line at that height would be the removed point ( 1 , 2 ) , so there is no intersection and 2 is not in the range;
  • between 2 and 4 : one intersection each time;
  • at y = 4 : it meets the solid endpoint ( 3 , 4 ) , so 4 is in the range;
  • above y = 4 : no intersection.

Hence

Rng ( g ) = [ 1 , 2 ) ( 2 , 4 ] .

Why the hole affects both answers here. The missing point removes one input and the one output that only that input produced. Compare the first exercise, where every output was produced by two different inputs; there, deleting a single point would have left the range unchanged.

Notation check. Square brackets mark endpoints that belong to the set, round brackets those that do not. So [ 2 , 1 ) contains 2 but not 1 — exactly matching the solid dot at x = 2 and the hollow dot at x = 1 .

Exercise 3.

The graph of a function h is shown; the arrow means the curve continues indefinitely in that direction. Find Dom ( h ) and Rng ( h ) .

TikZ figure
Answer

Dom ( h ) = [ 2 , ) and Rng ( h ) = [ 0 , ) .

Solution

The domain. A vertical line placed to the left of 2 misses the curve, so those numbers are excluded. At x = 2 the line meets the solid endpoint ( 2 , 0 ) , so 2 is included. For every x to the right of 2 the line meets the curve, and the arrow tells us this continues without end. Hence the shadow on the x -axis is a ray:

Dom ( h ) = [ 2 , ) .

The range. No part of the curve lies below the x -axis, so horizontal lines with y < 0 miss it entirely. The line y = 0 meets the endpoint ( 2 , 0 ) , so 0 is in the range. For each height above 0 , the rising curve eventually reaches that height, because the arrow says it keeps climbing without stopping. Hence

Rng ( h ) = [ 0 , ) .

On reading arrows. An arrow means "and so on forever in this direction". Without it, the picture would only guarantee what is drawn, and the honest answers would be Dom ( h ) = [ 2 , 4.5 ] and Rng ( h ) = [ 0 , 2.54 ] . Always check whether a graph ends at a dot or at an arrow; the two say very different things.

A concrete function of this shape. The rule h ( x ) = x + 2 produces exactly this picture: its domain requires x + 2 0 , that is x 2 , and its outputs are all the nonnegative numbers. The graph and the algebra agree.

Exercise 4.

The graph of a function F consists of the two separate arcs shown. Find Dom ( F ) and Rng ( F ) .

TikZ figure
Answer

Dom ( F ) = [ 3 , 1 ] [ 1 , 3 ] and Rng ( F ) = [ 2 , 1 ] [ 1 , 2 ] .

Solution

The domain. Sweep a vertical line across the picture and record where it hits something.

  • x < 3 : misses.
  • 3 x 1 : hits the left arc (once).
  • 1 < x < 1 : passes through the gap between the arcs and hits nothing.
  • 1 x 3 : hits the right arc.
  • x > 3 : misses.

All four endpoints are solid dots, so all four are included. The shadow on the x -axis is therefore two segments:

Dom ( F ) = [ 3 , 1 ] [ 1 , 3 ] .

The range. Sweep a horizontal line from bottom to top.

  • y < 2 : misses.
  • 2 y 1 : hits the lower arc, whose lowest point is ( 2 , 2 ) and whose highest points are the endpoints at height 1 .
  • 1 < y < 1 : misses both arcs — the lower arc lies entirely at heights from 2 to 1 , and the upper arc entirely at heights from 1 to 2 .
  • 1 y 2 : hits the upper arc, whose top is ( 2 , 2 ) .
  • y > 2 : misses.

Hence

Rng ( F ) = [ 2 , 1 ] [ 1 , 2 ] .

Two independent gaps. The gap in the domain, from 1 to 1 , and the gap in the range, also from 1 to 1 , happen to occupy the same numbers here, but that is a coincidence of this picture. The domain gap comes from a stretch of the x -axis with nothing above it; the range gap from a stretch of the y -axis with nothing beside it. Always read each one off its own axis.

Exercise 5.

The graph of a function p is the segment shown, with a solid dot at the left end and a hollow dot at the right end. Find Dom ( p ) and Rng ( p ) .

TikZ figure
Answer

Dom ( p ) = [ 2 , 3 ) and Rng ( p ) = ( 2 , 3 ] .

Solution

The domain. Vertical lines hit the segment for every x from 2 up to but not including 3 .

  • At x = 2 the line meets the solid dot, so 2 is in the domain.
  • At x = 3 the only candidate point is the hollow dot, which is not part of the graph, so 3 is not in the domain.
Dom ( p ) = [ 2 , 3 ) .

The range. Now look at heights. As x runs from 2 toward 3 , the segment falls from height 3 down toward height 2 .

  • The height 3 is attained, at the solid dot ( 2 , 3 ) , so 3 is in the range.
  • The height 2 would be attained only at the hollow dot, which is missing, so 2 is not in the range.
  • Every height strictly between 2 and 3 occurs somewhere along the segment.
Rng ( p ) = ( 2 , 3 ] .

The point of this exercise. The domain is closed at its left end and open at its right; the range is open at its bottom and closed at its top. The brackets did not simply carry across. This happens because the segment falls as we move right, so the left endpoint of the domain corresponds to the top of the range.

A check with numbers. The segment lies on the line through ( 2 , 3 ) and ( 3 , 2 ) , whose slope is

m = 2 3 3 ( 2 ) = 5 5 = 1 ,

so its equation is y = 3 ( x + 2 ) = 1 x . Then p ( 2 ) = 1 ( 2 ) = 3 ✔, and p ( x ) = 2 would need x = 3 , which is excluded ✔. The height 0 occurs at x = 1 , which is in the domain ✔.

Exercise 6.

Let f : [ 2 , 3 ] be given by f ( x ) = 2 x + 1 . Sketch the graph and use it to find the range.

Answer

Rng ( f ) = [ 3 , 7 ]

Solution

Step 1: a table of values, including both endpoints.

f ( 2 ) = 2 ( 2 ) + 1 = 4 + 1 = 3 , f ( 0 ) = 1 , f ( 1 ) = 3 , f ( 3 ) = 2 ( 3 ) + 1 = 7.
x 2 0 1 3
y 3 1 3 7

Step 2: plot. The four points lie on one straight line, and the domain is the closed interval [ 2 , 3 ] , so the graph is the segment joining ( 2 , 3 ) to ( 3 , 7 ) , both endpoints included.

TikZ figure

Step 3: project onto the y -axis. The lowest point of the segment is ( 2 , 3 ) and the highest is ( 3 , 7 ) ; the segment climbs steadily from one to the other with no breaks, so every height in between occurs. The thick mark on the y -axis above shows the shadow. Hence

Rng ( f ) = [ 3 , 7 ] .

Check by algebra. Start from the domain condition and build up the formula:

2 x 3.

Multiply throughout by 2 (a positive number, so the inequalities keep their direction):

4 2 x 6.

Add 1 throughout:

3 2 x + 1 7 ,

that is 3 f ( x ) 7 . The graph and the algebra agree.

Exercise 7.

Let f : [ 1 , 3 ] be given by f ( x ) = 4 x 2 . Sketch the graph and use it to find the range.

Answer

Rng ( f ) = [ 5 , 4 ]

Solution

Step 1: a table, taking care to include both endpoints and the point x = 0 .

f ( 1 ) = 4 1 = 3 , f ( 0 ) = 4 0 = 4 , f ( 1 ) = 4 1 = 3 , f ( 2 ) = 4 4 = 0 , f ( 3 ) = 4 9 = 5.
x 1 0 1 2 3
y 3 4 3 0 5

Step 2: plot and join smoothly.

TikZ figure

Step 3: project onto the y -axis. Reading the picture, the highest point of the graph is ( 0 , 4 ) and the lowest is the right-hand endpoint ( 3 , 5 ) . The curve moves from one height to the other without any break, so every height between 5 and 4 is attained. Hence

Rng ( f ) = [ 5 , 4 ] .

A warning about endpoints. It is tempting to compute only f ( 1 ) = 3 and f ( 3 ) = 5 and to declare the range [ 5 , 3 ] . That is wrong: the largest value occurs inside the interval, at x = 0 , not at an endpoint. Always plot enough points to see the turning of the curve.

Check. Is 4 really the largest possible output? For any x we have x 2 0 , so x 2 0 and hence 4 x 2 4 , with equality exactly when x = 0 — which does lie in the domain [ 1 , 3 ] . ✔   And 5 is attained at x = 3 . ✔

Exercise 8.

The graph of a function q is shown.

TikZ figure

(a) State the domain and the range.

(b) Find all x with q ( x ) = 0 .

(c) For which x is q ( x ) > 0 ?

Answer

(a) Dom ( q ) = [ 3 , 3 ] , Rng ( q ) = [ 2 , 2 ]   (b) x = 2 and x = 2   (c) 3 x < 2 or 2 < x 3

Solution

(a) Domain. Vertical lines meet the curve exactly for x from 3 to 3 , and both ends are solid dots, so

Dom ( q ) = [ 3 , 3 ] .

Range. The lowest point of the curve is ( 0 , 2 ) and the highest points are the two endpoints at height 2 . Horizontal lines meet the curve for every height from 2 to 2 and for no other height, so

Rng ( q ) = [ 2 , 2 ] .

(b) The outputs equal to 0 correspond to points on the x -axis. The curve crosses the axis at ( 2 , 0 ) and ( 2 , 0 ) , so

q ( x ) = 0 for x = 2  and  x = 2.

(c) The outputs greater than 0 correspond to points above the x -axis. Reading the picture from left to right:

  • from x = 3 up to (but not including) x = 2 , the curve is above the axis;
  • from x = 2 to x = 2 , the curve is on or below the axis;
  • from just after x = 2 to x = 3 , the curve is above the axis again.

So q ( x ) > 0 exactly when

3 x < 2 or 2 < x 3.

The values x = 2 and x = 2 are excluded because there the output is 0 , which is not greater than 0 .

A summary of what is read where. The domain is read along the x -axis; the range along the y -axis; solutions of q ( x ) = 0 are the crossings of the x -axis; and the sign of q is decided by whether the curve is above or below that axis.

Exercise 9.

A student looks at the graph below and reports " Dom = [ 0 , 2 ] and Rng = [ 1 , 5 ] ". Find the error and give the correct answers.

TikZ figure
Answer

The student read the wrong intervals off the axes. The correct answers are Dom = [ 1 , 5 ] and Rng = [ 1 , 5 ] .

Solution

Reading the picture correctly. The graph is the segment joining the two solid dots ( 1 , 1 ) and ( 5 , 5 ) .

Domain. Vertical lines meet the segment exactly when x runs from 1 to 5 , both included. So

Dom = [ 1 , 5 ] .

Range. The heights on the segment run from 1 (at the left dot) to 5 (at the right dot), and every height in between occurs. So

Rng = [ 1 , 5 ] .

The student's error. The answer [ 0 , 2 ] corresponds to nothing on this graph; it looks as though the student read tick marks or axis labels rather than the extent of the curve. The correct procedure is not to look at the axes on their own, but to project the graph onto them: find where the graph starts and stops horizontally, then where it starts and stops vertically.

How to avoid the error. Locate the leftmost and rightmost points of the graph and read their first coordinates — those bound the domain. Locate the lowest and highest points and read their second coordinates — those bound the range. Here the leftmost point is ( 1 , 1 ) and the rightmost is ( 5 , 5 ) , which settles both questions at once.

A remark. That the domain and range came out equal is a peculiarity of this segment, whose ends happen to be at the same numbers on both axes. In the previous exercises the two sets were different, which is the usual situation.

Exercise 10.

Sketch the graph of one function whose domain is [ 1 , 4 ] and whose range is [ 0 , 2 ] . Then sketch a second, differently shaped, graph with the same domain and range.

Solution

What is being asked. We must produce a curve that

  • passes the vertical line test (so it is a graph of a function),
  • has horizontal extent exactly from 1 to 4 , both ends included,
  • has vertical extent exactly from 0 to 2 , both values attained.

A first answer: a rising segment. Join the point ( 1 , 0 ) to the point ( 4 , 2 ) by a straight segment, with both endpoints solid.

TikZ figure

Verification. Vertical lines meet it exactly for 1 x 4 , so the domain is [ 1 , 4 ] . ✔ The heights climb from 0 to 2 with no gaps, so the range is [ 0 , 2 ] . ✔ No vertical line meets it twice, so it is a genuine graph of a function. ✔

A second answer: an arch. Draw a curve starting at ( 1 , 0 ) , rising to a highest point ( 1.5 , 2 ) , and coming back down to ( 4 , 0 ) .

TikZ figure

Verification. The horizontal extent is again [ 1 , 4 ] ✔; the lowest height is 0 (at both ends) and the highest is 2 (at the top), with every height in between occurring ✔; and no vertical line meets the arch twice, since the curve never doubles back to the left ✔.

What this shows. Knowing the domain and range of a function tells us the extent of its graph but almost nothing about its shape. Infinitely many different functions share the domain [ 1 , 4 ] and the range [ 0 , 2 ] .

Exercise 11.

Decide whether each statement is always, sometimes, or never true, and justify your answer.

(a) If every point of the graph of f lies above the x -axis, then every number in Rng ( f ) is positive.

(b) If the domain of f is a closed interval [ a , b ] , then the range of f is also a closed interval.

Answer

(a) Always true.   (b) Sometimes true.

Solution

(a) Always true. A number y belongs to Rng ( f ) exactly when some point ( x , y ) lies on the graph. Lying above the x -axis means precisely having a positive second coordinate. So if every point of the graph is above the axis, every second coordinate is positive — and those second coordinates are exactly the members of the range. Hence every element of the range is positive.

For instance, the graph of f ( x ) = x 2 + 1 lies entirely above the axis, and indeed its range [ 1 , ) contains only positive numbers.

(b) Sometimes true.

A case where it holds. The function f ( x ) = 2 x + 1 on [ 2 , 3 ] , sketched earlier, has range [ 3 , 7 ] , a closed interval.

A case where it fails. Consider a function whose graph on [ 0 , 2 ] is the segment from ( 0 , 0 ) to ( 2 , 2 ) with the single point ( 1 , 1 ) removed, as in the hole exercise above. Its domain is not all of [ 0 , 2 ] — so to keep the domain a full closed interval, take instead a graph on [ 0 , 2 ] consisting of the segment from ( 0 , 0 ) to ( 1 , 1 ) together with the segment from ( 1 , 2 ) to ( 2 , 3 ) , where the point ( 1 , 1 ) is drawn solid and the point ( 1 , 2 ) hollow. A vertical line meets this picture once for every x in [ 0 , 2 ] , so the domain is exactly [ 0 , 2 ] ; but the heights obtained are [ 0 , 1 ] from the first piece and ( 2 , 3 ] from the second, so the range is

[ 0 , 1 ] ( 2 , 3 ] ,

which is not an interval at all.

Since the conclusion holds in some cases and fails in others, the statement is sometimes true.

What makes the difference. When the graph can be drawn over [ a , b ] without lifting the pencil, the range does come out as a closed interval. A jump or a break in the graph is what allows the range to split apart.

Exercise 12.

The graph of f ( x ) = 1 x is shown. Use it to state the domain and the range, and explain how each is read off the picture.

TikZ figure
Answer

Dom ( f ) = { 0 } and Rng ( f ) = { 0 } .

Solution

The domain, read from vertical lines. Place a vertical line at any x 0 . If x > 0 it meets the right branch; if x < 0 it meets the left branch. In both cases there is exactly one intersection.

The single exception is x = 0 : the y -axis itself. The two branches climb and fall alongside it but neither ever touches it, so the vertical line x = 0 meets nothing. Hence

Dom ( f ) = { 0 } = ( , 0 ) ( 0 , ) .

This matches the algebra: f ( 0 ) = 1 0 is undefined.

The range, read from horizontal lines. Place a horizontal line at any height y 0 . If y > 0 it crosses the right branch, which rises from just above the axis all the way up without bound; if y < 0 it crosses the left branch, which falls without bound. So every nonzero height is attained.

The exception is y = 0 : the x -axis. Both branches flatten toward it as we move outward, but neither ever reaches it. Hence

Rng ( f ) = { 0 } .

This too matches the algebra: solving 1 x = 0 would require 1 = 0 , which is impossible, so 0 is never an output.

How the two exclusions differ. The value 0 is missing from the domain because the formula breaks down there — division by zero. The value 0 is missing from the range because no input, however large, ever produces it. The graph shows both facts at once: it avoids the vertical axis and it avoids the horizontal axis.

Check with numbers. f ( 1000 ) = 0.001 , small but not zero; f ( 1000 ) = 0.001 ; f ( 0.001 ) = 1000 . The outputs get as close to 0 as we like and as large as we like, but 0 itself never appears.

Frequently Asked Questions

How do I find the domain when the graph has a hole?

A hole means the function is not defined at that x -value. Exclude it from the domain. For example, a hole at x = 1 means x = 1 Dom ( f ) , and the domain is { 1 } .


Can the range be a union of intervals?

Yes. For example, if the graph consists of two separate pieces, the range is the union of the y -values covered by each piece. This is common for piecewise functions.


What if the graph extends infinitely?

Project the infinite portion onto the axis. For example, if the graph extends upward without bound, the range includes ( M , ) for some value M . If it extends to the right without bound, the domain includes ( a , ) for some a .


Is the range always an interval?

Not necessarily. The range can be a finite set (for a piecewise constant function), a union of intervals, or a single point. However, for continuous functions defined on an interval, the range is always an interval (by the Intermediate Value Theorem from calculus).