Graphing Functions Using Stretches and Compressions

The last set of transformations you will explore on the graphs of functions are stretches and compressions. You will find out how the equation of a function changes when you stretch the graph in the x-direction or the y-direction.

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 19 shows a function multiplied by constant factors 2 and 0.5 and the resulting vertical stretch and compression.


Figure 19 Vertical stretch and compression


VERTICAL STRETCHES AND COMPRESSIONS

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.


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 13

Graphing a Vertical Stretch

A function P(t) models the population of fruit flies. The graph is shown in Figure 20.


Figure 20

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

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}{ll} (0, 1) &\rightarrow (0, 2) \\ (3,3) &\rightarrow (3,6) \\ (6,2) &\rightarrow(6,4) \\ (7,0) &\rightarrow (7, 0) \end{array}


Figure 21


Symbolically, the relationship is written as

Q(t)=2 P(t)

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 14

Finding a Vertical Compression of a Tabular Function

A function f is given as Table 10. Create a table for the function g(x)=\dfrac{1}{2} f(x).

x 2 4 6 8
f(x) 1 3 7 11

Table 10


Solution

The formula g(x)=\dfrac{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)=\dfrac{1}{2} f(4)=\dfrac{1}{2}(3)=\dfrac{3}{2}

We do the same for the other values to produce Table 11.

x 2 4 6 8
g(x) \dfrac{1}{2} \dfrac{3}{2} \dfrac{7}{2} \dfrac{11}{2}
Table 11
 
Analysis
The result is that the function g(x) has been compressed vertically by \dfrac{1}{2}. Each output value is divided in half, so the graph is half the original height.


TRY IT #9

A function f is given as Table 12. Create a table for the function g(x)=\dfrac{3}{4} f(x).
x 2 4 6 8
f(x) 12 16 20 0
Table 12

EXAMPLE 15

Recognizing a Vertical Stretch
The graph in Figure 22 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 22
 

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 \dfrac{1}{4} the outputs of the function f because g(2)=\dfrac{1}{4} f(2). From this we can fairly safely conclude that g(x)=\dfrac{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}

TRY IT #10

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 23

Given a function y=f(x), the form y=f(b x) results in a horizontal stretch or compression. Consider the function y=x^{2}. Observe Figure 23. The graph of y=(0.5 x)^{2} is a horizontal stretch of the graph of the function y=x^{2} by a factor of 2. The graph of y=(2 x)^{2} is a horizontal compression of the graph of the function y=x^{2} by a factor of \dfrac{1}{2}.


HORIZONTAL STRETCHES AND COMPRESSIONS

Given a function f(x), a new function g(x)=f(b x), 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 \dfrac{1}{b}.
  • If 0 < b < 1, then the graph will be stretched by \dfrac{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(x)=f(b x) where b > 1 for a compression or 0 < b < 1 for a stretch.


EXAMPLE 16

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.


Solution

Symbolically, we could write


             \begin{aligned}
             R(1) &=P(2) \\
             R(2) &=P(4), \quad \text { and in general } \\
             R(t) &=P(2 t)
             \end{aligned}

See Figure 24 for a graphical comparison of the original population and the compressed population.


Figure 24 (a) Original population graph (b) Compressed population graph


Analysis

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 17

Finding a Horizontal Stretch for a Tabular Function

A function f(x) is given as Table 13. Create a table for the function g(x)=f\left(\dfrac{1}{2} x\right).

x 2 4 6 8
f(x) 1 3 7 11

Table 13

Solution

The formula g(x)=f\left(\dfrac{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(\dfrac{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

We do the same for the other values to produce Table 14.

x 4 8 12 16
g(x) 1 3 7 11

Table 14


Figure 25 shows the graphs of both of these sets of points.

Figure 25


Analysis

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


EXAMPLE 18

Recognizing a Horizontal Compression on a Graph

Relate the function g(x) to f(x) in Figure 26.


Figure 26


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 \dfrac{1}{3}, because 6\left(\dfrac{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(3 x). This is a horizontal compression by \dfrac{1}{3}.


Analysis

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 \dfrac{1}{4} in our function: f\left(\dfrac{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 #11

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




Source: Rice University, https://openstax.org/books/college-algebra/pages/3-5-transformation-of-functions
Creative Commons License This work is licensed under a Creative Commons Attribution 4.0 License.