Analog Computers

Reference / Paper

Stretches and Shifts

Read the PDF (3 pp) ↗

A three-page lecture note covering the transformation of functions by vertical and horizontal stretching (scaling) and vertical and horizontal shifting. The document defines each transformation algebraically, illustrates the effects on sine and polynomial examples, and derives the corresponding differentiation rules (constant multiple rule for vertical stretches, chain-rule precursor for horizontal stretches, sum rule for vertical shifts, and substitution rule for horizontal shifts).

Manufacturer
Math
Type
Reference / Paper
Language
English
Learning track
general theory
Pages
3
  • Math
  • function transformations
  • vertical and horizontal stretches
  • vertical and horizontal shifts
  • differentiation rules

← Back to the Reference Library

Stretches and Shifts

Stretches and Shifts Vertical Stretches of Functions In this lecture, we continue our theme of building new functions from functions that we already know. Today we talk about the process of stretching and shifting functions. By stretching a function, we mean that we take a function f (x) and we find a function g(x) such that the graph of g(x) is different from the graph of f (x) only in the sense that g(x) is a stretched (or compressed, or inverted) version of the graph of f (x). We begin by discussing vertical stretching. We say that g(x) is a vertical stretch of f (x) if g(x) = af (x) for some real number a. If a > 0, then the graph of g(x) will be a times as wide vertically as the graph of f (x). If a < 0, then the graph of f (x) will be a times as wide vertically as the graph of f (x), and it will inverted: that is, the graph of g(x) will be flipped along the x-axis relative to the graph of f (x). If a = 0, then g(x) is the constant function 0, which is technically a stretch of any function, but we will not consider it here. For example, take the graph of f (x) = sin x. We know that the range of sin x is −1 ≤ y ≤ 1, and that at x = 0, sin x is an increasing function (use the derivative to show this). Now consider the graph of g(x) = 2 sin x. We know that sin x has a maximum value of 1, so g(x) must have a maximum value of 2. Likewise, sin x has a minimum value of −1, so g(x) has a minimum value of −2. So the range of g(x) is −2 ≤ y ≤ 2. If we plot g(x), we see a graph very similar to that of sin x, but stretched vertically by a factor of 2. Notice, too, that g(x) is still an increasing function at x = 0. Now consider the graph of h(x) = 12 sin x. Using the same reasoning as above, the range of h(x) is 1 − 2 ≤ y ≤ 12 . When we graph h(x), we also get a graph very similar to that of sin x, but now it is compressed with respect to the graph of sin x. The factor by which it is compressed is 2, that is, the graph of h(x) is vertically stretch by a factor of 12 . We also notice that h(x) is still increasing at x = 0. The point here is that the graph of h(x) is not inverted with respect to the graph of f (x). Finally, let k(x) = − sin x. The range of k(x) is the same as that of sin x (although it is not true in general that the range of −f (x) is the same as that of f (x)). When we graph k(x), we see that its graph is not stretched or compressed in any way in comparison to the graph of f (x). We do however notice that k(x) is decreasing at x = 0, whereas f (x) is increasing at x = 0. The graph of k(x) is the mirror image of f (x) along the x-axis. To complete this section, we note that, if g(x) = af (x), that is, if g(x) is a vertical stretch of f (x) by a factor of a, then g 0 (x) = af 0 (x). This is just the constant multiple rule again, but now we have a geometric context for it. Compare the slopes of f (x), g(x), h(x), and k(x) above at x = 0 and see if the constant multiple rule is at work with sin x. Horizontal Stretches of Functions Horizontal stretches are not quite as obvious as vertical stretches. We say that a function g(x) is a horizontal stretch of a function f (x) if g(x) = f (ax) for some real number a. For example, if a = 2, we are saying that g(0) = f (2 · 0) = f (0), g(1) = f (2 · 1) = f (2), g(−3) = f (2 · (−3)) = f (−6), and so on. Were we to graph g(x) and f (x) together in the case of a = 2, we would see that the graph of g(x) is horizontally compressed with respect to the graph of f (x) by a factor of 2, because g takes the same value at x as f does at twice of x. So, while a = 2 stretches the graph of a function in the case of vertical stretching, it actually compresses the graph of a function in the case of horizontal stretching. We saw this phenomenon before when we studied generalized sine and cosine functions: the period of sin(2x) is half of the period of sin x. We now see that, in our new terminology, sin(2x) is a horizontal stretch of sin x, compressed by a factor of 2. For horizontal stretching, as a gets less and less positive, the graph of g(x) gets more and more stretched out. At a = 0, we have that g(x) = f (0 · x) = f (0), so g(x) becomes the constant function with the same vertical intercept as f (x). As a becomes negative, we see that the graph of g(x) inverts itself with respect to the graph of f (x): it is the mirror image in the y-axis of the graph of f (x), after some horizontal stretching. As a becomes more negative, the graph of g(x) compresses more and more, remaining inverted, until, at a = −1, the graph of g(x) is the exact mirror image of the graph of f (x). For more negative a, the graph of g(x) is inverted and horizontally compressed with respect to the graph of f (x). Try to picture this process at work in your mind: take the graph of your favorite function, and visualize the effect of increasing and decreasing a, and going from positive values of a to negative values of a. 1 We will now learn the rule for taking the derivative of the horizontal stretch of a function. If g(x) = f (ax), then g 0 (x) = af 0 (ax). Essentially, what we are saying here is, to find the derivative of g at x, find the derivative of f at ax, and then multiply it by a. So, for example, let g(x) = (3x)2 + 4(3x) + 3. The function g(x) is the horizontal stretch of the function f (x) = x2 + 4x + 3, because wherever we have an x in the formula for f (x), we have a 3x in the formula for g(x). According to our rule above, we take the derivative of f first: f 0 (x) = 2x + 4. Next, we find f 0 (3x) by substituting in 3x wherever we see an x in the formula for f 0 (x) : f 0 (3x) = 2 · 3x + 4 = 6x + 4. Finally, to get g 0 (x), we multiply f 0 (3x) by 3: g 0 (x) = 3f 0 (3x) = 3(6x + 4) = 18x + 12. Do we get the same formula for the derivative of g(x) if we multiply out the formula for g(x)? Yes, because g(x) = (3x)2 + 4(3x) + 3 = 9x2 + 12x + 3, so g 0 (x) = 18x + 12 by this method as well. We do not always have the luxury of being able to multiply out our formula for g(x) and take the derivative in the standard way: the case of generalized sine and cosine functions makes this clear. For example, the function g(x) = cos(−7x) is the horizontal stretch of cos x. The rule for finding the derivative of generalized sine and cosine functions is just a specific case of the rule for finding the derivative of a horizontal stretch. In this case, this rule for differentiating horizontal stretches gives us g 0 (x) = −7(− sin(7x)) = 7 sin(7x). Notice how −7 appears twice, both outside and inside the sine function. This repetition, which is at the heart of taking the derivative of horizontal stretches, is very important, and you should make sure to take note of it. It is the hallmark of an more general rule of differentiating, called the chain rule, which we will be studying in a couple of lectures. Vertical Shifts of Functions We say that one function is a shift of another if the graph of the first function is the same as the graph of the second function in all ways except that the graph of the first function is moved either horizontally or vertically with respect to the graph of the second function. By applying vertical shifts and horizontal shifts one after another, we can move the graph of a function anywhere we want in the xy-plane. We define g(x) to be a vertical shift of f (x) if g(x) = f (x) + b, where b is any real number. We have seen this phenomenon before, when we discussed constant and linear functions: if b > 0, then the graph of g(x) is shifted upward by |b| units; if b < 0, then the graph of g(x) is shifted downward by |b| units. For example, the polynomial g(x) = x7 − 4x5 − 9 is the vertical shift of the polynomial f (x) = x7 − 4x5 + 2: the graph of g(x) is shifted downward 11 units, since −9 − 2 = −11. We also know how to find the derivative of g(x) with respect to that of f (x) when g(x) is a vertical shift of f (x): if g(x) = f (x) + b, then we apply the sum rule and use the fact that the derivative of a constant function (like b) is 0 to get that g 0 (x) = f 0 (x). This should make geometric sense to you, because if we draw the graphs of two functions at an xy-plane, with one the vertical shift of the other, then we should see that at any x the slope of the tangent line to the first graph at that x is the same as to the second graph. It is not too hard to see that the tangent lines to these two graphs at any particular x are vertical shifts of each other, so it should come as no surprise that their slopes, the derivatives of the functions at that x, should be the same. 2 Horizontal Shifts of Functions We say that g(x) is the horizontal shift of the function f (x) if g(x) = f (x + b) for some real number b. Notice the parallels between shifting and stretching: for vertical stretches and shifts, all of the action happens outside of the function f (x); for horizontal stretches and shifts, it happens inside the function f (x). This is not coincidence, and you should keep this in mind for the next lecture, when we discuss the composition of two functions. In horizontal stretching, the factor a did precisely the opposite of what we would expect it to do, in the sense that when a is large and positive, the graph of f (x) compresses, while when a is small and positive, the graph of f (x) stretches. Not to be outdone, horizontal shifting also does the opposite of what one would expect: if b > 0, then the graph of g(x) is shifted to the left (the negative direction) by |b| units, and if b < 0, then the graph of g(x) is shifted to the right (the positive direction) by |b| units. Why does the opposite of what we would expect? Consider that, if b = 1, then g(x) = f (x + 1), so g(0) = f (0 + 1) = f (1), g(1) = f (1 + 1) = f (2), g(−1) = f (−1 + 1) = f (0), and so on. The value of g at x is whatever the value of f is at x + 1, which is one unit to the right. Thus the graph of g(x) appears to be shifted one unit to the left. This is a tricky idea, and you should make a conscious effort to remember how horizontal shifts work. One case of horizontal shifting which we already studied is that of sin x and cos x. If you remember, we stated that ³ π´ cos x = sin x + . 2 In our new language of shifts, this is the same as saying that the graph of cos x is shifted π2 units to the left with respect to the graph of sin x. Now, if cos x is the shift of sin x, then sin x is the shift of cos x. So we could just as easily have written that ³ π´ sin x = cos x − , 2 that is, the graph of sin x is shifted π2 units to the right with respect to the graph of cos x. Can you visualize this relationship between sin x and cos x. Try confirming these equations by applying these them at various values of x. The formula for the derivative of a horizontal shift is more complicated than that for a vertical shift, just as in the case of stretches: if g(x) = f (x + b), then g 0 (x) = f 0 (x + b). This formula is deceptive, because it is easy to think that all you need to do is to take the derivative of f (x). If you look closely, however, there is a second step: we need to substitute into our formula for f the expression x = b wherever we see an x in order to get the derivative of g at x. For example, take g(x) = (x + 4)2 . Clearly, the function g(x) is the horizontal shift (4 units to the left) of f (x) = x2 . The derivative of f (x) is f 0 (x) = 2x. Substituting x + 4 in to the formula for f 0 (x), we get that g 0 (x) = f 0 (x + 4) = 2(x + 4) = 2x + 8. Of course, we could have multiplied out the formula for g(x) and have gotten the same result: g(x) = (x + 4)2 = x2 + 8x + 16 g 0 (x) = 2x + 8. Just as in the case of horizontal stretches, however, we do not always have the opportunity to simplify a formula, so it is best to learn how to differentiate horizontal shifts using the technique above. 3