Sub topic 7
Flipping a Graph Across the x-axis and y-axis
This chapter covers reflections: what −f(x) and f(−x) do to a graph, why they differ, and how they relate to even and odd functions. It assumes you can evaluate f(x), plot points, recognize the graphs of x, x², |x|, √x and x³, and find a domain and range. It also assumes you know the shifts and stretches from earlier chapters.
The two reflections
A reflection flips a graph across a line, like a mirror. For function graphs, two mirrors matter: the x-axis and the y-axis. Each one comes from changing a different part of the function, and that split matches the idea of changing the output versus changing the input.
| Change | New function | Mirror line | What happens to a point (x, y) |
|---|---|---|---|
| Negate the output | g(x) = −f(x) | x-axis | (x, y) → (x, −y) |
| Negate the input | g(x) = f(−x) | y-axis | (x, y) → (−x, y) |
Reflection across the x-axis: −f(x)
When you write g(x) = −f(x), every output changes sign. A point at height 4 moves to height −4. A point at height −1 moves to height 1. Points on the x-axis have output 0, and −0 = 0, so they stay where they are.
The x-coordinates do not change. Each point moves straight up or straight down to the matching position on the other side of the x-axis.
Take f(x) = √x. Its graph starts at (0, 0) and rises to the right. The function g(x) = −√x starts at the same point and falls to the right. The point (4, 2) becomes (4, −2).
Reflection across the y-axis: f(−x)
When you write g(x) = f(−x), you feed −x into f. The output at x is whatever f gave at −x. To see where a point goes, ask which input to g produces the old output.
Suppose (3, 5) is on the graph of f, so f(3) = 5. For g, you need g(x) = f(−x) = 5. That happens when −x = 3, so x = −3. The point (3, 5) moves to (−3, 5). The height stays the same and the x-coordinate changes sign.
This is the same "opposite to what the sign suggests" effect you met with horizontal shifts. The minus sign sits inside the function, so it acts on the input, and the graph moves in the way that undoes it.
A worked example with √x
The graph of f(x) = √x lives only on the right of the y-axis. Its domain is x ≥ 0 and its range is y ≥ 0.
Now compare three functions:
- f(x) = √x
- −f(x) = −√x
- f(−x) = √(−x)
Check a few points for f: (0, 0), (1, 1), (4, 2), (9, 3).
- For −f(x), the points become (0, 0), (1, −1), (4, −2), (9, −3). The curve runs along the bottom right.
- For f(−x), the points become (0, 0), (−1, 1), (−4, 2), (−9, 3). The curve runs along the top left.
You can confirm one of these directly. Evaluate √(−x) at x = −4. You get √4 = 2. So (−4, 2) is on the graph.
import math
f = lambda x: math.sqrt(x)
neg_output = lambda x: -f(x) # reflection across the x-axis
neg_input = lambda x: f(-x) # reflection across the y-axis
for x in [1, 4, 9]:
print("-f(", x, ") =", neg_output(x))
for x in [-1, -4, -9]:
print("f(", x, ") =", neg_input(x))The first loop prints −1.0, −2.0 and −3.0. The second prints 1.0, 2.0 and 3.0. Notice that the second loop uses negative inputs. A call such as neg_input(4) would ask for √(−4), and math.sqrt raises a ValueError for negative numbers. That error is the domain change showing up in code.
Doing both reflections
You can apply both flips. The function g(x) = −f(−x) negates the input and then negates the output. A point (x, y) goes to (−x, −y). This is a reflection through the origin, which is the same as a rotation by 180 degrees.
Order does not matter here. Flipping across the x-axis first and the y-axis second gives the same final picture as the reverse. This is different from shifts combined with stretches, where order often changes the result.
For f(x) = x² + x, you can compute:
- f(−x) = x² − x
- −f(x) = −x² − x
- −f(−x) = −x² + x
All three differ from f, so this function has no reflection symmetry, which is a useful contrast with the next section.
Reflections and symmetry
Sometimes a reflection leaves the graph exactly as it was. That is the idea behind even and odd functions.
- A function is even if f(−x) = f(x) for every x in its domain. Reflecting across the y-axis gives the same graph. Examples: x², |x|, x⁴.
- A function is odd if f(−x) = −f(x) for every x in its domain. Reflecting across the y-axis gives the same graph as reflecting across the x-axis, which means the graph looks the same after a 180-degree turn about the origin. Examples: x, x³, 1/x.
The code below tests both rules on whole-number samples.
def is_even(f, samples):
return all(f(-x) == f(x) for x in samples)
def is_odd(f, samples):
return all(f(-x) == -f(x) for x in samples)
samples = range(-5, 6)
functions = {
"x**2": lambda x: x ** 2,
"x**3": lambda x: x ** 3,
"abs(x)": lambda x: abs(x),
"x**2 + x": lambda x: x ** 2 + x,
}
for name, fn in functions.items():
print(name, "even:", is_even(fn, samples), "odd:", is_odd(fn, samples))The output is:
x**2 even: True odd: False
x**3 even: False odd: True
abs(x) even: True odd: False
x**2 + x even: False odd: FalseMost functions are neither even nor odd, as the last line shows. Only f(x) = 0 is both.
A sample test can disprove a symmetry, but it cannot prove one. If a single x fails the test, the function is not even (or odd). If every sample passes, you still need an algebra argument. For x³, that argument is (−x)³ = −x³ for every x.
A domain condition applies too. If f is even or odd, then whenever x is in the domain, −x must be as well. The function √x has domain x ≥ 0, so 4 is in the domain but −4 is not. It cannot be even or odd.
Reflections and the rest of the transformation
Reflections fit into the general form g(x) = a·f(b(x − h)) + k.
- A negative a is a reflection across the x-axis (combined with a vertical stretch if |a| ≠ 1).
- A negative b is a reflection across the y-axis (combined with a horizontal stretch if |b| ≠ 1).
So g(x) = −2f(x) stretches vertically by a factor of 2 and flips across the x-axis. The function g(x) = f(−x/3) stretches horizontally by a factor of 3 and flips across the y-axis.
The mapping rule from the general form is (x, y) → (x/b + h, a·y + k). Setting b = −1 and h = 0 gives (x, y) → (−x, y), which matches the y-axis reflection above.
When you mix reflections with shifts, the order matters, and it is a common source of mistakes. Compare these two:
- g(x) = −f(x) + 3 flips first, then shifts up 3. A point (2, 5) goes to (2, −5) and then to (2, −2).
- h(x) = −(f(x) + 3) shifts up 3 first, then flips. The point (2, 5) goes to (2, 8) and then to (2, −8).
The results differ. In the first, the "+3" is outside the negative sign and shifts the flipped graph. In the second, the negative sign applies to everything inside the parentheses, including the 3.
The same care applies to the input side. Compare f(−x + 2) with f(−(x + 2)):
- f(−x + 2) = f(−(x − 2)). Factor out the −1 and you see a reflection with a horizontal shift of 2 to the right.
- f(−(x + 2)) is a reflection with a shift 2 to the left.
Always factor the coefficient of x out of the input before reading the shift. That is the reason the general form is written b(x − h), not bx − h.
def transform(f, a=1, b=1, h=0, k=0):
"""Return g(x) = a * f(b * (x - h)) + k."""
return lambda x: a * f(b * (x - h)) + k
f = lambda x: x ** 3 + x ** 2
# f(-x + 2): rewrite as f(-1 * (x - 2)), so b = -1 and h = 2
g1 = transform(f, b=-1, h=2)
print(g1(2), f(-2 + 2)) # both 0
print(g1(0), f(-0 + 2)) # both 12
# f(-(x + 2)): b = -1 and h = -2
g2 = transform(f, b=-1, h=-2)
print(g2(0), f(-(0 + 2))) # both -4Domain and range under reflection
Reflections change the domain and range in a predictable way.
| Transformation | Domain | Range |
|---|---|---|
| −f(x) | Same as f | Negated: if f has range [m, M], −f has range [−M, −m] |
| f(−x) | Negated: if f has domain [p, q], f(−x) has domain [−q, −p] | Same as f |
For f(x) = √x, the domain is [0, ∞) and the range is [0, ∞).
- For −√x, the domain is [0, ∞) and the range is (−∞, 0].
- For √(−x), the domain is (−∞, 0] and the range is [0, ∞).
Notice that interval endpoints swap order when you negate. An interval such as [2, 5] becomes [−5, −2], not [−2, −5]. Write the smaller number first.
Common errors
- Reading the sign backward. Students sometimes think f(−x) flips across the x-axis. Ask yourself which quantity has the minus sign. A sign on the output flips vertically across the x-axis. A sign on the input flips horizontally across the y-axis.
- Treating −f(x) and f(−x) as equal. They are equal only when f is odd. They give the same graph as f only when f is even (for f(−x)) or when f(x) = 0 (for −f(x)).
- Ignoring order with shifts. Negating before or after adding a constant gives different graphs. Use the mapping rule and track a point to be certain.
- Forgetting the domain. For functions like √x or ln x, f(−x) lives on the opposite side of the y-axis. Check the domain after you flip.
- Reading the shift from −x + 2. The shift is read after factoring: −(x − 2), which is a shift right 2, not left 2.
Exercises
Exercise
The graph of f contains the points (−2, 3), (0, 1) and (4, −5). List the corresponding points on the graph of g(x) = −f(−x), and say which single transformation of the plane this represents.
Show answer
Negating the input sends x to −x and negating the output sends y to −y, so (x, y) → (−x, −y). The points are (2, −3), (0, −1) and (−4, 5). This is a reflection through the origin, equivalent to a 180-degree rotation about the origin.
Exercise
Let f(x) = √(x − 1), with domain [1, ∞) and range [0, ∞). Find the domain and range of g(x) = −f(−x).
Show answer
Write g(x) = −√(−x − 1). The input of f is −x, which must be at least 1, so −x ≥ 1 and x ≤ −1. The domain of g is (−∞, −1]. The output is negated, so the range is (−∞, 0].
Exercise
A function f is odd and f(2) = 7. State f(−2), and then find the value of g(−2) where g(x) = −f(−x) + 1.
Show answer
Since f is odd, f(−2) = −f(2) = −7. For g, g(−2) = −f(−(−2)) + 1 = −f(2) + 1 = −7 + 1 = −6.
Exercise
Explain why g(x) = −(x² + 3) and h(x) = −x² + 3 have different graphs, and give the vertex of each.
Show answer
In g, the negative sign applies to the whole expression, so g(x) = −x² − 3. The graph is the parabola x² flipped across the x-axis and then shifted down 3, so the vertex is (0, −3). In h, the parabola is flipped and then shifted up 3, so the vertex is (0, 3).