Function Transformations

All functions can be depicted as a graph. When we transform functions, we are altering the function in order to manipulate the graph in a specific way. The most common transformations are translations (shifting the graph up, down, left, or right), but reflections and stretches are also common.

Horizontal Translations

A horizontal translation is a transformation that shifts the graph of a function to the left or right.

In order to shift a graph to the right by h units, we simply replace every instance of the independent variable (usually x) with (x - h).

It's important to note that, while counterintuitive, a shift in the positive direction (to the right) results in us subtracting h from x. On the other hand, a shift to the left (a negative shift) would result in us adding h to x.

Let's look at a few examples:

  • f(x)=3x+5
    • If g(x) represents the graph of f(x) shifted 5 units to the right, then g(x)=f(x-5).
    • g(x)=3(x-5)+5
    • This simplifies to: g(x)=3x-10
  • f(x)=x2+7x+12
    • If g(x) represents the graph of f(x) shifted 2 units to the right, then g(x)=f(x-2).
    • g(x)=(x-2)2+7(x-2)+12
    • This simplifies to: g(x)=x2+3x+2
  • f(x)=2x2-7x+10
    • If g(x) represents the graph of f(x) shifted 3 units to the left, then g(x)=f(x+3).
    • g(x)=2(x+3)2-7(x+3)+10
    • This simplifies to: g(x)=2x2+5x+7

Vertical Translations

A vertical translation is a transformation that shifts the graph of a function up or down.

If we want to shift a graph up by k units, there are two approaches we can take:

  1. Replace every instance of the dependent variable (usually y) with (y - k).
    • Example: 3x+2y=5
      • If we want to shift this graph up by 3 units, we would replace y with (y - 3).
        • Note that when we shift up, we are subtracting a constant.
        • This gives us: 3x+2(y-3)=5
        • Which simplifies to: 3x+2y=11
      • Or if we want to shift this graph down by 4 units, we would replace y with (y + 4).
        • Note that when we shift down, we are adding a constant.
        • This gives us: 3x+2(y+4)=5
        • Which simplifies to: 3x+2y=-3
  2. Add k to the entire function.
    • Example: y=5x+4
      • If we want to shift this graph up by 3 units, we would add 3 to the entire function.
        • This gives us: y=5x+4+3
        • Which simplifies to: y=5x+7
      • Or if we want to shift this graph down by 2 units, we would subtract 2 from the entire function.
        • This gives us: y=5x+4-2
        • Which simplifies to: y=5x+2
    • Note that this approach requires the dependent variable (y) to be isolated on one side of the equation before we can add the constant to the other side.

Advantages and Disadvantages of Approach 1 (replacing y with y - k)

Advantages

  • This is very similar to the horizontal translation process, so it allows us to have consistency in our approach.
  • It's especially useful when the dependent variable is not already isolated on one side of the equation.
    • For example, if we have the equation 3x+2y=5 and we want to shift it up by 3 units
      • We simply replace y with (y-3), giving us 3x+2(y-3)=5.
      • If we were to use the other approach, we would first need to solve for y in terms of x before being able to form a new equation to represent the shift.

Disadvantages

  • Like our horizontal shift process, it's a bit counterintuitive because we are subtracting a constant when we have a positive shift, and adding a constant when we have a negative shift.
  • It is also slightly more cumbersome if the dependent variable is already isolated on one side of the equation.
    • For example, if we have the equation y=5x+4 and we want to shift it up by 3 units, we would start with:
      • (y-3)=5x+4
      • The to get the equation into slope-intercept form, we would need to add 3 to both sides of the equation, yielding y=5x+7.
      • This is an extra step compared with just adding 3 to the right side of the equation to begin with.

Advantages and Disadvantages of Approach 2 (adding k to the entire function)

Advantages

  • Some find this approach more intuitive, because a positive shift corresponds to adding a positive constant.
  • It's a little faster when the dependent variable is already isolated on one side of the equation.

Disadvantages

  • It's less consistent with our horizontal shift process, so it can be trickier to remember two different processes for vertical shifts and horizontal shifts.
  • It's also more cumbersome if the dependent variable is not already isolated on one side of the equation, since you first need to isolate it before adding/subtracting the constant.
    • For example, if we have the equation 3x+2y=5 and we want to shift it up by 3 units, it would take us a couple of steps to first isolate y:
      • 2y=-3x+5
      • y=-32x+52
      • Then, after isolating y, we would need to add 3 to the right side to shift it up by 3 units, and in this case also find a common denominator to combine the constants:
        • y=-32x+52+3
        • y=-32x+52+62
        • y=-32x+112

Stretches and Compressions

A stretch or compression is a transformation that alters the shape of a graph by either making it taller, shorter, wider, or narrower. There are four different types of stretches and compressions:

  • Vertical stretch
  • Vertical compression
  • Horizontal stretch
  • Horizontal compression

Vertical Stretches and Compressions

A vertical stretch is a transformation that essentially makes the graph taller. More specifically, for any given x-value, the corresponding y-value gets multiplied by a constant factor, pushing it further away from the x-axis. So, any positive y-value will become greater (more positive), and any negative y-value will become less (more negative).
A vertical compression is the opposite of a vertical stretch. Instead of making the graph taller, it makes the graph shorter. Again, for any given x-value, the corresponding y-value gets multiplied by a constant factor, but in this case the result pulls it closer to the x-axis. So, any positive y-value will become smaller (less positive), and any negative y-value will become greater (less negative).
To perform a vertical stretch or compression, we simply multiply the entire function by a constant factor. So, a vertical stretch or compression of f(x) by a factor of a is represented as a·f(x).

Stretch vs Compression is decided by the value of a

  • If a is greater than 1, the graph is stretched by a factor of a.
  • If a is between 0 and 1, the graph is compressed by a factor of a.
Let's take the function f(x)=x2-x-2 as an example:
  • To stretch this graph vertically by a factor of 3, we would multiply the entire function by 3:
    • f(x)=3(x2-x-2)
    • This simplifies to: f(x)=3x2-3x-6
    • This makes the graph 3 times "taller". In other words, for any given x-value, the y-value is 3 times further away from the x-axis.
  • To compress this graph vertically by a factor of 2 (make it 12 as tall), we would multiply the entire function by 12:
    • f(x)=12(x2-x-2)
    • This simplifies to: f(x)=12x2-12x-1
    • This makes the graph half as tall. In other words, for any given x-value, the y-value is half as far away from the x-axis.

Visualizing Vertical Stretches and Compressions

To see what vertical stretches and compressions look like, let's take a look at the graphs of the functions used in the examples above:

f(x)=x2-x-2

g(x)=3·f(x)

h(x)=12·f(x)

Compared with our original function f(x), the graph of g(x) is stretched vertically by a factor of 3, and the graph of h(x) is compressed vertically by a factor of 12. For each value of x, the y-value of g(x) is 3 times as far from the x-axis as the original y-value, and the y-value of h(x) is half as far from the x-axis as the original y-value.

Slopes of vertically stretched and compressed graphs

When we stretch a graph vertically, for any given x-value, the slope of the graph gets steeper. When we compress a graph vertically, for any given x-value, the slope of the graph gets less steep. You can see this depicted in the graphs above.

Horizontal Stretches and Compressions

Whereas a vertical stretch makes a graph taller, a horizontal stretch makes a graph wider. More specifically, for any given y-value, the corresponding x-value gets multiplied by a constant factor, pushing it further away from the y-axis. So, any positive x-value will become greater (more positive), and any negative x-value will become less (more negative).
A horizontal compression is the opposite of a horizontal stretch. Instead of making the graph wider, it makes the graph narrower. Again, for any given y-value, the corresponding x-value gets multiplied by a constant factor, but in this case the result pulls it closer to the y-axis. So, any positive x-value will become smaller (less positive), and any negative x-value will become greater (less negative).
To perform a horizontal stretch or compression, we replace each instance of the independent variable (usually x) with (b·x). So, a horizontal stretch or compression of f(x) by a factor of b is represented as f(b·x).

Stretch is inversely related to the value of b

  • If b is greater than 1, the graph is compressed by a factor of b.
  • If b is between 0 and 1, the graph is stretched by a factor of 1b.
Let's take the function f(x)=x2-x-2 as an example:
  • To stretch this graph horizontally by a factor of 2 (make it twice as wide), we would replace x with (12·x):
    • g(x)=f(12·x)=(12·x)2-(12·x)-2
    • This simplifies to: g(x)=14x2-12x-2
    • This makes the graph twice as wide. In other words, for any given y-value, the x-value is twice as far away from the y-axis.
  • To compress this graph horizontally by a factor of 2 (make it 12 as wide), we would replace x with (2·x):
    • g(x)=f(2·x)=(2·x)2-(2·x)-2
    • This simplifies to: g(x)=4x2-2x-2
    • This makes the graph half as wide. In other words, for any given y-value, the x-value is half as far away from the y-axis.

Visualizing Horizontal Stretches and Compressions

To see what horizontal stretches and compressions look like, let's take a look at the graphs of the functions used in the examples above:

f(x)=x2-x-2

g(x)=(0.5x)2-0.5x-2

h(x)=(2x)2-2x-2

Compared with our original function f(x), the graph of g(x) is compressed horizontally by a factor of 2, and the graph of h(x) is stretched horizontally by a factor of 2. For each value of x, the y-value of g(x) is half as far from the y-axis as the original y-value, and the y-value of h(x) is twice as far from the y-axis as the original y-value.

Slopes of horizontally stretched and compressed graphs

When we stretch a graph horizontally, for any given y-value, the slope of the graph gets less steep. When we compress a graph horizontally, for any given y-value, the slope of the graph gets steeper. You can see this depicted in the graphs above.

Reflections

A reflection is a transformation that flips a graph over a line, called the line of reflection. You can think of it as the mirror image of the graph, reflected over the line of reflection. In theory, you can reflect a graph over any line, but the most common lines of reflection are the x-axis and the y-axis.

Reflections over the x-axis

To reflect a graph over the x-axis, we simply multiply the entire function by -1.

Let's take the function f(x)=x2-x-2 as an example:

To reflect this graph over the x-axis, we would multiply the entire function by -1:

(-1)·f(x)=(-1)·(x2-x-2)

This simplifies to:

-f(x)=-x2+x+2

Now let's take a look at the graphs of the original function and the reflected function:

f(x)=x2-x-2

-f(x)=-x2+x+2

Reflections over the y-axis

To reflect a graph over the y-axis, we simply replace each instance of x with -x.

First let's try this with the most simple parabola, f(x)=x2.

If we replace each instance of x with -x, we get: f(-x)=(-x)2

When we square -x, we get x2, because squaring a negative number makes it positive. So we end up with the same function we started with. This makes sense, because the parabola we started with is symmetric over the y-axis, so reflecting it over the y-axis doesn't change it.

Now let's try a function that will better demonstrate the effect of reflecting over the y-axis.

Let's take the cubic function f(x)=x3-2x2+x as an example:

To reflect this graph over the y-axis, we replace each instance of x with -x:

f(-x)=(-x)3-2(-x)2+(-x)

This simplifies to:

f(-x)=-x3-2x2-x

Now let's take a look at the graphs of the original function and the reflected function:

f(x)=x3-2x2+x

f(-x)=-x3-2x2-x

Combining Transformations

We don't have to be limited to just one transformation at a time. We can combine transformations to create more complex functions.

Let's start with the simple parabola f(x)=x2 as an example.

Let's start by multiplying the function by 2, which will stretch it vertically by a factor of 2. This gives us:

f(x)=2x2

Now let's multiply the function by -1, which will reflect the graph over the x-axis. This gives us:

f(x)=-2x2

Now let's shift it to the right 1 unit by replacing each instance of x with x-1. This gives us:

f(x)=-2(x-1)2

Finally, let's shift it up 2 units by adding 2 to the function. This gives us:

f(x)=-2(x-1)2+2

Now let's take a look at the graphs of the original function and the transformed function:

f(x)=x2

f(x)=-2(x-1)2+2

Compared with our original function, we can see that the transformed function:

  • Has been stretched vertically by a factor of 2 (making it look narrower).
  • Has been reflected over the x-axis (flipped upside down).
  • Has been shifted to the right 1 unit (the vertex is now at x=1 instead of x=0).
  • Has been shifted up 2 units (the vertex is now at y=2 instead of y=0).