Functions: how to graph a function, domain, range and f(g(x))
Function notation, how to graph a function from its formula, how to find its domain and range, and how composite functions such as f(g(x)) work.
A function is a rule that gives exactly one output for each input. We write it as , read “f of x”: if , then . To graph a function, plot the points — this lesson shows how to graph a function from its formula, how to move a graph you already know with transformations, and how to find the domain and range.
If plotting points from a table, drawing straight lines or sketching a basic parabola is new to you, start with the lesson on how to graph an equation; this lesson builds on it.
Function notation
Worked example
Easy: evaluate a function
If , find .
Show the working
- Replace every with 5.
- Work it out.
Answer:
Checked by Sumzo’s math engine
How to graph a function
- Find the domain: which -values are allowed?
- Find the key points: the y-intercept , the x-intercepts where , and any turning point.
- Make a table of values for a few more -values.
- Plot the points and draw a smooth curve; watch for values of that are not allowed.
Worked example
Medium: graph
Find the key points of and describe its graph.
Show the working
- y-intercept: .
- x-intercepts: factor and set to zero.
- Turning point (vertex): halfway between the roots, , where .
- The term is positive, so the parabola opens upwards.
Answer: A parabola through , and with its lowest point at .
Checked by Sumzo’s math engine
Graphing a function with transformations
Often you don’t need a table at all: if you know the graph of , small changes to the formula move it in predictable ways.
- moves the graph up by (down if is negative).
- moves it right by — note the minus sign: moves left by 2.
- reflects it in the x-axis; reflects it in the y-axis.
- stretches it vertically by a factor .
Worked example
Medium: move the graph of
Sketch using the graph of .
Show the working
- Start from , whose vertex is .
- Replacing with moves it 3 to the right; subtracting 4 moves it 4 down.
- Find where it crosses the x-axis.
- y-intercept: .
Answer: The U shape of with its vertex moved to , crossing the x-axis at 1 and 5 and the y-axis at 5.
Checked by Sumzo’s math engine
Domain and range
The domain is the set of inputs a function accepts; the range is the set of outputs it produces. Two things limit the domain of the functions you meet most: you can’t divide by zero, and you can’t take the square root of a negative number.
- : domain all real numbers; range (the vertex is the lowest point).
- : domain all real numbers except .
- : domain ; range .
Composite functions
A composite function applies one function and then another. means “do first, then ”: replace every in with the whole of .
Worked example
Hard: and
With and , find , and .
Show the working
- Put into .
- Put into .
- Inside out: , then .
Answer: , and — the order matters.
Checked by Sumzo’s math engine
Common mistakes
- Reading as — it means “f evaluated at x”.
- Composing in the wrong order: applies first.
- Forgetting brackets when substituting: for is , not .
- Leaving out excluded values from the domain, such as for .
Frequently asked questions
How do you graph a function?
Find the domain, then the intercepts and any turning point, make a table of values, plot the points and join them smoothly. A graphing calculator is a quick way to check the shape.
What is the difference between domain and range?
The domain is every input the function accepts; the range is every output it can give.
Is f(g(x)) the same as g(f(x))?
Usually not. With and , but .