# Visualizing Graph Transformations

It's often possible to know very specific details about the graph of an arbitrary function without physically having to graph it. In particular, recognizing various functions to be transformed versions of miscellaneous classes of functions means that information about infinitely many graphs can be known simply by recognizing correlations to other, simpler functions. This worksheet examines various transformations.

## Vertical and Horizontal Shifts

Perhaps the most intuitive class of graph transofmrations is that of vertical and horizontal shifting. For example, given the graph of a function `y = f(x)` and a constant `c > 0`, the graph of `y = f(x) + c` (respectively, `y = f(x) - c`) simply takes the output values of `f` (i.e., the `y`-coordinates of the graph of `f`) and and moves them `c` units upward (respectively, downward). Therefore, the graph of the function `g(x) = f(x) +- c` represents a vertical shift of the graph of `f`. Similarly, if `h(x) = f(x - c)` and `c > 0`, the graph of `h` at `x` is the same as the graph of `f` at `x - c`, which lies `c` units to the left of `x`. Therefore, the graph `y = f(x - c)`(respectively, `y = f(x + c)`) is nothing more than the graph `y = f(x)` shifted `c` units to the left (respectively, to the right); that is, functions of the form `f(x +- c)` have graphs corresponding to a horizontal shift of the graph `y = f(x)`. The following applet illustrates this idea.

Applet 1 shows the graph of a function `f(x)` (in red), along with options to see vertical and horizontal shifts by `c = 3` units. Use the form below the applet to input other functions (using the syntax "f(x)=*insert function here*") or other values of `c` (using the syntax "c=*insert constant value here*"). Note that the heuristic definitions of shifts used above assume that `c > 0` is always satisfied; what does the applet indicate for values of `c` satisfying `c < 0`?

Enter a function `f(x)` and a constant `c` and click "Submit"

## Reflections

In much the same way that adding/substracting values of `c > 0` can yield predictable transformations of a given graph, multiplying by a constant `c` can as well. The most straightforward type of multiplicative transformation comes when `c = -1`.

Given a function `f(x)`, the graph of `y = -f(x)` is obtained from the graph of `y = f(x)` by making all corresponding `y`-values negative. Hence, the graph of `y = -f(x)` represents a reflection about the `x`-axis of `y = f(x)`. Similarly, `y = f(-x)` represents a graph whose negative `x`-coordinates have the same `y`-values as the positive `x`-coordinates of the graph `y = f(x)`, i.e., `y = f(-x)` represents a reflection about the `y`-axis of `y = f(x)`. The following applets illustrate these reflections.

Applets 2 and 3 show the graph of a function `f(x)` (in teal), along with reflections of `f` about both the `x`- and `y`-axes (respectively). Use the form below these applets to input other functions (using the syntax "f(x)=*insert function here*")

Enter a function `f(x)` and click "Submit"

## Vertical and Horizontal Stretching and Compressing

Given a function `f`, multiplication by values of `c` other than `+- 1` results in graphs of functions that are stretched or compressed (depending on the magnitude of `c`). Because the transformations in question depend on the magnitude of `c`, two differing (though equivalent) standpoints can be taken: One is to define and analyze the stretching / compressing under the assumption that `|c| > 1`; the other is to allow `c` to be any constant greater than zero1 and to define and analyze the resulting transformations. Both standpoints will be addressed.

If given a function `g(x) = c*f(x)`, it's obvious that the `y`-values of the graph of `g` are directly proportional to the `y`-values of the graph of `f`; furthermore, if `|c| > 1` (respectively, `|c| < 1`), the `y`-values of `g` are obtained by stretching (respectively, compressing) the `y`-values of `f` by a factor of `c` (respectively, `1/c`). Hence, the graph of `y = c*f(x)` represents vertical stretching / compressing of the graph of `f(x)`. Equivalently, one can say that, for values `c` satisfying `|c| > 1`, the graph of `y = c*f(x)` is a vertical stretch of the graph of `f` by a factor of `c`, while the graph of `y = 1/c f(x)` is a vertical compression of the graph of `f` (as `|c| > 1` implies that `| 1/c | < 1`) by a factor of `c` (not  `1/c`, as above).

Similarly, `y`-values of a function `h(x) = f(c*x)` are the same for `x = c*x_0` as the `y`-values of the function `f` at `x = x_0`. In particular, when `|c| > 1` (respectively, `|c| < 1`), the function `h` is obtained by compressing (respectively, stretching) the function `f` in the `x`-direction by a factor of `c` (respectively, `1/c`). Hence, the graph of `y = f(c*x)` represents a horizontal stretching/compressing of the graph of `f(x)`. Equivalently, one can say that, for values `c` satisfying `|c| > 1`, the graph of `y = f(c*x)` is a horizontal compression of the graph of `f` by a factor of `c`, while the graph of `y = f( x/c )` is a horizontal stretch of the graph of `f` by a factor of `c` (not  `1/c`, as above).

Applets 4 and 5 show the graph of a function `f(x)` (in purple), along with options to see vertical and horizontal stretches and compressions by `c = 2` units. Use the form below the applet to input other functions (using the syntax "f(x)=*insert function here*") or other values of `c` (using the syntax "c=*insert constant value here*"). It's worth noting that all values `c` are allowed, not just those satisfying `|c| > 1`. Use these applets to toggle different function views in light of different values of `c`. Can you figure out which `c`-values correspond to stretches and which correspond to compressions? Given your chosen value of `c`, can you find the factor by which the function `f` is stretched compressed?

Enter a function `f(x)` and a constant `c` and click "Submit"

Beware:
• Differentiating between stretches and compressions are often difficult, especially horizontal ones. One way to keep it clear is to consider how `f(x)` compares to `g(x) = f(3x)` and `h(x) = f(1/3 x)`: In particular, the `y`-values of `g` are the same at `3x` as the `y`-values of `f` are at `x`. That means that the functions will be identical if `3x` (which is larger than `x` for `x > 0`) is *shrank down* to `x` (i.e., if the horizontal direction is compressed). Similarly, the `h` and `f` will be the same if `1/3 x` (which is smaller than `x` for `x > 0`) is *enlarged* to `x` (i.e., if the horizontal direction is stretched).
• Understanding the factor by which a graph is stretched can be tricky, especially when toggling between values of `c` satisfying `|c| > 1` and `|c| < 1`, etc. Some authors "remedy" this by limiting their discussion to values `|c| > 1` (whereby they define `f(cx)` and `f(x/c)`, etc.), though doing so isn't necessary. Just remember: The factor of a stretch/compression is always a number bigger than 1. Therefore, the function `k(x) = 0.2*f(x)` is a vertical compression of of the function `f`, and because the factor must be bigger than 1, it can't be 0.2 and must instead be `1/0.2 = 5`.

## Conclusion

The following table summarizes the graph transformations discussed in this worksheet.

 Vertical and Horizontal Shifts    Suppose `c > 0`. To obtain the graph of `y = f(x) + c`, shift the graph of `y = f(x)` a distance of `c` units upward `y = f(x) - c`, shift the graph of `y = f(x)` a distance of `c` units downward `y = f(x - c)`, shift the graph of `y = f(x)` a distance of `c` units to the right `y = f(x + c)`, shift the graph of `y = f(x)` a distance of `c` units to the left Reflections    To obtain the graph of `y = -f(x)`, reflect the graph of `y = f(x)` about the `x`-axis `y = f(-x)`, reflect the graph of `y = f(x)` about the `y`-axis Vertical and Horizontal Stretching /Compressing   Let `c` be any constant greater than 01. To obtain the graph of `y = c*f(x)`, stretch the graph of `y = f(x)` vertically by a factor of `c` if `c > 1` or compress the graph of `y = f(x)` vertically by a factor of `1/c` otherwise. `y = 1/c *f(x)`, compress the graph of `y = f(x)` vertically by a factor of `c` if `c > 1` or stretch the graph of `y = f(x)` vertically by a factor of `1/c` otherwise `y = f(c*x)`, compress the graph of `y = f(x)` horizontally by a factor of `c` if `c > 1` or stretch the graph of `y = f(x)` horizontally by a factor of `1/c` otherwise `y = f( x/c )`, stretch the graph of `y = f(x)` horizontally by a factor of `c` if `c > 1` or compress the graph of `y = f(x)` horizontally by a factor of `1/c` otherwise

 1 The assumption that `c > 0` is strictly topical. That is to say, the analysis is identical for `c < 0` in the following sense: If `c < 0`, then there will be two transformations happening simultaneously, one of which is a reflection and the other a stretching / compressing with coefficient `|c| > 0`. Note: The typesetting on this page is done through utilization of the SimpleMath.js script, which was borrowed with permission from Dr. Marc Renault's Geogebra Calculus Applets webspace. I did not write this script: Dr. Renault wrote this script and as such, the rights and credits for it belong solely to Dr. Renault.

Chris Stover, Created with GeoGebra