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

Study Guides > College Algebra

Compressions and Stretches

Learning Objectives

  • 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.
Graph of a function that shows vertical stretching and compression. Vertical stretch and compression

A General Note: Vertical Stretches and Compressions

Given a function f(x)f\left(x\right), a new function g(x)=af(x)g\left(x\right)=af\left(x\right), where aa is a constant, is a vertical stretch or vertical compression of the function f(x)f\left(x\right).
  • If a>1a>1, then the graph will be stretched.
  • If 0 < a < 1, then the graph will be compressed.
  • If a<0a<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 aa.
  2. Multiply all range values by aa.
  3. If a>1a>1, the graph is stretched by a factor of aa. If 0<a<1{ 0 }<{ a }<{ 1 }, the graph is compressed by a factor of aa. If a<0a<0, the graph is either stretched or compressed and also reflected about the x-axis.

Example: Graphing a Vertical Stretch

A function P(t)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, QQ, whose growth follows the same pattern, but is twice as large. Sketch a graph of this population. Graph to represent the growth of the population of fruit flies.

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. {(0, 1)(0, 2)(3, 3)(3, 6)(6, 2)(6, 4)(7, 0)(7, 0)\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}

Graph of the population function doubled. Figure 16
Symbolically, the relationship is written as Q(t)=2P(t)Q\left(t\right)=2P\left(t\right) This means that for any input tt, the value of the function QQ is twice the value of the function PP. 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, tt, 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 aa.
  2. Multiply all of the output values by aa.

Example: Finding a Vertical Compression of a Tabular Function

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

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

xx 22 44 66 88
g(x)g\left(x\right) 12\frac{1}{2} 32\frac{3}{2} 72\frac{7}{2} 112\frac{11}{2}

Analysis of the Solution

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

Try It

A function ff is given below. Create a table for the function g(x)=34f(x)g\left(x\right)=\frac{3}{4}f\left(x\right).
xx 2 4 6 8
f(x)f\left(x\right) 12 16 20 0

Answer:

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

Horizontal Stretches and Compressions

Graph of the vertical stretch and compression of x^2. 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(x)y=f\left(x\right), the form y=f(bx)y=f\left(bx\right) results in a horizontal stretch or compression. Consider the function y=x2y={x}^{2}. The graph of y=(0.5x)2y={\left(0.5x\right)}^{2} is a horizontal stretch of the graph of the function y=x2y={x}^{2} by a factor of 2. The graph of y=(2x)2y={\left(2x\right)}^{2} is a horizontal compression of the graph of the function y=x2y={x}^{2} by a factor of 2.

A General Note: Horizontal Stretches and Compressions

Given a function f(x)f\left(x\right), a new function g(x)=f(bx)g\left(x\right)=f\left(bx\right), where bb is a constant, is a horizontal stretch or horizontal compression of the function f(x)f\left(x\right).
  • If b>1b>1, then the graph will be compressed by 1b\frac{1}{b}.
  • If 0<b<10<b<1, then the graph will be stretched by 1b\frac{1}{b}.
  • If b<0b<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(bx)g\left(x\right)=f\left(bx\right) where b>1b>1 for a compression or 0<b<10<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, RR, 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

{R(1)=P(2),R(2)=P(4), and in general,R(t)=P(2t).\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.
Two side-by-side graphs. The first graph has function for original population whose domain is [0,7] and range is [0,3]. The maximum value occurs at (3,3). The second graph has the same shape as the first except it is half as wide. It is a graph of transformed population, with a domain of [0, 3.5] and a range of [0,3]. The maximum occurs at (1.5, 3). (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(x)f\left(x\right) is given below. Create a table for the function g(x)=f(12x)g\left(x\right)=f\left(\frac{1}{2}x\right).
xx 2 4 6 8
f(x)f\left(x\right) 1 3 7 11

Answer: The formula g(x)=f(12x)g\left(x\right)=f\left(\frac{1}{2}x\right) tells us that the output values for gg are the same as the output values for the function ff at an input half the size. Notice that we do not have enough information to determine g(2)g\left(2\right) because g(2)=f(122)=f(1)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(1)f\left(1\right) in our table. Our input values to gg will need to be twice as large to get inputs for ff that we can evaluate. For example, we can determine g(4).g\left(4\right)\text{.}

g(4)=f(124)=f(2)=1g\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.
xx 4 8 12 16
g(x)g\left(x\right) 1 3 7 11
Graph of the previous table. 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(x)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(x)g\left(x\right) to f(x)f\left(x\right). Graph of f(x) being vertically compressed to g(x).

Answer: The graph of g(x)g\left(x\right) looks like the graph of f(x)f\left(x\right) horizontally compressed. Because f(x)f\left(x\right) ends at (6,4)\left(6,4\right) and g(x)g\left(x\right) ends at (2,4)\left(2,4\right), we can see that the x-x\text{-} values have been compressed by 13\frac{1}{3}, because 6(13)=26\left(\frac{1}{3}\right)=2. We might also notice that g(2)=f(6)g\left(2\right)=f\left(6\right) and g(1)=f(3)g\left(1\right)=f\left(3\right). Either way, we can describe this relationship as g(x)=f(3x)g\left(x\right)=f\left(3x\right). This is a horizontal compression by 13\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 14\frac{1}{4} in our function: f(14x)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. Use Desmos to check your work.

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

Licenses & Attributions