Jugami Algebra

Jugami › Algebra › Functions and Their Graphs

Functions and Their Graphs

What a function is, how to name one, where it lives (its domain and range), and how to move the basic graphs around with a few simple rules.

Press a button on a vending machine and one snack drops out. Press the same button again and you get the same snack. That is the idea of a function: every input has exactly one output. In earlier units you graphed lines like y = 2x + 1 and parabolas like y = x2 − 4. Each of those is a function. This unit gives them a name, f(x), and shows how a handful of parent graphs, shifted and stretched, cover most of the graphs in high school algebra.

Graph of g(x) = (x − 2)² − 1 in solid teal and its parent f(x) = x² dashed gray. The teal parabola is the gray one moved right 2 and down 1, so its vertex, marked in purple, is at (2, −1) instead of (0, 0).xy−4−3−2−12456−3−2−112360f(x) = x²g(x) = (x − 2)² − 1(2, −1)
The graph of g(x) = (x − 2)2 − 1 is the graph of f(x) = x2 moved right 2 and down 1. Its vertex moves from (0, 0) to (2, −1).

What is a function?

A function is a rule that assigns to each input exactly one output. The set of allowed inputs is the domain, and the set of outputs you actually get is the range. Two different inputs may share an output; what is not allowed is one input with two different outputs.

Suppose a pizza costs $12, plus $2 for each topping. The cost depends on the number of toppings, so the cost is a function of the toppings. Here are four ways to show it.

1. A table

Cost of a pizza with t toppings
Toppings tCost C in dollars
012
114
216
318
420

Each number of toppings appears once in the left column, with one cost next to it. As a formula, C = 12 + 2t.

2. A mapping diagram

Draw the inputs in one oval, the outputs in another, and an arrow from each input to its output. It is a function when every input has exactly one arrow leaving it.

Mapping diagram of a function. Inputs 1, 2, 3 and 4 on the left; outputs 3, 5 and 7 on the right. Arrows: 1 goes to 3, 2 goes to 5, 3 goes to 7 and 4 goes to 7. Each input has exactly one arrow.InputOutput1234357
A function. Two inputs, 3 and 4, share the output 7, and that is fine.
Mapping diagram that is not a function. Inputs 1, 2 and 3 on the left; outputs 4, 5 and 6 on the right. Arrows: 1 goes to 4, 1 also goes to 6, 2 goes to 5 and 3 goes to 5. The input 1 has two arrows.InputOutput123456
Not a function. The input 1 has two arrows, to 4 and to 6.

3. A set of ordered pairs

Write each input with its output as a pair (input, output). Look for a repeated first number with a different second number.

Example 1: Is {(1, 4), (2, 5), (1, 6)} a function?

(1, 4) and (1, 6)The input 1 appears twice, with outputs 4 and 6noOne input has two outputs, so this relation is not a function

4. A graph

Plot each pair as a point. The pizza graph is five separate dots, not a line, because you cannot order half a topping. Its domain is the whole numbers 0 to 4 and its range is 12, 14, 16, 18 and 20.

Five separate dots for the pizza table: (0, 12), (1, 14), (2, 16), (3, 18) and (4, 20). The horizontal axis is t, the number of toppings, and the vertical axis is C, the cost in dollars. The dots lie on a straight line but are not joined, because you cannot order part of a topping.tC−112345−4481620240
The pizza function as a graph: one dot for each row of the table.

Function notation and evaluating

Instead of y = 2x2 − 3x + 1 we often write f(x) = 2x2 − 3x + 1. Read f(x) as “f of x”: the output of the function f when the input is x. It does not mean f times x. The letter can change: g(x), h(t) and C(t) are all function names.

To evaluate f(a), replace every x in the rule with a, in brackets, and work it out.

Example 2: For f(x) = 2x2 − 3x + 1, find f(−2).

f(−2) = 2(−2)2 − 3(−2) + 1Put −2 in brackets wherever x was2(4) + 6 + 1(−2)2 = 4 and −3(−2) = 615

Example 3: For h(x) = 3x − 5, find x so that h(x) = 7.

3x − 5 = 7Now the output is known and the input is not3x = 12Add 5 to both sidesx = 4Divide by 3. Check: h(4) = 3(4) − 5 = 7

You can also read values from a graph. To find f(2), go to x = 2 on the x-axis and move up or down to the graph; the height there is f(2). To solve f(x) = 3, go to height 3 and read across to the input.

Graph of the line f(x) = (1/2)x + 1. The point (2, 2), marked in coral, shows f(2) = 2. The point (4, 3), marked in purple, shows that f(x) = 3 when x = 4.xy−2−1123456−2−123450f(x) = (1/2)x + 1(2, 2)(4, 3)
For f(x) = (1/2)x + 1: the point (2, 2) means f(2) = 2, and the point (4, 3) means f(x) = 3 when x = 4.

Domain and range

The domain is every input the function accepts. The range is every output it produces. Unless a problem says otherwise, the domain is every real number that gives a real output. In this course, two things shrink it:

  • You cannot divide by 0, so 1/x + 2 needs x ≠ −2.
  • A square root of a negative number is not a real number, so √x − 3 needs x − 3 ≥ 0.

A real-world function may have a smaller domain: the pizza function only takes whole numbers of toppings.

Interval notation

Domains and ranges are often sets of numbers between two ends. Interval notation writes the two ends with a bracket on each side. A square bracket [ or ] means the end is included; a round bracket ( or ) means it is not. Infinity, ∞, is not a number you can reach, so it always gets a round bracket. The symbol ∪, “union”, joins two pieces.

Inequalities and interval notation
In wordsInequalityInterval
3 or morex ≥ 3[3, ∞)
less than 5x < 5(−∞, 5)
from −2, included, up to 4, not included−2 ≤ x < 4[−2, 4)
every number except −2x ≠ −2(−∞, −2) ∪ (−2, ∞)
all real numbers(−∞, ∞)

Example 4: Find the domain of f(x) = √x − 3.

x − 3 ≥ 0The number under the square root cannot be negativex ≥ 3Add 3 to both sides[3, ∞)3 is allowed, because √0 = 0
Graph of f(x) = √(x − 3). It starts at the point (3, 0), marked in purple, and rises slowly to the right forever. There is nothing to the left of x = 3.xy−11245678910−2−1123450f(x) = √(x − 3)(3, 0)
The graph of f(x) = √x − 3 starts at (3, 0) and only goes right: domain [3, ∞), range [0, ∞).

Example 5: Find the domain of g(x) = 1/x + 2.

x + 2 ≠ 0The denominator cannot be 0x ≠ −2Subtract 2(−∞, −2) ∪ (−2, ∞)Every real number except −2

Example 6: Find the range of f(x) = x2 + 1.

x2 ≥ 0A square is never negative, and x2 = 0 when x = 0x2 + 1 ≥ 1Add 1 to both sides[1, ∞)The smallest output is f(0) = 1, and every larger number is reached

The vertical line test

On a graph, the input is the x-coordinate. A vertical line touches every point with one particular x-coordinate. So if some vertical line hits a graph twice, that input has two outputs.

Vertical line test

A graph is the graph of a function exactly when no vertical line crosses it more than once.

The parabola y = x² − 2 with a dashed gold vertical line x = 1. The line crosses the parabola at only one point, (1, −1), marked in coral. Every vertical line does the same, so this graph is a function.xy−4−3−2234−4−3123450y = x² − 2(1, −1)
y = x2 − 2 passes: each vertical line, like x = 1, meets it once.
The circle x² + y² = 9 with a dashed gold vertical line x = 1. The line crosses the circle at two points, marked in coral, about (1, 2.83) and (1, −2.83). One input has two outputs, so this graph is not a function.xy−4−2−124−4−2−112450
The circle x2 + y2 = 9 fails: x = 1 meets it twice, at y = √8 and y = −√8.

One vertical line that hits twice is enough to fail. To pass, the graph has to work for every vertical line, including ones you did not draw.

Parent functions

A parent function is the simplest member of a family of graphs. Learn these six shapes, and every graph in the next section is one of them moved, stretched or flipped.

The six parent functions
FamilyRuleDomainRangeKey point
Linearf(x) = x(−∞, ∞)(−∞, ∞)(0, 0)
Quadraticf(x) = x2(−∞, ∞)[0, ∞)vertex (0, 0)
Absolute valuef(x) = |x|(−∞, ∞)[0, ∞)vertex (0, 0)
Square rootf(x) = √x[0, ∞)[0, ∞)starting point (0, 0)
Cubicf(x) = x3(−∞, ∞)(−∞, ∞)center (0, 0)
Reciprocalf(x) = 1/x(−∞, 0) ∪ (0, ∞)(−∞, 0) ∪ (0, ∞)(1, 1); asymptotes x = 0 and y = 0
The linear parent function f(x) = x: a straight line through the origin, rising at 45 degrees. The point (0, 0) is marked in purple.xy−4−3−21234−4−3−21234f(x) = x
Linear: f(x) = x
The quadratic parent function f(x) = x²: a U-shaped parabola with its vertex at the origin. The point (0, 0) is marked in purple.xy−4−3−2−11234−4−3−2−11234f(x) = x²
Quadratic: f(x) = x2
The absolute value parent function f(x) = |x|: a V shape with its corner at the origin. The point (0, 0) is marked in purple.xy−4−3−2−11234−4−3−2−11234f(x) = |x|
Absolute value: f(x) = |x|
The square root parent function f(x) = √x: half of a sideways parabola, starting at the origin and rising slowly to the right. The point (0, 0) is marked in purple.xy−4−3−2−11234−4−3−2−11234f(x) = √x
Square root: f(x) = √x
The cubic parent function f(x) = x³: an S-shaped curve through the origin, falling on the left and rising on the right. The point (0, 0) is marked in purple.xy−4−3−21234−4−3−2−11234f(x) = x³
Cubic: f(x) = x3
The reciprocal parent function f(x) = 1/x: two separate branches, one in the top-right quadrant and one in the bottom-left, that get close to the axes but never touch them. The point (1, 1) is marked in purple.xy123412340f(x) = 1/x
Reciprocal: f(x) = 1/x

The reciprocal graph has two asymptotes, drawn dashed gold: lines the graph gets closer and closer to but never reaches. It never touches x = 0 because 1/0 is undefined, and never touches y = 0 because 1/x is never 0.

Transformations: a · f(x − h) + k

Start from a parent f(x). The new function g(x) = a · f(x − h) + k has the same family shape, moved by three numbers.

What a, h and k do
ChangeWhat happens to the graphExample with f(x) = x2
f(x) + kup k units (down if k is negative)x2 + 3: up 3
f(x − h)right h units (left if h is negative)(x − 2)2: right 2
a · f(x), a > 1vertical stretch: a times as tall3x2: narrower
a · f(x), 0 < a < 1vertical compression(1/2)x2: wider
−f(x)reflection in the x-axis: upside down−x2: opens downward

The minus sign in x − h

f(x − 2) moves the graph right 2, not left. The vertex of (x − 2)2 is where x − 2 = 0, at x = 2. In the same way, f(x + 1) is f(x − (−1)), so h = −1 and the graph moves left 1.

Every point moves the same way: the key point (0, 0) of a parent goes to (h, k). For square root, absolute value and quadratics that is the starting point or vertex.

Example 7: Describe g(x) = −2|x + 1| + 3 and find its vertex.

−2|x − (−1)| + 3Parent |x| with a = −2, h = −1, k = 3−2|x + 1| + 3Left 1, stretched by 2 and flipped upside down, then up 3(−1, 3)The vertex moves from (0, 0) to (h, k)
Graph of g(x) = −2|x + 1| + 3 in solid teal and its parent f(x) = |x| dashed gray. The teal graph is an upside-down V with its corner, marked in purple, at (−1, 3). It is narrower than the parent.xy−6−5−4−2−123456−5−4−3−2−1134560f(x) = |x|g(x)(−1, 3)
g(x) = −2|x + 1| + 3 is a narrow upside-down V with its vertex at (−1, 3). Its range is (−∞, 3].

Example 8: Write the rule for √x moved right 4 and down 2, and give its domain and range.

√x − 4 − 2Right 4 means h = 4; down 2 means k = −2[4, ∞)Domain: need x − 4 ≥ 0[−2, ∞)Range: the square root is at least 0, so g(x) ≥ −2
Graph of g(x) = √(x − 4) − 2 in solid teal and its parent f(x) = √x dashed gray. The teal curve has the same shape, but it starts at (4, −2), marked in purple, instead of (0, 0).xy−22481012−4−2240f(x) = √xg(x) = √(x − 4) − 2(4, −2)
g(x) = √x − 4 − 2 starts at (4, −2).

Transformation explorer

Pick a parent function, then change a, h and k in g(x) = a · f(x − h) + k. The parent stays on the grid as a dashed gray curve so you can see each move. The exponential parent here is f(x) = 2x.

Exponential functions

An exponential function has the variable in the exponent: y = a · bx, with a ≠ 0, b > 0 and b ≠ 1. The base b is the growth factor: each time x goes up by 1, y is multiplied by b. When x = 0, b0 = 1 (see zero and negative exponents), so y = a: the graph crosses the y-axis at (0, a).

  • If b > 1 and a > 0, the function shows exponential growth: it rises faster and faster.
  • If 0 < b < 1 and a > 0, it shows exponential decay: it falls, by the same fraction each step, toward 0.
The growth curve y = 2^x in teal rises to the right, and the decay curve y = (1/2)^x in coral falls to the right. They are mirror images in the y-axis and cross it at the same point, (0, 1), marked in purple. Both get close to the x-axis on one side but never touch it.xy−5−4−3−2−112345−2−123456780y = 2^xy = (1/2)^x(0, 1)
y = 2x grows and y = (1/2)x decays. Both pass through (0, 1) and have the asymptote y = 0.

Linear versus exponential

A linear function adds the same amount each step. An exponential function multiplies by the same factor each step. Compare y = 2x + 1 and y = 3x, which both start at 1:

Linear and exponential values
x2x + 13x
011
133
259
3727
4981

Down the middle column each value is 2 more than the one above. Down the last column each value is 3 times the one above. At x = 4 the line has reached 9 but the exponential is already at 81. An exponential growth function with a > 0 always overtakes a linear function eventually.

The line y = 2x + 1 in teal and the curve y = 3^x in coral. They meet at (0, 1) and (1, 3), marked in purple. Between those points the line is a little higher; to the right of x = 1 the exponential curve climbs much faster and stays above the line.xy−3−21234−4−24681012140y = 2x + 1y = 3^x(0, 1)(1, 3)
y = 2x + 1 and y = 3x meet at (0, 1) and (1, 3); after that the exponential pulls away.

Example 9: For f(x) = 5 · 2x, find f(3) and f(−1).

f(3) = 5 · 23Replace x with 35 · 8Do the power first40

And f(−1) = 5 · 2−1 = 5 · 1/2 = 5/2, because a negative exponent means the reciprocal.

Example 10: A tank holds 100 liters, and each hour 20% of the water in it drains out. Write the amount left after x hours.

100(0.8)xLosing 20% leaves 80%, so the factor is b = 0.8; the start is a = 100100(0.8)3After 3 hours51.2About 51 liters. This is decay because 0 < 0.8 < 1

Common mistakes

✗f(3) means f times 3.✓f(3) is the output when the input is 3.
✗f(−3) = −32 = −9 for f(x) = x2.✓Use brackets: f(−3) = (−3)2 = 9.
✗(x − 2)2 is x2 moved left 2.✓It moves right 2: the vertex is where x − 2 = 0.
✗x2 + 3 and (x + 3)2 are the same move.✓x2 + 3 moves up 3; (x + 3)2 moves left 3.
✗The domain of √x − 3 is x ≥ 0.✓It is x ≥ 3, because x − 3 must not be negative.
✗The range of x2 + 1 is [1, ∞].✓Infinity is never included: [1, ∞).
✗2x goes up by 2 each step.✓It doubles each step: 1, 2, 4, 8, 16.

Practice problems

Try each one, then open the answer to check your work.

  1. For f(x) = 3x2 − x, find f(−2).
    Show answer
    3(−2)2 − (−2)Put −2 in brackets12 + 23 · 4 = 12, and subtracting −2 adds 214
  2. For h(x) = 5 − 2x, solve h(x) = −7.
    Show answer
    5 − 2x = −7−2x = −12Subtract 5x = 6Divide by −2
  3. Is {(2, 3), (4, 3), (6, 1)} a function?
    Show answer
    yesEach input 2, 4 and 6 appears once. Sharing the output 3 is allowed
  4. Find the domain of f(x) = √x + 5.
    Show answer
    x + 5 ≥ 0No negatives under the square rootx ≥ −5[−5, ∞)
  5. Find the domain of g(x) = 4/x − 1.
    Show answer
    x − 1 ≠ 0No dividing by 0x ≠ 1(−∞, 1) ∪ (1, ∞)
  6. Find the range of f(x) = |x| − 4.
    Show answer
    |x| ≥ 0An absolute value is never negative|x| − 4 ≥ −4Subtract 4[−4, ∞)
  7. Write f(x) = x2 moved left 3 and up 2.
    Show answer
    (x − (−3))2 + 2Left 3 means h = −3; up 2 means k = 2(x + 3)2 + 2
  8. Find the vertex and range of g(x) = −(x − 1)2 + 5.
    Show answer
    (1, 5)h = 1 and k = 5(−∞, 5]a = −1, so the parabola opens downward and 5 is the highest output
  9. For f(x) = 4 · 3x, find f(2).
    Show answer
    4 · 324 · 9Power first36
  10. For f(x) = 2x, find f(−3).
    Show answer
    2−31/23Negative exponent: reciprocal1/8
  11. Is y = 50(0.9)x growth or decay? What is its y-intercept?
    Show answer
    decay0 < 0.9 < 1, so each step keeps 90%(0, 50)a = 50, since 0.90 = 1

History: from “function” to f(x)

The idea of a function grew slowly. According to the MacTutor history of the function concept, Gottfried Leibniz used the word “function” in 1673 in its everyday sense, for lines that “perform some function” in a figure. In a letter to Leibniz in 1694, Johann Bernoulli described a function as a quantity formed in some way from variable and constant quantities.

The notation f(x) came later. Jeff Miller’s notes on the earliest uses of function symbols, citing Florian Cajori’s history of mathematical notations, say Leonhard Euler first used it in 1734, in a paper in the St Petersburg Academy’s journal Commentarii Academiae Scientiarum Petropolitanae. In 1748 Euler’s book Introductio in analysin infinitorum put functions at the center of his mathematics.

Euler still thought of a function mostly as a formula. The modern idea, any rule that gives one output for each input, formula or not, took another century to settle. MacTutor credits Joseph Fourier’s work on heat with pushing mathematicians that way, and in 1837 Peter Gustav Lejeune Dirichlet adopted Fourier’s general definition of a function and built on it. Miller also notes that Karl Weierstrass used the bars |x| for absolute value in an essay of 1841, although it may not have been printed until much later.

Connections

Every unit so far has been about functions without the name. A non-vertical line from Graphing Linear Equations is a linear function f(x) = mx + b, and m is how much the output changes when the input goes up by 1. The vertex form y = a(x − h)2 + k from Quadratic Equations is exactly a · f(x − h) + k with f(x) = x2.

The square root parent √x is x1/2, a rational exponent from Exponents and Radicals, and the zero-exponent rule b0 = 1 is why every exponential a · bx crosses the y-axis at a. Solving f(x) = 0 means finding the x-intercepts, and in Polynomials and Factoring those come from the factors.

Practice generator

Pick a level, or Mixed for a bit of everything. Type exponents with a caret, like x^2. For a domain or range, type an interval like [−2, inf) or an inequality like x >= −2; “all real numbers” works too. Type a rule like (x − 3)^2 + 1, with or without “g(x) =”, and a point like (2, −1). For yes-or-no questions, type yes or no.

Sources

Credits: all diagrams on this page are original SVG drawings made for Jugami. Every answer was double-checked.