1.5: Transformation of Functions
In this section, you will:
- 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.
Figure \( \PageIndex{ 1 } \) (credit: "Misko"/Flickr)
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.
Graphing Functions Using Vertical and Horizontal Shifts
Often when given a problem, we try to model the scenario using Mathematics in the form of words, tables, graphs, and equations. One method we can employ is to adapt the basic graphs of the toolkit functions to build new models for a given scenario. There are systematic ways to alter functions to construct appropriate models for the problems we are trying to solve.
Identifying Vertical Shifts
One simple kind of transformation involves shifting the entire graph of a function up, down, right, or left. The simplest of these 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(x)=f(x)+k \), the function \( f( x ) \) is shifted vertically \( k \) units. See Figure \( \PageIndex{ 2 } \) for an example.
Figure \( \PageIndex{ 2 } \): Vertical shift by \( k=1 \) of the cube root function \( f(x)= x^3 \).
To help you visualize the concept of a vertical shift, consider that \( y=f( x ) \). Therefore, \( f( x )+k \) is equivalent to \( y+k \). Every unit of \( y \) is replaced by \( y+k \), so the \( y \)-value increases or decreases depending on the value of \( k \). The result is a shift upward or downward.
Given a function \( f( x ) \), a new function \( g(x)=f(x)+k \), where \( k \) is a constant, is a vertical shift of the function \( f( x ) \). 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.
To regulate temperature in a green building, airflow vents near the roof open and close throughout the day. Figure \( \PageIndex{ 3 } \) 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.
Figure \( \PageIndex{ 3 } \)
- Solution
-
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, as shown in Figure \( \PageIndex{ 4 } \).
Figure \( \PageIndex{ 4 } \)Notice that in Figure \( \PageIndex{ 4 } \), for each input value, the output value has increased by 20, so if we call the new function \( S( t ) \), we could write\[ S(t)=V(t)+20. \nonumber \]This notation tells us that, for any value of \( t \), \( S(t) \) 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. See Table \( \PageIndex{ 1 } \).
Table \( \PageIndex{ 1 } \) \( t \) 0 8 10 17 19 24 \( V(t) \) 0 0 220 220 0 0 \( S( t ) \) 20 20 240 240 20 20
A function \( f( x ) \) is given in Table \( \PageIndex{ 2 } \). Create a table for the function \( g(x)=f(x)−3 \).
| \( x \) | 2 | 4 | 6 | 8 |
| \( f(x) \) | 1 | 3 | 7 | 11 |
- Solution
-
The formula \( g(x)=f(x)−3 \) tells us that we can find the output values of \( g \) by subtracting 3 from the output values of \( f \). For example, we know (from Table \( \PageIndex{ 2 } \)) that \( f(2) = 1 \), and we were given \( g(x) = f(x) - 3 \). Therefore,\[ \begin{array}{rcl}
g(2) & = & f(2)−3 \\[6pt]
& = & 1−3 \\[6pt]
& = & −2 \\[6pt]
\end{array} \nonumber \]Subtracting 3 from each \( f( x ) \) value, we can complete a table of values for \( g( x ) \) as shown in Table \( \PageIndex{ 3 } \).Table \( \PageIndex{ 3 } \) \( x \) 2 4 6 8 \( f(x) \) 1 3 7 11 \( g(x) \) −2 0 4 8
As with Example \( \PageIndex{ 1 } \), the input values in Example \( \PageIndex{ 2 } \) stay the same and only the output values change.
The function \( h(t)=−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(t) \) to \( h(t) \), and then find a formula for \( b(t) \).
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 , shown in Figure \( \PageIndex{ 5 } \).
Figure \( \PageIndex{ 5 } \): Horizontal shift of the function \( f(x)= x^3 \). Note that \( (x+1) \) means \( h=-1 \) which shifts the graph to the left, that is, towards negative values of \( x \).
For example, if \( f(x)= x^2 \), then \( g(x)= (x−2)^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 \).
Given a function \( f \), a new function \( g( x )=f( x−h ) \), 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.
Returning to our building airflow example from Figure \( \PageIndex{ 3 } \), 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.
- Solution
-
We can set \( V( t ) \) to be the original program and \( F( t ) \) to be the revised program.\[ \begin{array}{rcl}
V( t ) & = & \text{the original venting plan} \\[6pt]
F( t ) & = & \text{starting 2 hours sooner} \\[6pt]
\end{array} \nonumber \]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(8)=F(6) \) (see Figure \( \PageIndex{ 6 } \)). 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}^2 \) at 8 a.m., so \( V(10)=F(8) \).In both cases, we see that, because \( F( t ) \) starts 2 hours sooner, \( h=−2 \). That means that the same output values are reached when \( F(t)=V(t−( −2 ))=V( t+2 ) \).
Figure \( \PageIndex{ 6 } \)
It is important to note that, in Example \( \PageIndex{ 3 } \), \( V(t+2) \) 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( t ) \) uses the same outputs as \( V( t ) \), but matches those outputs to inputs 2 hours earlier than those of \( V( t ) \). Said another way, we must add 2 hours to the input of \( V \) to find the corresponding output for \( F(t)=V(t+2) \).
A function \( f(x) \) is given in Table \( \PageIndex{ 4 } \). Create a table for the function \( g(x)=f(x−3) \).
| \( x \) | 2 | 4 | 6 | 8 |
| \( f(x) \) | 1 | 3 | 7 | 11 |
- Solution
-
The formula \( g(x)=f(x−3) \) tells us that the output values of \( g \) are the same as the output value of \( f \) when the input value is 3 less than the original value. For example, we know that \( f(2)=1 \). To get the same output from the function \( g \), we will need an input value that is 3 larger . We input a value that is 3 larger for \( g(x) \) because the function takes 3 away before evaluating the function \( f \).\[ \begin{array}{rcl}
g(5) & = & f(5−3) \\[6pt]
& = & f(2) \\[6pt]
\end{array} \nonumber \]We continue with the other values to create Table \( \PageIndex{ 5 } \).Table \( \PageIndex{ 5 } \) \( x \) 5 7 9 11 \( x−3 x−3\) 2 4 6 8 \( f(x−3) f(x−3)\) 1 3 7 11 \( g(x) \) 1 3 7 11 The result is that the function \( g(x) \) has been shifted to the right by 3. Notice the output values for \( g(x) \) remain the same as the output values for \( f(x) \), but the corresponding input values, \( x \), have shifted to the right by 3. Specifically, 2 shifted to 5, 4 shifted to 7, 6 shifted to 9, and 8 shifted to 11.
Figure \( \PageIndex{ 7 } \) represents both of the functions. We can see the horizontal shift in each point.
Figure \( \PageIndex{ 7 } \)
Figure \( \PageIndex{ 8 } \) represents a transformation of the toolkit function \( f(x)= x^2 \). Relate this new function \( g(x) \) to \( f(x) \), and then find a formula for \( g(x) \).
Figure \( \PageIndex{ 8 } \)
- Solution
-
Notice that the graph is identical in shape to the \( f(x)= 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(x)=f(x−2) g(x)=f(x−2) \nonumber \]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(x) \) function to write a formula for \( g(x) \) by evaluating \( f(x−2) \). That is, since \( f(x) = x^2 \), \( g(x) = f(x - 2) \). Therefore,\[ g(x) = f(x−2) = (x−2)^2 \nonumber \]
In Example \( \PageIndex{ 5 } \), 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(0)=0 \). In our shifted function, \( g(2)=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(2)=f(x−2)=f(0)=0 \). For this to work, we will need to subtract 2 units from our input values.
The function \( G(m) \) gives the number of gallons of gas required to drive \( m \) miles. Interpret \( G(m)+10 \) and \( G(m+10) \).
- Solution
-
\( G(m)+10 \) can be interpreted as adding 10 to the output, gallons. This is the gas required to drive \( m \) miles, plus another 10 gallons of gas. The graph would indicate a vertical shift.
\( G(m+10) \) can be interpreted as adding 10 to the input, miles. So this is the number of gallons of gas required to drive 10 miles more than \( m \) miles. The graph would indicate a horizontal shift.
Given the function \( f(x)=\sqrt{ x } \), graph the original function \( f(x) \) and the transformation \( g(x)=f(x+2) \) on the same axes. Is this a horizontal or a vertical shift? Which way is the graph shifted and by how many units?
Combining Vertical and Horizontal Shifts
Now that we have two transformations, we can combine them together. Vertical shifts are outside changes that affect the output \( y \)-axis values and shift the function up or down. Horizontal shifts are inside changes that affect the input \( x \)-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. Note that these shifts can be performed in either order.
Given \( f(x)=| x | \), sketch a graph of \( h(x)=f(x+1)−3 \).
- Solution
-
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(x+1) \) is a change on the inside of the function, giving a horizontal shift left by 1, and the subtraction by 3 in \( f(x+1)−3 \) is a change to the outside of the function, giving a vertical shift down by 3. The transformation of the graph is illustrated in Figure \( \PageIndex{ 9 } \).
Let us follow one point of the graph of \( f(x)=| x | \).
- The point \( (0,0) \) is transformed first by shifting left 1 unit: \( (0,0) \to (−1,0) \)
- The point \( (−1,0) \) is transformed next by shifting down 3 units: \( (−1,0) \to (−1,−3) \)
Figure \( \PageIndex{ 9 } \)Figure \( \PageIndex{ 10 } \) shows the graph of \( h \).
Figure \( \PageIndex{ 10 } \)
Given \( f(x)=| x | \), sketch a graph of \( h(x)=f(x−2)+4 \).
Write a formula for the graph shown in Figure \( \PageIndex{ 11 } \), which is a transformation of the toolkit square root function.
Figure \( \PageIndex{ 11 } \)
- Solution
-
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(x)=f(x−1)+2. \nonumber \]Using the formula for the square root function, we can write\[ h(x)=\sqrt{ x−1 } +2. \nonumber \]
Note that the transformation in Example \( \PageIndex{ 8 } \) has changed the domain and range of the function. This new graph has domain \( [1, \infty ) \) and range \( [2, \infty ) \).
Write a formula for a transformation of the toolkit reciprocal function \( f( x )= \frac{1}{x} \) that shifts the function’s graph one unit to the right and one unit up.
Graphing Functions Using Reflections about the Axes
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 \( \PageIndex{ 12 } \).
Figure \( \PageIndex{ 12 } \): 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.
Given a function \( f(x) \), a new function \( g(x)=−f(x) \) is a vertical reflection of the function \( f(x) \), sometimes called a reflection about (or over, or through) the \( x \)-axis.
Given a function \( f(x) \), a new function \( g(x)=f(−x) \) is a horizontal reflection of the function \( f(x) \), sometimes called a reflection about the \( y \)-axis.
Thus, we multiply all outputs by –1 for a vertical reflection, and we multiply all inputs by –1 for a horizontal reflection.
Reflect the graph of \( s(t)=\sqrt{ t } \) (a) vertically and (b) horizontally.
- Solution
-
-
Reflecting the graph vertically means that each output value will be reflected over the horizontal \( t \)-axis as shown in Figure \( \PageIndex{ 13 } \).
Figure \( \PageIndex{ 13 } \): Vertical reflection of the square root functionBecause each output value is the opposite of the original output value, we can write\[ V(t) = −s(t) \text{ or } V(t)=−\sqrt{ t }. \nonumber \]Notice that this is an outside change, or vertical shift, that affects the output \( s(t) \) values, so the negative sign belongs outside of the function.
-
Reflecting horizontally means that each input value will be reflected over the vertical axis as shown in Figure \( \PageIndex{ 14 } \).
Figure \( \PageIndex{ 14 } \): Horizontal reflection of the square root functionBecause each input value is the opposite of the original input value, we can write\[ H(t)=s(−t)\text{ or }H(t)=\sqrt{ −t }. \nonumber \]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.
-
Reflecting the graph vertically means that each output value will be reflected over the horizontal \( t \)-axis as shown in Figure \( \PageIndex{ 13 } \).
Note that transformations like those in Example \( \PageIndex{ 9 } \) can affect the domain and range of the functions. While the original square root function has domain \( [0, \infty ) \) and range \( [0, \infty ) \), the vertical reflection gives the \( V(t) \) function the range \( ( − \infty ,0 ] \) and the horizontal reflection gives the \( H(t) H(t)\) function the domain \( ( − \infty ,0 ] \).
Reflect the graph of \( f(x)=|x−1| \) (a) vertically and (b) horizontally.
A function \( f(x) \) is given as Table \( \PageIndex{ 6 } \). Create a table for the functions below.
- \( g(x)=−f(x) \)
- \( h(x)=f(−x) \)
| \( x \) | 2 | 4 | 6 | 8 |
| \( f(x) \) | 1 | 3 | 7 | 11 |
- Solution
-
-
For \( g(x) \), the negative sign outside the function indicates a vertical reflection, so the \( x \)-values stay the same and each output value will be the opposite of the original output value. See Table \( \PageIndex{ 7 } \).
Table \( \PageIndex{ 7 } \) \( x \) 2 4 6 8 \( g(x) \) –1 –3 –7 –11 -
For \( h(x) \), the negative sign inside the function indicates a horizontal reflection, so each input value will be the opposite of the original input value and the \( h(x) \) values stay the same as the \( f(x) \) values. See Table \( \PageIndex{ 8 } \).
Table \( \PageIndex{ 8 } \) \( x \) −2 −4 −6 −8 \( h(x) \) 1 3 7 11
-
For \( g(x) \), the negative sign outside the function indicates a vertical reflection, so the \( x \)-values stay the same and each output value will be the opposite of the original output value. See Table \( \PageIndex{ 7 } \).
A function \( f(x) \) is given as Table \( \PageIndex{ 9 } \). Create a table for the functions below.
- \( g(x)=−f(x) \)
- \( h(x)=f(−x) \)
| \( x \) | −2 | 0 | 2 | 4 |
| \( f(x) \) | 5 | 10 | 15 | 20 |
A common model for learning has an equation similar to \( k(t)= −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(t)= 2^t \) shown in Figure \( \PageIndex{ 15 } \). Sketch a graph of \( k(t)\).
Figure \( \PageIndex{ 15 } \)
- Solution
-
This equation combines three transformations into one equation.
- A horizontal reflection: \( f(−t)= 2^{−t} \)
- A vertical reflection: \( −f(−t)= −2^{−t} \)
- A vertical shift: \( −f(−t)+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)\).
- First, we apply a horizontal reflection: \((0, 1) \to (0,1)\) and \((1,2) \to (–1, 2)\).
- Then, we apply a vertical reflection: \((0,1) \to (0, −1)\) and \((-1,2) \to (-1, –2)\).
- Finally, we apply a vertical shift: \((0,-1) \to (0, 0)\) and \((-1,-2) \to (-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 Figure \( \PageIndex{ 16 } \), 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.
Figure \( \PageIndex{ 16 } \)
As a model for learning, the function in Example \( \PageIndex{ 11 } \) would be limited to a domain of \( t \geq 0 \), with corresponding range \( [0,1) \).
Given the toolkit function \( f(x)= x^2 \), graph \( g(x)=−f(x) \) and \( h(x)=f(−x) \). Take note of any surprising behavior for these functions.
Graphing Functions Using Stretches and Compressions
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 . Figure \( \PageIndex{ 17 } \) shows a function multiplied by constant factors 2 and 0.5 and the resulting vertical stretch and compression.
Figure \( \PageIndex{ 17 } \): Vertical stretch and compression
Given a function \( f(x) \), a new function \( g(x)=a \, f(x) \), where \( a \) is a constant, is a vertical stretch or vertical compression of the function \( f(x) \).
- 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.
A good summary is that, if you have a function multiplied by \( a \), you multiply all range values by \( a \).
A function \( P( t ) \) models the population of fruit flies. The graph is shown in Figure \( \PageIndex{ 18 } \).
Figure \( \PageIndex{ 18 } \)
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.
- Solution
-
Because the population is always twice as large, the new population’s output values are always twice the original function’s output values. Graphically, this is shown in Figure \( \PageIndex{ 19 } \).
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.\[ \begin{array}{rcl} ( 0,1 ) & \to & ( 0,2 ) \\[6pt] ( 3,3 ) & \to & ( 3,6 ) \\[6pt] ( 6,2 ) & \to & ( 6,4 ) \\[6pt] ( 7,0 ) & \to & ( 7,0 ) \\[6pt] \end{array} \nonumber \]
Figure \( \PageIndex{ 19 } \)Symbolically, the relationship is written as\[ Q(t)=2P(t).\nonumber \]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.
A function \( f \) is given as Table \( \PageIndex{ 10 } \). Create a table for the function \( g(x)= \frac{1}{2} f(x) \).
| \( x \) | 2 | 4 | 6 | 8 |
| \( f(x) \) | 1 | 3 | 7 | 11 |
- Solution
-
The formula \( g(x)= \frac{1}{2} f(x) \) 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(4)=3 \). Then\[ g(4)= \frac{1}{2} f(4) = \frac{1}{2} (3) = \frac{3}{2}. \nonumber \]We do the same for the other values to produce Table \( \PageIndex{ 11 } \).
Table \( \PageIndex{ 11 } \) \( x \) \( 2 2\) \( 4 4\) \( 6 6\) \( 8 8\) \( g(x) \) \( 1 2 1 2 \) \( 3 2 3 2 \) \( 7 2 7 2 \) \( 11 2 11 2 \)
The result in Example \( \PageIndex{ 13 } \) is that the function \( g(x) \) has been compressed vertically by \( \frac{1}{2} \). Each output value is divided in half, so the graph is half the original height.
A function \( f \) is given as Table \( \PageIndex{ 12 } \). Create a table for the function \( g(x)= \frac{3}{4} f(x) \).
| \( x \) | 2 | 4 | 6 | 8 |
| \( f(x) \) | 12 | 16 | 20 | 0 |
The graph in Figure \( \PageIndex{ 20 } \) is a transformation of the toolkit function \( f(x)= x^3 \). Relate this new function \( g(x) \) to \( f(x) \), and then find a formula for \( g(x) \).
Figure \( \PageIndex{ 20 } \)
- Solution
-
When trying to determine a vertical stretch or shift, it is helpful to look for a point on the graph that is relatively clear. In this graph, it appears that \( g(2)=2 \). With the basic cubic function at the same input, \( f(2)= 2^3 = 8 \). Based on that, it appears that the outputs of \( g \) are \( \frac{1}{4} \) the outputs of the function \( f \) because \( g(2)= \frac{1}{4} f(2) \). From this we can (somewhat) safely conclude that \( g(x)= \frac{1}{4} f(x) \).
We can write a formula for \( g \) by using the definition of the function \( f \).\[ g(x)= \dfrac{1}{4} f(x) = \dfrac{1}{4} x^3. \nonumber \]
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.
Figure \( \PageIndex{ 21 } \)
Given a function \( y=f(x) \), the form \( y=f(bx) \) results in a horizontal stretch or compression. Consider the function \( y= x^2 \). Observe Figure \( \PageIndex{ 21 } \). The graph of \( y = ( 0.5x )^2 \) is a horizontal stretch of the graph of the function \( y= x^2 \) by a factor of 2. The graph of \( y= ( 2x )^2 \) is a horizontal compression of the graph of the function \( y= x^2 \) by a factor of \(\frac{1}{2}\).
Given a function \( f(x) \), a new function \( g(x)=f(bx) \), where \( b \) is a constant, is a horizontal stretch or horizontal compression of the function \( f(x) \).
- 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.
In effect, we multiply all \( x \)-values by \frac{1}{b}.
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.
- Solution
-
Symbolically, we could write\[ R(1)=P(2), \nonumber \]\[R(2)=P(4), \nonumber \]\[\text{and in general,} \nonumber \]\[R(t)=P(2t). \nonumber \]See Figure \( \PageIndex{ 22 } \) for a graphical comparison of the original population and the compressed population.
Figure \( \PageIndex{ 22 } \): (a) Original population graph (b) Compressed population graph
Note that, in Example \( \PageIndex{ 15 } \), the effect on the graph is a horizontal compression where all input values are half of their original distance from the vertical axis.
A function \( f(x) \) is given as Table \( \PageIndex{ 13 } \). Create a table for the function \( g(x)=f\left( \frac{1}{2} x \right)\).
| \( x \) | 2 | 4 | 6 | 8 |
| \( f(x) \) | 1 | 3 | 7 | 11 |
- Solution
-
The formula \( g(x)=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(2) \) because \( g(2)=f\left( \frac{1}{2} \cdot 2 \right) =f(1) \), and we do not have a value for \( f(1)\) 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(4) \).\[ g(4) = f\left( \dfrac{1}{2} \cdot 4 \right) = f(2) = 1. \nonumber \]We do the same for the other values to produce Table \( \PageIndex{ 14 } \).
Table \( \PageIndex{ 14 } \) \( x \) 4 8 12 16 \( g(x) \) 1 3 7 11 Figure \( \PageIndex{ 23 } \) shows the graphs of both of these sets of points.
Figure \( \PageIndex{ 23 } \)
Because each input value has been doubled, the result in Example \( \PageIndex{ 16 } \) is that the function \( g(x) \) has been stretched horizontally by a factor of 2.
Relate the function \( g(x) \) to \( f(x) \) in Figure \( \PageIndex{ 24 } \).
Figure \( \PageIndex{ 24 } \)
- Solution
-
The graph of \( g(x) \) looks like the graph of \( f(x) \) horizontally compressed. Because \( f(x) \) ends at \( (6,4) \) and \( g(x) \) ends at \( (2,4) \), we can see that the \( x \)-values have been compressed by \( \frac{1}{3} \), because \( 6\left( \frac{1}{3} \right) = 2 \). We might also notice that \( g(2)=f( 6 ) \) and \( g(1)=f( 3 ) \). Either way, we can describe this relationship as \( g(x) = f( 3x ) \). This is a horizontal compression by \( \frac{1}{3} \).
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} \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.
Write a formula for the toolkit square root function horizontally stretched by a factor of 3.
Performing a Sequence of Transformations
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(x)+3 \), which transformation should we start with? The answer here follows nicely from the Order of Operations. Given the output value of \( f(x) \), 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(x)=f(2x+3) \), 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(7)=12\). What input to \( g \) would produce that output? In other words, what value of \( x \) will allow \( g(x)=f(2x+3)=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+ \dfrac{p}{b} \right) \right).\nonumber \]Let’s work through an example. If\[ f( x )= ( 2x+4 )^2, \nonumber \]then we can factor out a 2 to get\[ f( x )= ( 2( x+2 ) )^2. \nonumber \]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.
If given a function of the form\[ a f(bx + p) + k, \nonumber \]where you know the basic graph of \( y = f(x) \), you begin by factoring \( b \) from the argument \( bx + p \) to get \( b \left( x + \frac{p}{b} \right) \). Therefore, your function should be of the form\[ a f(bx + p) + k = af\left( b\left( x + \dfrac{p}{b} \right) \right) + k. \nonumber \]You then perform the transformations in the order written - from left to right.
If your original function is not in the form \( a f(bx + p) + k \), then you will have to "precondition" the function using arithmetic. For example,\[ g(x) = -2 - \dfrac{1}{3} f\left( 7x - 8 \right) = -\dfrac{1}{3} f\left( 7x - 8 \right) - 2 = -\dfrac{1}{3} f\left( 7\left( x - \dfrac{8}{7} \right) \right) - 2. \nonumber \]
Given Table \( \PageIndex{ 15 } \) for the function \( f(x) \), create a table of values for the function \( g(x)=2f(3x)+1 \).
| \( x \) | 6 | 12 | 18 | 24 |
| \( f(x) \) | 10 | 14 | 15 | 17 |
- Solution
-
Using the advice given previously, we make sure the function is written in the form\[ a f(bx + p) + k. \nonumber \]In this case, we were given \( g(x)=2f(3x)+1 \), which is already in this form. We then start applying the transformations by reading from left to right.
We start with the vertical stretch, which will multiply the output values by 2. Table \( \PageIndex{ 16 } \).
Table \( \PageIndex{ 16 } \) \( x \) 6 12 18 24 \( 2f(x) 2f(x)\) 20 28 30 34 We then move to the right in the function \( g(x)=2f(3x)+1 \) and deal with the 3. This causes a horizontal compression by \( \frac{1}{3}\), which means we multiply each \( x \)-value by \( \frac{1}{3} \). We apply these transformations to the \( x \)-values from Table \( \PageIndex{ 16 } \) to arrive at Table \( \PageIndex{ 17 } \).
Table \( \PageIndex{ 17 } \) \( x \) 2 4 6 8 \( 2f(3x)\) 20 28 30 34 Finally, we can apply the vertical shift, which will add 1 to all the output values. See Table \( \PageIndex{ 18 } \).
Table \( \PageIndex{ 18 } \) \( x \) 2 4 6 8 \( g(x)=2f(3x)+1\) 21 29 31 35
Sketch a graph of the function\[ f(x) = -4 -\dfrac{1}{2} \sqrt{12 -3x}. \nonumber \]
- Solution
-
The function given to us needs to be rewritten in the form \( a f(bx + p) + k = af\left( b\left( x + \frac{p}{b} \right) \right) + k \). Let's start by simply rearranging terms.\[ f(x) = -4 -\dfrac{1}{2} \sqrt{12 -3x} = -\dfrac{1}{2} \sqrt{-3x + 12} - 4 \nonumber \]We now take the time to factor the lead coefficient from both terms inside the function.\[ f(x) = -\dfrac{1}{2} \sqrt{-3 \left( x - 4 \right)} - 4. \nonumber \]The parent function is \( y = \sqrt{x} \). It's best to label two "anchor" points (which will almost always be \( \left( 0,0 \right) \) and \( \left( 1,1 \right) \) for the Toolkit functions).
Reading our "cleaned" function from left to right, the coefficient \( -\frac{1}{2} \) reflects the graph of \( y = \sqrt{x} \) vertically about the \( x \)-axis and compresses it vertically (squishing towards the \( x \)-axis) by a factor of \( \frac{1}{2} \). Another way to think of this is that all of the \( y \)-values on the graph of \( y = \sqrt{x} \) are multiplied by \( -\frac{1}{2} \).
Continuing reading from left to right, we have the factor of \( -3 \) on the inside of the function. Remember, anything on the inside of the function affects the \( x \)-values (and in an opposite way from how they affect the outside of the function). Specifically, the factor of \( -3 \) reflects the graph of \( y = -\frac{1}{2} \sqrt{x} \) about the \( y \)-axis and compresses the graph horizontally (squishing it) towards the \( y \)-axis by a factor of \( \frac{1}{3} \). Another way to think of this is that the factor \( -3 \) divides all of the \( x \)-values on the graph of \( y = -\frac{1}{2}\sqrt{x} \) by \( -3 \).
Continuing reading our original function from left to right, we have \( (x - 4) \) on the inside of the function. This causes a shift of \( 4 \) units horizontally to the right for the graph of \( y = -\frac{1}{2} \sqrt{3x} \). Another way to think of this is that we add \( 4 \) units to each of the \( x \)-values.
Finally, we have the subtraction of \( 4 \) with which to contend. This subtract occurs outside the function (the square root), so it shifts the graph of \( y = -\frac{1}{2} \sqrt{3(x - 4)} \) vertically down \( 4 \) units. Our final graph is given below.
Use the graph of \( f( x ) \) in Figure \( \PageIndex{ 25 } \) to sketch a graph of \( k(x)=f\left( \frac{1}{2} x+1 \right)−3 \).
Figure \( \PageIndex{ 25 } \)
- Solution
-
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} (x+2) \right)−3 . \nonumber \]Reading from left to right, we 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) \). See Figure \( \PageIndex{ 26 } \).
Figure \( \PageIndex{ 26 } \)Next, we horizontally shift left by 2 units, as indicated by \( x+2 \). See Figure \( \PageIndex{ 27 } \).
Figure \( \PageIndex{ 27 } \)Last, we vertically shift down by 3 to complete our sketch, as indicated by the \( −3 \) on the outside of the function. See Figure \( \PageIndex{ 28 } \).
Figure \( 28 \)
Access this online resource for additional instruction and practice with transformation of functions.