We've updated our
Privacy Policy effective December 15. Please read our updated Privacy Policy and tap

TEXT

# 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)

## 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.

Answer: We can sketch a graph of this new function by adding 20 to each of the output values of the original function. This will have the effect of shifting the graph vertically up. Notice that for each input value, the output value has increased by 20, so if we call the new function $S\left(t\right)$, we could write

$S\left(t\right)=V\left(t\right)+20$

This notation tells us that, for any value of $t,S\left(t\right)$ can be found by evaluating the function $V$ at the same input and then adding 20 to the result. This defines $S$ as a transformation of the function $V$, in this case a vertical shift up 20 units. Notice that, with a vertical shift, the input values stay the same and only the output values change.
 $t$ 0 8 10 17 19 24 $V\left(t\right)$ 0 0 220 220 0 0 $S\left(t\right)$ 20 20 240 240 20 20

### 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

Answer: The formula $g\left(x\right)=f\left(x\right)-3$ tells us that we can find the output values of $g$ by subtracting 3 from the output values of $f$. For example:

$\begin{cases}f\left(2\right)=1\hfill & \text{Given}\hfill \\ g\left(x\right)=f\left(x\right)-3\hfill & \text{Given transformation}\hfill \\ g\left(2\right)=f\left(2\right)-3\hfill & \hfill \\ =1 - 3\hfill & \hfill \\ =-2\hfill & \hfill \end{cases}$

Subtracting 3 from each $f\left(x\right)$ value, we can complete a table of values for $g\left(x\right)$.
 $x$ 2 4 6 8 $f\left(x\right)$ 1 3 7 11 $g\left(x\right)$ −2 0 4 8

#### Analysis of the Solution

As with the earlier vertical shift, notice the input values stay the same and only the output values change.

### 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.

Answer: We can set $V\left(t\right)$ to be the original program and $F\left(t\right)$ to be the revised program.

$\begin{cases}{c}V\left(t\right)=\text{ the original venting plan}\\ \text{F}\left(t\right)=\text{starting 2 hrs sooner}\end{cases}$

In the new graph, at each time, the airflow is the same as the original function $V$ was 2 hours later. For example, in the original function $V$, the airflow starts to change at 8 a.m., whereas for the function $F$, the airflow starts to change at 6 a.m. The comparable function values are $V\left(8\right)=F\left(6\right)$. Notice also that the vents first opened to $220{\text{ ft}}^{2}$ at 10 a.m. under the original plan, while under the new plan the vents reach $220{\text{ ft}}^{\text{2}}$ at 8 a.m., so $V\left(10\right)=F\left(8\right)$. In both cases, we see that, because $F\left(t\right)$ starts 2 hours sooner, $h=-2$. That means that the same output values are reached when $F\left(t\right)=V\left(t-\left(-2\right)\right)=V\left(t+2\right)$.

#### Analysis of the Solution

Note that $V\left(t+2\right)$ has the effect of shifting the graph to the left. Horizontal changes or "inside changes" affect the domain of a function (the input) instead of the range and often seem counterintuitive. The new function $F\left(t\right)$ uses the same outputs as $V\left(t\right)$, but matches those outputs to inputs 2 hours earlier than those of $V\left(t\right)$. Said another way, we must add 2 hours to the input of $V$ to find the corresponding output for $F:F\left(t\right)=V\left(t+2\right)$.

### 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)$.

Answer: Notice that the graph is identical in shape to the $f\left(x\right)={x}^{2}$ function, but the x-values are shifted to the right 2 units. The vertex used to be at (0,0), but now the vertex is at (2,0). The graph is the basic quadratic function shifted 2 units to the right, so

$g\left(x\right)=f\left(x - 2\right)$

Notice how we must input the value $x=2$ to get the output value $y=0$; the x-values must be 2 units larger because of the shift to the right by 2 units. We can then use the definition of the $f\left(x\right)$ function to write a formula for $g\left(x\right)$ by evaluating $f\left(x - 2\right)$.

$\begin{cases}f\left(x\right)={x}^{2}\hfill \\ g\left(x\right)=f\left(x - 2\right)\hfill \\ g\left(x\right)=f\left(x - 2\right)={\left(x - 2\right)}^{2}\hfill \end{cases}$

#### Analysis of the Solution

To determine whether the shift is $+2$ or $-2$ , consider a single reference point on the graph. For a quadratic, looking at the vertex point is convenient. In the original function, $f\left(0\right)=0$. In our shifted function, $g\left(2\right)=0$. To obtain the output value of 0 from the function $f$, we need to decide whether a plus or a minus sign will work to satisfy $g\left(2\right)=f\left(x - 2\right)=f\left(0\right)=0$. For this to work, we will need to subtract 2 units from our input values.

## Reflections

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.

Answer: a. Reflecting the graph vertically means that each output value will be reflected over the horizontal t-axis as shown below.

Vertical reflection of the square root function
Because each output value is the opposite of the original output value, we can write

$V\left(t\right)=-s\left(t\right)\text{ or }V\left(t\right)=-\sqrt{t}$

Notice that this is an outside change, or vertical shift, that affects the output $s\left(t\right)$ values, so the negative sign belongs outside of the function. b. Reflecting horizontally means that each input value will be reflected over the vertical axis as shown below.
Horizontal reflection of the square root function
Because each input value is the opposite of the original input value, we can write

$H\left(t\right)=s\left(-t\right)\text{ or }H\left(t\right)=\sqrt{-t}$

Notice that this is an inside change or horizontal change that affects the input values, so the negative sign is on the inside of the function. Note that these transformations can affect the domain and range of the functions. While the original square root function has domain $\left[0,\infty \right)$ and range $\left[0,\infty \right)$, the vertical reflection gives the $V\left(t\right)$ function the range $\left(-\infty ,0\right]$ and the horizontal reflection gives the $H\left(t\right)$ function the domain $\left(-\infty ,0\right]$.

### Try It

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

Answer: a) b)

## 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.

Answer: Because the population is always twice as large, the new population’s output values are always twice the original function’s output values. If we choose four reference points, (0, 1), (3, 3), (6, 2) and (7, 0) we will multiply all of the outputs by 2. The following shows where the new points for the new graph will be located. [latex-display]\begin{cases}\left(0,\text{ }1\right)\to \left(0,\text{ }2\right)\hfill \\ \left(3,\text{ }3\right)\to \left(3,\text{ }6\right)\hfill \\ \left(6,\text{ }2\right)\to \left(6,\text{ }4\right)\hfill \\ \left(7,\text{ }0\right)\to \left(7,\text{ }0\right)\hfill \end{cases}[/latex-display]

Figure 16
Symbolically, the relationship is written as [latex-display]Q\left(t\right)=2P\left(t\right)[/latex-display] This means that for any input $t$, the value of the function $Q$ is twice the value of the function $P$. Notice that the effect on the graph is a vertical stretching of the graph, where every point doubles its distance from the horizontal axis. The input values, $t$, stay the same while the output values are twice as large as before.

### 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

Answer: The formula $g\left(x\right)=\frac{1}{2}f\left(x\right)$ tells us that the output values of $g$ are half of the output values of $f$ with the same inputs. For example, we know that $f\left(4\right)=3$. Then [latex-display]g\left(4\right)=\frac{1}{2}f\left(4\right)=\frac{1}{2}\left(3\right)=\frac{3}{2}[/latex-display] We do the same for the other values to produce this table.

 $x$ $2$ $4$ $6$ $8$ $g\left(x\right)$ $\frac{1}{2}$ $\frac{3}{2}$ $\frac{7}{2}$ $\frac{11}{2}$

#### Analysis of the Solution

The result is that the function $g\left(x\right)$ has been compressed vertically by $\frac{1}{2}$. Each output value is divided in half, so the graph is half the original height.

### Try It

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

Answer:

 $x\\$ 2 4 6 8 $g\left(x\right)\\$ 9 12 15 0

### 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 $\frac{1}{b}$.
• If $0<b<1$, then the graph will be stretched by $\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.

Answer: Symbolically, we could write

$\begin{cases}R\left(1\right)=P\left(2\right),\hfill \\ R\left(2\right)=P\left(4\right),\text{ and in general,}\hfill \\ R\left(t\right)=P\left(2t\right).\hfill \end{cases}$

See below for a graphical comparison of the original population and the compressed population.
(a) Original population graph (b) Compressed population graph

#### Analysis of the Solution

Note that the effect on the graph is a horizontal compression where all input values are half of their original distance from the vertical axis.

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

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

Answer: The formula $g\left(x\right)=f\left(\frac{1}{2}x\right)$ tells us that the output values for $g$ are the same as the output values for the function $f$ at an input half the size. Notice that we do not have enough information to determine $g\left(2\right)$ because $g\left(2\right)=f\left(\frac{1}{2}\cdot 2\right)=f\left(1\right)$, and we do not have a value for $f\left(1\right)$ in our table. Our input values to $g$ will need to be twice as large to get inputs for $f$ that we can evaluate. For example, we can determine $g\left(4\right)\text{.}$

$g\left(4\right)=f\left(\frac{1}{2}\cdot 4\right)=f\left(2\right)=1$

We do the same for the other values to produce the table below.
 $x$ 4 8 12 16 $g\left(x\right)$ 1 3 7 11
This figure shows the graphs of both of these sets of points.

#### Analysis of the Solution

Because each input value has been doubled, the result is that the function $g\left(x\right)$ has been stretched horizontally by a factor of 2.

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

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

Answer: The graph of $g\left(x\right)$ looks like the graph of $f\left(x\right)$ horizontally compressed. Because $f\left(x\right)$ ends at $\left(6,4\right)$ and $g\left(x\right)$ ends at $\left(2,4\right)$, we can see that the $x\text{-}$ values have been compressed by $\frac{1}{3}$, because $6\left(\frac{1}{3}\right)=2$. We might also notice that $g\left(2\right)=f\left(6\right)$ and $g\left(1\right)=f\left(3\right)$. Either way, we can describe this relationship as $g\left(x\right)=f\left(3x\right)$. This is a horizontal compression by $\frac{1}{3}$.

#### Analysis of the Solution

Notice that the coefficient needed for a horizontal stretch or compression is the reciprocal of the stretch or compression. So to stretch the graph horizontally by a scale factor of 4, we need a coefficient of $\frac{1}{4}$ in our function: $f\left(\frac{1}{4}x\right)$. This means that the input values must be four times larger to produce the same result, requiring the input to be larger, causing the horizontal stretching.

### Try It

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

Answer: $g\left(x\right)=|x - 1|-3$

## Sequences of 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$.

Answer:

### 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.

Answer: The graph of the toolkit function starts at the origin, so this graph has been shifted 1 to the right and up 2. In function notation, we could write that as

$h\left(x\right)=f\left(x - 1\right)+2$

Using the formula for the square root function, we can write

$h\left(x\right)=\sqrt{x - 1}+2$

#### Analysis of the Solution

Note that this transformation has changed the domain and range of the function. This new graph has domain $\left[1,\infty \right)$ and range $\left[2,\infty \right)$.

### Try It

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

Answer: [latex-display]g\left(x\right)=\frac{1}{{\left(x+4\right)}^{2}}+2[/latex-display]

### Example: Applying a Learning Model Equation

A common model for learning has an equation similar to $k\left(t\right)=-{2}^{-t}+1$, where $k$ is the percentage of mastery that can be achieved after $t$ practice sessions. This is a transformation of the function $f\left(t\right)={2}^{t}$ shown below. Sketch a graph of $k\left(t\right)$.

Answer: This equation combines three transformations into one equation.

• A horizontal reflection: $f\left(-t\right)={2}^{-t}$
• A vertical reflection: $-f\left(-t\right)=-{2}^{-t}$
• A vertical shift: $-f\left(-t\right)+1=-{2}^{-t}+1$
We can sketch a graph by applying these transformations one at a time to the original function. Let us follow two points through each of the three transformations. We will choose the points (0, 1) and (1, 2).
1. First, we apply a horizontal reflection: (0, 1) (–1, 2).
2. Then, we apply a vertical reflection: (0, −1) (1, –2).
3. Finally, we apply a vertical shift: (0, 0) (1, 1).
This means that the original points, (0,1) and (1,2) become (0,0) and (1,1) after we apply the transformations. In the graphs below, the first graph results from a horizontal reflection. The second results from a vertical reflection. The third results from a vertical shift up 1 unit.

#### Analysis of the Solution

As a model for learning, this function would be limited to a domain of $t\ge 0$, with corresponding range $\left[0,1\right)$.

### Try It

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.

Answer: Notice: $g(x)=f(−x)$ looks the same as $f(x)$.

### 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.

$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 $\frac{1}{b}$. When combining horizontal transformations written in the form $f\left(b\left(x+h\right)\right)$, first horizontally stretch by $\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

Answer: There are three steps to this transformation, and we will work from the inside out. Starting with the horizontal transformations, $f\left(3x\right)$ is a horizontal compression by $\frac{1}{3}$, which means we multiply each $x\text{-}$ value by $\frac{1}{3}$.

 $x$ 2 4 6 8 $f\left(3x\right)$ 10 14 15 17
Looking now to the vertical transformations, we start with the vertical stretch, which will multiply the output values by 2. We apply this to the previous transformation.
 $x$ 2 4 6 8 $2f\left(3x\right)$ 20 28 30 34
Finally, we can apply the vertical shift, which will add 1 to all the output values.
 $x$ 2 4 6 8 $g\left(x\right)=2f\left(3x\right)+1$ 21 29 31 35

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

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

Answer: To simplify, let’s start by factoring out the inside of the function.

$f\left(\frac{1}{2}x+1\right)-3=f\left(\frac{1}{2}\left(x+2\right)\right)-3$

By factoring the inside, we can first horizontally stretch by 2, as indicated by the $\frac{1}{2}$ on the inside of the function. Remember that twice the size of 0 is still 0, so the point (0,2) remains at (0,2) while the point (2,0) will stretch to (4,0). Next, we horizontally shift left by 2 units, as indicated by $x+2$. Last, we vertically shift down by 3 to complete our sketch, as indicated by the $-3$ on the outside of the function.

## Key Equations

 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$ )

### Key Concepts

• A function can be shifted vertically by adding a constant to the output.
• A function can be shifted horizontally by adding a constant to the input.
• Relating the shift to the context of a problem makes it possible to compare and interpret vertical and horizontal shifts.
• Vertical and horizontal shifts are often combined.
• A vertical reflection reflects a graph about the $x\text{-}$ axis. A graph can be reflected vertically by multiplying the output by –1.
• A horizontal reflection reflects a graph about the $y\text{-}$ axis. A graph can be reflected horizontally by multiplying the input by –1.
• A graph can be reflected both vertically and horizontally. The order in which the reflections are applied does not affect the final graph.
• A function presented in tabular form can also be reflected by multiplying the values in the input and output rows or columns accordingly.
• A function presented as an equation can be reflected by applying transformations one at a time.
• Even functions are symmetric about the $y\text{-}$ axis, whereas odd functions are symmetric about the origin.
• Even functions satisfy the condition $f\left(x\right)=f\left(-x\right)$.
• Odd functions satisfy the condition $f\left(x\right)=-f\left(-x\right)$.
• A function can be odd, even, or neither.
• A function can be compressed or stretched vertically by multiplying the output by a constant.
• A function can be compressed or stretched horizontally by multiplying the input by a constant.
• The order in which different transformations are applied does affect the final function. Both vertical and horizontal transformations must be applied in the order given. However, a vertical transformation may be combined with a horizontal transformation in any order.

## Glossary

even function
a function whose graph is unchanged by horizontal reflection, $f\left(x\right)=f\left(-x\right)$, and is symmetric about the $y\text{-}$ axis
horizontal compression
a transformation that compresses a function’s graph horizontally, by multiplying the input by a constant $b>1$
horizontal reflection
a transformation that reflects a function’s graph across the y-axis by multiplying the input by $-1$
horizontal shift
a transformation that shifts a function’s graph left or right by adding a positive or negative constant to the input
horizontal stretch
a transformation that stretches a function’s graph horizontally by multiplying the input by a constant $0<b<1$
odd function
a function whose graph is unchanged by combined horizontal and vertical reflection, $f\left(x\right)=-f\left(-x\right)$, and is symmetric about the origin
vertical compression
a function transformation that compresses the function’s graph vertically by multiplying the output by a constant $0<a<1$
vertical reflection
a transformation that reflects a function’s graph across the x-axis by multiplying the output by $-1$
vertical shift
a transformation that shifts a function’s graph up or down by adding a positive or negative constant to the output
vertical stretch
a transformation that stretches a function’s graph vertically by multiplying the output by a constant $a>1$

## Licenses & Attributions

### CC licensed content, Original

• Revision and Adaptation. Provided by: Lumen Learning License: CC BY: Attribution.
• Question ID 113437, 60789, 112701, 60650, 113454, 112703, 112707, 112726, 113225. Authored by: Lumen Learning. License: CC BY: Attribution. License terms: IMathAS Community License CC-BY + GPL.

### CC licensed content, Shared previously

• College Algebra. Provided by: OpenStax Authored by: Abramson, Jay et al.. Located at: https://openstax.org/books/college-algebra/pages/1-introduction-to-prerequisites. License: CC BY: Attribution. License terms: Download for free at http://cnx.org/contents/[email protected].
• Question ID 75586, 75929, 75931. Authored by: Shahbazian, Roy. License: CC BY: Attribution. License terms: IMathAS Community License CC-BY + GPL.
• Question ID 33066. Authored by: Smart, Jim. License: CC BY: Attribution. License terms: IMathAS Community License CC-BY + GPL.
• Question ID 74696, 74730. Authored by: Meacham, William. License: CC BY: Attribution. License terms: IMathAS Community License CC-BY + GPL.
• Question ID 60791, 60790. Authored by: Day, Alyson. License: CC BY: Attribution. License terms: IMathAS Community License CC-BY + GPL.