In the next example, we will graph a function of the form \(y=af(bx)\), that is, a graph where we need to apply both a horizontal stretch or compression, and a vertical stretch or compression.
Example 9
The graph of \(f(x)\) is shown. Sketch the graph of \(g(x)=3f\left(\dfrac12x\right)\).
Solution

\(g(x)=af(bx)\), with \(a=3\) and \(b=\dfrac12\).
Remember that \(a=3\) represents a vertical stretch by a factor of \(3\).
\(b=\dfrac12\) represents a horizontal stretch by a factor of \(2\).
It is possible to apply these transformations separately, or both at the same time.
Each point needs to be moved so that it is three times farther from the \(x\)-axis and \(\)two times farther from the \(y\)-axis.
For the point \((-2, -1)\),
- the \(x\)-coordinate will change from \(-2\) to \(-4\) (twice as far from the \(y\)-axis)
- the \(y\)-coordinate will change from \(-1\) to \(-3\) (three times as far from the \(x\)-axis)
So the point \((-2, -1)\) becomes \((-4, -3)\).
Similar calculations can be made for the other points:
- The point \((0, 2)\) becomes \((0, 6)\)
- The point \((3, 2)\) becomes \((6, 6)\)
- The point \((6, -4)\) becomes \((12, -12)\)
Sketch and join these four points to form the graph of \(g(x)=3f\left(\dfrac12x\right)\).

Alternate Solution:
This thinking can also be organized using a table.
Enter the \(x\)-coordinates of key points on the original graph as inputs; i.e., as \(\dfrac12x\).
Enter the \(y\)-coordinates of these same key points as outputs; i.e., as \(f\left(\dfrac12x\right)\).
| \(x\) |
\(\dfrac12x\) |
\(f\left(\dfrac12x\right)\) |
\(y=3f\left(\dfrac12x\right)\) |
| |
\(-2\) |
\(-1\) |
|
| |
\(0\) |
\(2\) |
|
| |
\(3\) |
\(2\) |
|
| |
\(6\) |
\(-4\) |
|
Calculate the values of \(x\) using the values of \(\dfrac12x\).
Then, calculate the values of \(y=3f\left(\dfrac12x\right)\) using the values of \(f\left(\dfrac12x\right)\).
| \(x\) |
\(\dfrac12x\) |
\(f\left(\dfrac12x\right)\) |
\(y=3f\left(\dfrac12x\right)\) |
| \(-4\) |
\(-2\) |
\(-1\) |
\(-3\) |
| \(0\) |
\(0\) |
\(2\) |
\(6\) |
| \(6\) |
\(3\) |
\(2\) |
\(6\) |
| \(12\) |
\(6\) |
\(-4\) |
\(-12\) |
The shaded columns represent the coordinates of key points on the graph of \(y=3f\left(\dfrac12x\right)\).