Sub topic 6
Stretching and Compressing Horizontally
Assume you know function notation, can evaluate a function, and can plot points on a coordinate plane. You should also know the basic graphs of functions such as \(x^2\), \(|x|\), and \(\sqrt{x}\).
A horizontal transformation changes the input of a function. The basic form is
\[ g(x)=f(bx). \]
The number \(b\) controls the horizontal scale. Because \(b\) multiplies the input, its effect appears opposite to what its value might first suggest.
Horizontal compression
Suppose \(b>1\). Then
\[ g(x)=f(bx) \]
is a horizontal compression by a factor of \(1/b\). Every \(x\)-coordinate becomes \(1/b\) as large.
For example, let \(f(x)=x^2\). Then
\[ g(x)=f(2x)=(2x)^2=4x^2. \]
Although the equation simplifies to a vertical-looking expression, the transformation began as a horizontal compression. The point \((2,4)\) on \(y=x^2\) moves to
\[ \left(\frac{2}{2},4\right)=(1,4). \]
Likewise, \((-2,4)\) moves to \((-1,4)\). The graph becomes narrower.
Horizontal stretch
Suppose \(0<b<1\). Then
\[ g(x)=f(bx) \]
is a horizontal stretch by a factor of \(1/b\).
For instance,
\[ g(x)=f\left(\frac{x}{2}\right) \]
uses \(b=\frac12\), so the graph stretches horizontally by
\[ \frac{1}{b}=\frac{1}{1/2}=2. \]
The point \((2,4)\) moves to
\[ \left(\frac{2}{1/2},4\right)=(4,4). \]
The graph becomes wider.
| Function | Value of \(b\) | Horizontal effect |
|---|---|---|
| \(f(3x)\) | \(3\) | Compression by \(1/3\) |
| \(f(x/2)\) | \(1/2\) | Stretch by \(2\) |
| \(f(0.25x)\) | \(0.25\) | Stretch by \(4\) |
Mapping points and domains
If \((x,y)\) lies on \(y=f(x)\), then the corresponding point on \(y=f(bx)\) is
\[ (x,y)\longrightarrow\left(\frac{x}{b},y\right). \]
The \(y\)-coordinate stays unchanged because the output has not been multiplied or shifted.
Consider \(f(x)=\sqrt{x}\), whose domain is \(x\ge 0\). For
\[ g(x)=f(2x)=\sqrt{2x}, \]
the domain condition is \(2x\ge0\), which gives \(x\ge0\). The endpoint remains at \(x=0\), while points farther from the endpoint move closer.
For a function with a restricted domain, substitute \(bx\) into the original domain condition. This method avoids guessing.
def horizontal_transform(f, b):
"""Return g(x) = f(b*x)."""
return lambda x: f(b * x)
f = lambda x: x ** 2
compressed = horizontal_transform(f, 2)
stretched = horizontal_transform(f, 0.5)
print(compressed(1)) # 4, because f(2) = 4
print(stretched(4)) # 4, because f(2) = 4Negative input factors
If \(b<0\), the transformation includes a reflection across the \(y\)-axis. For example,
\[ g(x)=f(-2x) \]
first compresses horizontally by \(1/2\), then reflects across the \(y\)-axis. If the original graph is symmetric about the \(y\)-axis, the reflection may not change its appearance.
The complete form
\[ g(x)=a f(bx) \]
uses \(b\) for horizontal scaling and \(a\) for vertical scaling. Keep the two factors separate: \(b\) changes the input and acts horizontally, while \(a\) changes the output and acts vertically.
Exercise
The graph of f contains the point (6, -3). Where does this point move on g(x) = f(3x)?
Show answer
It moves to (2, -3), because x is divided by b = 3 and y stays the same.