## 11.2 – Transformations of Functions

### Learning Objectives

• (11.2.1) – Graphing with transformations of functions
• Graph functions using vertical and horizontal shifts
• Graph functions using reflections about the $x$-axis and the $y$-axis
• Graph functions using compressions and stretches
• Combine transformations
• (11.2.2) – Transformations of quadratic functions

# (11.2.1) – Graphing with transformations of functions

We all know that a flat mirror enables us to see an accurate image of ourselves and whatever is behind us. When we tilt the mirror, the images we see may shift horizontally or vertically. But what happens when we bend a flexible mirror? Like a carnival funhouse mirror, it presents us with a distorted image of ourselves, stretched or compressed horizontally or vertically. In a similar way, we can distort or transform mathematical functions to better adapt them to describing objects or processes in the real world. In this section, we will take a look at several kinds of transformations.

Figure 1. (credit: “Misko”/Flickr)

### Graph functions using vertical and horizontal shifts

One simple kind of transformation involves shifting the entire graph of a function up, down, right, or left. The simplest shift is a vertical shift, moving the graph up or down, because this transformation involves adding a positive or negative constant to the function. In other words, we add the same constant to the output value of the function regardless of the input. For a function $g\left(x\right)=f\left(x\right)+k$, the function $f\left(x\right)$ is shifted vertically $k$ units.

Vertical shift by $k=1$ of the cube root function $f\left(x\right)=\sqrt[3]{x}$.

To help you visualize the concept of a vertical shift, consider that $y=f\left(x\right)$. Therefore, $f\left(x\right)+k$ is equivalent to $y+k$. Every unit of $y$ is replaced by $y+k$, so the $y\text{-}$ value increases or decreases depending on the value of $k$. The result is a shift upward or downward.

### A General Note: Vertical Shift

Given a function $f\left(x\right)$, a new function $g\left(x\right)=f\left(x\right)+k$, where $k$ is a constant, is a vertical shift of the function $f\left(x\right)$. All the output values change by $k$ units. If $k$ is positive, the graph will shift up. If $k$ is negative, the graph will shift down.

### Example: Adding a Constant to a Function

To regulate temperature in a green building, airflow vents near the roof open and close throughout the day. Figure 2 shows the area of open vents $V$ (in square feet) throughout the day in hours after midnight, $t$. During the summer, the facilities manager decides to try to better regulate temperature by increasing the amount of open vents by 20 square feet throughout the day and night. Sketch a graph of this new function.

### How To: Given a tabular function, create a new row to represent a vertical shift.

1. Identify the output row or column.
2. Determine the magnitude of the shift.
3. Add the shift to the value in each output cell. Add a positive value for up or a negative value for down.

### Example: Shifting a Tabular Function Vertically

A function $f\left(x\right)$ is given below. Create a table for the function $g\left(x\right)=f\left(x\right)-3$.

 $x$ 2 4 6 8 $f\left(x\right)$ 1 3 7 11

### Try It

The function $h\left(t\right)=-4.9{t}^{2}+30t$ gives the height $h$ of a ball (in meters) thrown upward from the ground after $t$ seconds. Suppose the ball was instead thrown from the top of a 10-m building. Relate this new height function $b\left(t\right)$ to $h\left(t\right)$, and then find a formula for $b\left(t\right)$.

#### Identifying Horizontal Shifts

We just saw that the vertical shift is a change to the output, or outside, of the function. We will now look at how changes to input, on the inside of the function, change its graph and meaning. A shift to the input results in a movement of the graph of the function left or right in what is known as a horizontal shift.

Horizontal shift of the function $f\left(x\right)=\sqrt[3]{x}$. Note that $h=+1$ shifts the graph to the left, that is, towards negative values of $x$.

For example, if $f\left(x\right)={x}^{2}$, then $g\left(x\right)={\left(x - 2\right)}^{2}$ is a new function. Each input is reduced by 2 prior to squaring the function. The result is that the graph is shifted 2 units to the right, because we would need to increase the prior input by 2 units to yield the same output value as given in $f$.

### A General Note: Horizontal Shift

Given a function $f$, a new function $g\left(x\right)=f\left(x-h\right)$, where $h$ is a constant, is a horizontal shift of the function $f$. If $h$ is positive, the graph will shift right. If $h$ is negative, the graph will shift left.

### Example: Adding a Constant to an Input

Returning to our building airflow example from Example 2, suppose that in autumn the facilities manager decides that the original venting plan starts too late, and wants to begin the entire venting program 2 hours earlier. Sketch a graph of the new function.

### How To: Given a tabular function, create a new row to represent a horizontal shift.

1. Identify the input row or column.
2. Determine the magnitude of the shift.
3. Add the shift to the value in each input cell.

### Example: Shifting a Tabular Function Horizontally

A function $f\left(x\right)$ is given below. Create a table for the function $g\left(x\right)=f\left(x - 3\right)$.

 $x$ 2 4 6 8 $f\left(x\right)$ 1 3 7 11

### Example: Identifying a Horizontal Shift of a Toolkit Function

This graph represents a transformation of the toolkit function $f\left(x\right)={x}^{2}$. Relate this new function $g\left(x\right)$ to $f\left(x\right)$, and then find a formula for $g\left(x\right)$.

### Example: Interpreting Horizontal versus Vertical Shifts

The function $G\left(m\right)$ gives the number of gallons of gas required to drive $m$ miles. Interpret $G\left(m\right)+10$ and $G\left(m+10\right)$.

### Try It

Given the function $f\left(x\right)=\sqrt{x}$, graph the original function $f\left(x\right)$ and the transformation $g\left(x\right)=f\left(x+2\right)$ on the same axes. Is this a horizontal or a vertical shift? Which way is the graph shifted and by how many units?

### Graph functions using reflections about the $x$-axis and the $y$-axis

Another transformation that can be applied to a function is a reflection over the $x$– or $y$-axis. A vertical reflection reflects a graph vertically across the $x$-axis, while a horizontal reflection reflects a graph horizontally across the $y$-axis. The reflections are shown in Figure 9.

Vertical and horizontal reflections of a function.

Notice that the vertical reflection produces a new graph that is a mirror image of the base or original graph about the x-axis. The horizontal reflection produces a new graph that is a mirror image of the base or original graph about the y-axis.

### A General Note: Reflections

Given a function $f\left(x\right)$, a new function $g\left(x\right)=-f\left(x\right)$ is a vertical reflection of the function $f\left(x\right)$, sometimes called a reflection about (or over, or through) the x-axis.

Given a function $f\left(x\right)$, a new function $g\left(x\right)=f\left(-x\right)$ is a horizontal reflection of the function $f\left(x\right)$, sometimes called a reflection about the y-axis.

### How To: Given a function, reflect the graph both vertically and horizontally.

1. Multiply all outputs by $-1$ for a vertical reflection. The new graph is a reflection of the original graph about the $x$-axis.
2. Multiply all inputs by $-1$ for a horizontal reflection. The new graph is a reflection of the original graph about the $y$-axis.

### Example: Reflecting a Graph Horizontally and Vertically

Reflect the graph of $s\left(t\right)=\sqrt{t}$ (a) vertically and (b) horizontally.

### Try It

Reflect the graph of $f\left(x\right)=|x - 1|$ (a) vertically and (b) horizontally.

### Example: Reflecting a Tabular Function Horizontally and Vertically

A function $f\left(x\right)$ is given. Create a table for the functions below.

1. $g\left(x\right)=-f\left(x\right)$
2. $h\left(x\right)=f\left(-x\right)$
 $x$ 2 4 6 8 $f\left(x\right)$ 1 3 7 11

### Try It

 $x$ −2 0 2 4 $f\left(x\right)$ 5 10 15 20

Using the function $f\left(x\right)$ given in the table above, create a table for the functions below.

a. $g\left(x\right)=-f\left(x\right)$

b. $h\left(x\right)=f\left(-x\right)$

### Graph functions using compressions and stretches

Adding a constant to the inputs or outputs of a function changed the position of a graph with respect to the axes, but it did not affect the shape of a graph. We now explore the effects of multiplying the inputs or outputs by some quantity.

We can transform the inside (input values) of a function or we can transform the outside (output values) of a function. Each change has a specific effect that can be seen graphically.

#### Vertical Stretches and Compressions

When we multiply a function by a positive constant, we get a function whose graph is stretched or compressed vertically in relation to the graph of the original function. If the constant is greater than 1, we get a vertical stretch; if the constant is between 0 and 1, we get a vertical compression. The graph below shows a function multiplied by constant factors 2 and 0.5 and the resulting vertical stretch and compression.

Vertical stretch and compression

### A General Note: Vertical Stretches and Compressions

Given a function $f\left(x\right)$, a new function $g\left(x\right)=af\left(x\right)$, where $a$ is a constant, is a vertical stretch or vertical compression of the function $f\left(x\right)$.

• If $a>1$, then the graph will be stretched.
• If $0 < a < 1$, then the graph will be compressed.
• If $a<0$, then there will be combination of a vertical stretch or compression with a vertical reflection.

### How To: Given a function, graph its vertical stretch.

1. Identify the value of $a$.
2. Multiply all range values by $a$.
3. If $a>1$, the graph is stretched by a factor of $a$.
If ${ 0 }<{ a }<{ 1 }$, the graph is compressed by a factor of $a$.
If $a<0$, the graph is either stretched or compressed and also reflected about the x-axis.

### Example: Graphing a Vertical Stretch

A function $P\left(t\right)$ models the number of fruit flies in a population over time, and is graphed below.

A scientist is comparing this population to another population, $Q$, whose growth follows the same pattern, but is twice as large. Sketch a graph of this population.

### How To: Given a tabular function and assuming that the transformation is a vertical stretch or compression, create a table for a vertical compression.

1. Determine the value of $a$.
2. Multiply all of the output values by $a$.

### Example: Finding a Vertical Compression of a Tabular Function

A function $f$ is given in the table below. Create a table for the function $g\left(x\right)=\frac{1}{2}f\left(x\right)$.

 $x$ 2 4 6 8 $f\left(x\right)$ 1 3 7 11

### EXAMPLE

A function $f$ is given below. Create a table for the function $g\left(x\right)=\frac{3}{4}f\left(x\right)$.

 $x$ 2 4 6 8 $f\left(x\right)$ 12 16 20 0

### Example: Recognizing a Vertical Stretch

The graph is a transformation of the toolkit function $f\left(x\right)={x}^{3}$. Relate this new function $g\left(x\right)$ to $f\left(x\right)$, and then find a formula for $g\left(x\right)$.

### EXAMPLE

Write the formula for the function that we get when we stretch the identity toolkit function by a factor of 3, and then shift it down by 2 units.

### Horizontal Stretches and Compressions

Now we consider changes to the inside of a function. When we multiply a function’s input by a positive constant, we get a function whose graph is stretched or compressed horizontally in relation to the graph of the original function. If the constant is between 0 and 1, we get a horizontal stretch; if the constant is greater than 1, we get a horizontal compression of the function.

Given a function $y=f\left(x\right)$, the form $y=f\left(bx\right)$ results in a horizontal stretch or compression. Consider the function $y={x}^{2}$. The graph of $y={\left(0.5x\right)}^{2}$ is a horizontal stretch of the graph of the function $y={x}^{2}$ by a factor of 2. The graph of $y={\left(2x\right)}^{2}$ is a horizontal compression of the graph of the function $y={x}^{2}$ by a factor of 2.

### A General Note: Horizontal Stretches and Compressions

Given a function $f\left(x\right)$, a new function $g\left(x\right)=f\left(bx\right)$, where $b$ is a constant, is a horizontal stretch or horizontal compression of the function $f\left(x\right)$.

• If $b>1$, then the graph will be compressed by $\displaystyle \frac{1}{b}$.
• If $0<b<1$, then the graph will be stretched by $\displaystyle \frac{1}{b}$.
• If $b<0$, then there will be combination of a horizontal stretch or compression with a horizontal reflection.

### How To: Given a description of a function, sketch a horizontal compression or stretch.

1. Write a formula to represent the function.
2. Set $g\left(x\right)=f\left(bx\right)$ where $b>1$ for a compression or $0<b<1$
for a stretch.

### Example: Graphing a Horizontal Compression

Suppose a scientist is comparing a population of fruit flies to a population that progresses through its lifespan twice as fast as the original population. In other words, this new population, $R$, will progress in 1 hour the same amount as the original population does in 2 hours, and in 2 hours, it will progress as much as the original population does in 4 hours. Sketch a graph of this population.

### Example: Finding a Horizontal Stretch for a Tabular Function

A function $f\left(x\right)$ is given below. Create a table for the function $\displaystyle g\left(x\right)=f\left(\frac{1}{2}x\right)$.

 $x$ 2 4 6 8 $f\left(x\right)$ 1 3 7 11

### Example: Recognizing a Horizontal Compression on a Graph

Relate the function $g\left(x\right)$ to $f\left(x\right)$.

### Try It

Write a formula for the toolkit square root function horizontally stretched by a factor of 3.

### Combine transformations

Now that we have two transformations, we can combine them together. Vertical shifts are outside changes that affect the output ( $y\text{-}$ ) axis values and shift the function up or down. Horizontal shifts are inside changes that affect the input ( $x\text{-}$ ) axis values and shift the function left or right. Combining the two types of shifts will cause the graph of a function to shift up or down and right or left.

### How To: Given a function and both a vertical and a horizontal shift, sketch the graph.

1. Identify the vertical and horizontal shifts from the formula.
2. The vertical shift results from a constant added to the output. Move the graph up for a positive constant and down for a negative constant.
3. The horizontal shift results from a constant added to the input. Move the graph left for a positive constant and right for a negative constant.
4. Apply the shifts to the graph in either order.

### Example: Graphing Combined Vertical and Horizontal Shifts

Given $f\left(x\right)=|x|$, sketch a graph of $h\left(x\right)=f\left(x+1\right)-3$.

The function $f$ is our toolkit absolute value function. We know that this graph has a V shape, with the point at the origin. The graph of $h$ has transformed $f$ in two ways: $f\left(x+1\right)$ is a change on the inside of the function, giving a horizontal shift left by 1, and the subtraction by 3 in $f\left(x+1\right)-3$ is a change to the outside of the function, giving a vertical shift down by 3. The transformation of the graph is illustrated below.

Let us follow one point of the graph of $f\left(x\right)=|x|$.

• The point $\left(0,0\right)$ is transformed first by shifting left 1 unit: $\left(0,0\right)\to \left(-1,0\right)$
• The point $\left(-1,0\right)$ is transformed next by shifting down 3 units: $\left(-1,0\right)\to \left(-1,-3\right)$

Below is the graph of $h$.

### Try It

Given $f\left(x\right)=|x|$, sketch a graph of $h\left(x\right)=f\left(x - 2\right)+4$.

### Example: Identifying Combined Vertical and Horizontal Shifts

Write a formula for the graph shown below, which is a transformation of the toolkit square root function.

### EXAMPLE

Write a formula for a transformation of the toolkit reciprocal function $\displaystyle f\left(x\right)=\frac{1}{x}$ that shifts the function’s graph one unit to the right and one unit up.

### EXAMPLE

Given the toolkit function $f\left(x\right)={x}^{2}$, graph $g\left(x\right)=-f\left(x\right)$ and $h\left(x\right)=f\left(-x\right)$. Take note of any surprising behavior for these functions.

#### Combine Shifts and Stretches

When combining transformations, it is very important to consider the order of the transformations. For example, vertically shifting by 3 and then vertically stretching by 2 does not create the same graph as vertically stretching by 2 and then vertically shifting by 3, because when we shift first, both the original function and the shift get stretched, while only the original function gets stretched when we stretch first.

When we see an expression such as $2f\left(x\right)+3$, which transformation should we start with? The answer here follows nicely from the order of operations. Given the output value of $f\left(x\right)$, we first multiply by 2, causing the vertical stretch, and then add 3, causing the vertical shift. In other words, multiplication before addition.

Horizontal transformations are a little trickier to think about. When we write $g\left(x\right)=f\left(2x+3\right)$, for example, we have to think about how the inputs to the function $g$ relate to the inputs to the function $f$. Suppose we know $f\left(7\right)=12$. What input to $g$ would produce that output? In other words, what value of $x$ will allow $g\left(x\right)=f\left(2x+3\right)=12$? We would need $2x+3=7$. To solve for $x$, we would first subtract 3, resulting in a horizontal shift, and then divide by 2, causing a horizontal compression.

This format ends up being very difficult to work with, because it is usually much easier to horizontally stretch a graph before shifting. We can work around this by factoring inside the function.

$\displaystyle f\left(bx+p\right)=f\left(b\left(x+\frac{p}{b}\right)\right)$

Let’s work through an example.

$f\left(x\right)={\left(2x+4\right)}^{2}$

We can factor out a 2.

$f\left(x\right)={\left(2\left(x+2\right)\right)}^{2}$

Now we can more clearly observe a horizontal shift to the left 2 units and a horizontal compression. Factoring in this way allows us to horizontally stretch first and then shift horizontally.

### A General Note: Combining Transformations

When combining vertical transformations written in the form $af\left(x\right)+k$, first vertically stretch by $a$ and then vertically shift by $k$.

When combining horizontal transformations written in the form $f\left(bx+h\right)$, first horizontally shift by $h$ and then horizontally stretch by $\displaystyle \frac{1}{b}$.

When combining horizontal transformations written in the form $f\left(b\left(x+h\right)\right)$, first horizontally stretch by $\displaystyle \frac{1}{b}$ and then horizontally shift by $h$.

Horizontal and vertical transformations are independent. It does not matter whether horizontal or vertical transformations are performed first.

### Example: Finding a Triple Transformation of a Tabular Function

Given the table below for the function $f\left(x\right)$, create a table of values for the function $g\left(x\right)=2f\left(3x\right)+1$.

 $x$ 6 12 18 24 $f\left(x\right)$ 10 14 15 17

### Example: Finding a Triple Transformation of a Graph

Use the graph of $f\left(x\right)$ to sketch a graph of $\displaystyle k\left(x\right)=f\left(\frac{1}{2}x+1\right)-3$.

# (11.2.2) – Transformations of Quadratic Functions

The standard form of a quadratic function presents the function in the form

$f\left(x\right)=a{\left(x-h\right)}^{2}+k$

where $\left(h,\text{ }k\right)$ is the vertex. Because the vertex appears in the standard form of the quadratic function, this form is also known as the vertex form of a quadratic function.

The standard form is useful for determining how the graph is transformed from the graph of $y={x}^{2}$. The figure below is the graph of this basic function.

#### Shift Up and Down by Changing the value of $k$

You can represent a vertical (up, down) shift of the graph of $f(x)=x^2$ by adding or subtracting a constant, $k$.

$f(x)=x^2 + k$

If $k>0$, the graph shifts upward, whereas if $k<0$, the graph shifts downward.

### Make Note

Write the equation for the graph of $f(x)=x^2$ that has been shifted up 4 units in the textbox below.

Now write the equation for the graph of $f(x)=x^2$ that has been shifted down 4 units in the textbox below.

Now check yourself!

#### Shift left and right by changing the value of $h$.

You can represent a horizontal (left, right) shift of the graph of $f(x)=x^2$ by adding or subtracting a constant, $h$, to the variable $x$, before squaring.

$f(x)=(x-h)^2$

If $h>0$, the graph shifts toward the right and if $h<0$, the graph shifts to the left.

### Make Note

Write the equation for the graph of $f(x)=x^2$ that has been shifted right 2 units in the textbox below.

Now write the equation for the graph of $f(x)=x^2$ that has been shifted left 2 units in the textbox below.

Now check yourself!

#### Stretch or compress by changing the value of $a$.

You can represent a stretch or compression (narrowing, widening) of the graph of $f(x)=x^2$ by multiplying the squared variable by a constant, a.

$f(x)=ax^2$

The magnitude of a indicates the stretch of the graph. If $|a|>1$, the point associated with a particular x-value shifts farther from the x-axis, so the graph appears to become narrower, and there is a vertical stretch. But if $|a|<1$, the point associated with a particular x-value shifts closer to the x-axis, so the graph appears to become wider, but in fact there is a vertical compression.

### Make Note

Write the equation for the graph of $f(x)=x^2$ that has been has been compressed vertically by a factor of $\displaystyle \frac{1}{2}$ in the textbox below.

Then,  write the equation for the graph of $f(x)=x^2$ that has been vertically stretched by a factor of 3.

Now check yourself!

The standard form and the general form are equivalent methods of describing the same function. We can see this by expanding out the general form and setting it equal to the standard form.

$\begin{cases}a{\left(x-h\right)}^{2}+k=a{x}^{2}+bx+c\hfill \\ a{x}^{2}-2ahx+\left(a{h}^{2}+k\right)=a{x}^{2}+bx+c\hfill \end{cases}$

For the linear terms to be equal, the coefficients must be equal.

$\displaystyle -2ah=b,\text{ so }h=-\frac{b}{2a}$.

This is the axis of symmetry we defined earlier. Setting the constant terms equal:

$\large\begin{cases}a{h}^{2}+k=c\hfill \\ \text{ }k=c-a{h}^{2}\hfill \\ \text{ }=c-a-{\left(\frac{b}{2a}\right)}^{2}\hfill \\ \text{ }=c-\frac{{b}^{2}}{4a}\hfill \end{cases}$

In practice, though, it is usually easier to remember that $k$ is the output value of the function when the input is $h$, so $f\left(h\right)=k$.

#### Summary of Transformations

 Vertical shift $g\left(x\right)=f\left(x\right)+k$ (up for $k>0$ ) Horizontal shift $g\left(x\right)=f\left(x-h\right)$ (right for $h>0$ ) Vertical reflection $g\left(x\right)=-f\left(x\right)$ Horizontal reflection $g\left(x\right)=f\left(-x\right)$ Vertical stretch $g\left(x\right)=af\left(x\right)$ ( $a>0$) Vertical compression $g\left(x\right)=af\left(x\right)$ $\left(01$ )