# Graphing Transformed Sines

I’ll close out our look at transformations of functions with some trigonometric graphs. These are the best example of combined transformations, and involve some special tricks as well. We’ll start with an early question that gives an overview of the process, then focus in on important details.

## Overview

First, a typical question from 1997, to look at the basics:

Graphing Trig Functions

To graph the equation y = 3sin4x-3, I know I have to find the amplitude, period, and vertical or phase shift. I know the amplitude is 3, and the period is pi/4, but do I have to factor out the 4 from 4x-3 before I can find the vertical shift, or is it simply 3 down?

There is some ambiguity in the equation, which as written is $$y = 3\sin(4x)-3$$, but might have been intended to be $$y = 3\sin(4x-3)$$. The student, Nem, has seen the basics, but got several details wrong, whichever interpretation we take. Doctor Scott started with what Nem knew:

You are absolutely right that in order to graph the equation you need to determine the amplitude, period, vertical, AND phase (or horizontal) shift.  Remember that the general form of a sinusoidal function (a sine or cosine curve) is:

y = a + b*sin[c(x-d)]

In this form:
a is the VERTICAL SHIFT
b is the AMPLITUDE
d is the HORIZONTAL SHIFT (or PHASE SHIFT)
c is the FREQUENCY (which determines the period)

The vertical shift, in a trig graph, determines what can be called the midline (or center line or axis), about which the graph will oscillate; the vertical stretch is here called the amplitude, because it tells us how far the graph will oscillate up and down from that midline. The “inside” transformations are a horizontal shift (phase shift) and a horizontal stretch, which here is related to the period or wavelength.

He starts with the as-written interpretation, as $$y = 3\sin(4x)-3$$:

Now, your example, y = 3sin4x - 3 means the same as y = -3 + 3sin(4x).  (Unless the 4x-3 is in parentheses, which we will discuss below).  This means that we know that:

a = -3  (Vertical shift of 3 down)

b =  3  (Amplitude of 3)

c =  4  (The period is 2pi/4 = pi/2)

The period of a "normal" sine curve is 2pi, so here we will see 4 sine curves in the interval [0, 2pi), and thus the period of this curve is 2pi/4 or pi/2.

d =  0  (No phase shift)

This interpretation fits Nem’s mention of a vertical shift; but Nem was wrong about the value of the period, which is $$\displaystyle\frac{2\pi}{c}$$, not Nem’s $$\displaystyle\frac{\pi}{c}$$. Note that the horizontal compression by 4 divides the period of the sine, $$2\pi$$, by 4.

On the other hand, Nem was concerned about an interaction between the 4 and the -3, which can’t happen between a horizontal stretch and a vertical shift; so possibly he meant it the other way, $$y = 3\sin(4x-3)$$:

If, however, the original function is y = 3sin(4x - 3), we could rewrite this as y = 3sin[4(x - 3/4)] by factoring the 4 out of the (4x-3) expression.  Then,

a = 0  (No vertical shift)

b = 3  (Amplitude of 3)

c = 4  (The period is 2pi/4 or pi/2)

d = 3/4  (A horizontal shift of 3/4 unit to the right.)

We’ll be looking in more detail at several of these parameters below. But note the factoring here, which we will see again. Not all textbooks use this approach, but I strongly recommend it.

## Vertical and horizontal stretches

We’ll next look at the easiest part, the stretches, in this 1998 question:

Changing a Trigonometric Graph

How do you graph:

-cos 2x
-------
2

This involves three transformations: a vertical compression and reflection, and a horizontal compression. Doctor Rick took this, making some nice ASCII graphs, starting with the basic cosine:

You know what the graph of cos(x) looks like, I'm sure:

1 **                                         **
|   *                                   *
|     *                               *
|       *                           *
|        *                         *
|         *                       *
0 +----------*----------+----------*----------+--    cos(x)
|0          *         pi        *          2pi
|            *                 *
|             *               *
|               *           *
|                 *       *
-1 +                    ***

Cos(x) is a periodic function with period 2pi; that is, it comes back to the same value whenever we add another 2pi to y. (You can't tell an angle of y degrees from an angle of y + 360 degrees, or in radians, you can't tell y from y + 2pi.) So the graph repeats forever to the left and right.

Next, we apply the horizontal compression (the “inside” transformation):

What will cos(2x) look like? When x = 0, cos(2x) = cos(0) = 1. That's easy. So what is the period of cos(2x)?

2x = 2pi if x = pi

which means the period of cos(2x) is pi: when x = pi, cos(2x) comes back up to 1. That's all that changes, so the graph looks like this:

1 **                                         **
|   *                                   *
|     *                               *
|       *                           *
|        *                         *
|         *                       *
0 +----------*----------+----------*----------+--    cos(2x)
|0          *        pi/2       *           pi
|            *                 *
|             *               *
|               *           *
|                 *       *
-1 +                    ***

Rather than use a formula as Doctor Scott did, Doctor Rick works out the period from its meaning: one cycle is the interval from where the argument is 0, to where it is $$2\pi$$. The reasoning here makes it easy to see why this is a compression: We have to divide $$2\pi$$ by the coefficient, 2.

Note also something that will become a theme in this post: Doctor Rick made this change not by redrawing the graph, but by copying it and merely changing the labels on the axis. This is a very useful perspective.

Next, we can do the vertical compression:

Now let's multiply the whole thing by 1/2. That means we change the vertical size of the graph: -cos(2x)/2 doesn't go between 1 and -1 any more, but between 1/2 and -1/2.

1/2 **                                         **
|   *                                   *
|     *                               *
|       *                           *
|        *                         *
|         *                       *
0 +----------*----------+----------*----------+--    cos(2x)/2
|0          *        pi/2       *           pi
|            *                 *
|             *               *
|               *           *
|                 *       *
-1/2 +                   ***

Again, we just had to relabel the axis.

Finally, multiply the function by -1. That means turn it upside down.

1/2 +                    ***
|                 *       *
|               *           *
|             *               *
|            *                 *
|           *                   *
0 +----------*----------+----------*----------+--    -cos(2x)/2
|0        *          pi/2         *         pi
|        *                         *
|       *                           *
|     *                               *
|   *                                   *
-1/2 **                                         **

This is the final graph.

Doctor Rick didn’t show a check, but we can do so by calculating y for, say, $$x = \pi/2$$: $$y = \frac{-cos(2x)}{2} = \frac{-cos(2\cdot\pi/2)}{2} = \frac{-cos(\pi)}{2} = \frac{-(-1)}{2} = \frac{1}{2}.$$

This sort of thinking leads to a list of rules like Doctor Scott’s:

That's it! The basic rules are:

- Multiplication inside the cosine, cos(kx),
means divide the period by k. If k is
negative, flip the graph left to right.

- Addition inside the cosine, cos(x+a),
means shift the curve left by a. If a is
negative, it will shift right by (-a).

- Multiplication outside the cosine, b*cos(x),
means to multiply the height of the curve
(called the amplitude) by b. If it's
negative, turn the graph upside down.

- Addition outside the cosine, d + cos(x),
means shift the curve up by d. If d is
negative, it will shift down by (-d).

## Horizontal shifts: by solving

Now, we’ll look at the effect of shifts, with a 1999 question:

Phase Shift in Sine Function

I have a trigonometry test on Monday, and I do not understand phase shift in functions. The problem I am stuck on is y = sin(4x+pi/3). I have figured out that the amplitude is 1, the period is 90 degrees, and the phase shift is -15 degrees. I know how to graph this function without the shift, and I know the graph shifts to the left. What I do not know is how to move the function over correctly. Could you please show me an example of a shifted graph?

Note that Corine thinks of period and phase shift in degrees, though the problem uses radians. She is probably using formulas for them (correctly); her main concern is how to draw the graph.

We’ll be looking at a couple different ways to handle this, because it is the hardest part of these graphs (as we have previously seen that horizontal combinations are the hardest transformations in general). Doctor Rick took this one, using an extension of his method for finding the period above:

            *                               *
*  B  *                         *
*         *                     *
*           *                   *
*             *                 *
----*---------------*---------------*---------
*A               C*             *E
*                   *           *
*                     *         *
*     *
*
D

Okay, here is an attempt at drawing a sine curve. I labeled the points A, B, C, D, and E. These are points on the curve that you get when the argument of the sine function (what's inside the parentheses) is 0, pi/2, pi, 3pi/2, and 2pi.

I have seen these five points called “key points” or (my own term) “quarter cycle points”, or the like. They form the skeleton of the graph, so getting them right is essential.

Your function is y = sin(4x+pi/3). What will x be at point A? You want

4x+pi/3 = 0

so that y = sin(0) = 0. You can solve for this and you will find x = -pi/12 (which is -15 degrees, but you should leave it as it is).

What will x be at point C? You want

4x+pi/3 = pi

so that y = sin(pi) = 0 again. You can solve this to get x = pi/6. Since this is twice pi/12, the y axis is 1/3 of the way between A and C.

|  *                               *
*  B  *                         *
* |       *                     *
*  |        *                   *
*   |         *                 *
----*----+----------*---------------*---------
*|    |          |*             *E
*-pi   |         pi *           *
*  --   |         --  *         *
12   |          6    *     *
|                  *
|                  D

If you had trouble following the “1/3 of the way” part, I would think in terms of common denominators. We have $$-\frac{\pi}{12}$$ and $$\frac{\pi}{6}$$, so the LCD is 12, and I would mark my axis in units of $$\frac{\pi}{12}$$: $$-\frac{\pi}{12}, 0, \frac{\pi}{12}, \frac{2\pi}{12} = \frac{\pi}{6}$$. Then just put the y-axis at 0.

The important thing is that we found two points by solving simple equations to find when the argument of the sine has the corresponding values.

Note that again we are drawing (or at least imagining) the curve first, then deciding how to label the axis.

## Horizontal shifts: by factoring

Here’s another question from 2004 about the same thing, showing a slightly different perspective:

Graphing Trig Functions

Hi.  I've been studying how to graph trigonometric functions.  I know how to find everything.  What I find rather tedious is when it comes to choosing the x-values.  My teacher taught us to take the period and divide it by four.  This is our starting point.  Then we add one to the numerator.  This works well with simple sine or cosine functions.

What about the remaining trigonometric functions?  What if the function has phase shift?  Regarding the phase shift, our teacher suggests to draw the main function w/o the shift, then shift it (as if I'm holding the graph and moving it manually along the x-axis).

Please I hope you can give me a few guidelines that will make the process of graphing trigonometric functions simpler and less tedious. Thank you in advance.

eg: sin 2x has period 2pi/2 = pi

x | 0 | pi/4 | 2pi/4 | 3pi/4 | 4pi/4
---------------------------------
y | 0 |  1   |   0   |   -1  | 0

The y-values are based on a pattern.  For any sine function, we'll have the same y-values (0,1,0,-1,0) for different x-values obtained from the previous method.  It seems a great way but I'm not sure whether it's a standard way that works with all the functions or it's just a special method for sine and cosines (the pattern for cosine is: 1,0,-1,0,1).  If it's special for sines and cosines, how's it affected when there is a phase shift?

The basic technique here is a good one, and not far different from what we have seen. Doctor Ian started with the comment about the difficulty of choosing the x values:

That's for sure.  So perhaps you shouldn't choose them.  :^D

(I'll show you what I mean by that later.)

Next, on moving the graph along the axis:

That's good advice.  Here's even better advice:  ALWAYS draw the function the same way, and then just draw the AXES so that they're in the right place and to the right scale.

Note that, by this method, you graph sin(x) and cos(x) by starting with the same curve, and just labeling the origin differently.

So just draw the curve, which always has the same shape.  If it's a sine, tentatively assign the origin to be halfway between a trough and the next crest, where the curve crosses the x-axis.  If it's a cosine, make the assignment below a crest.

Now, if it's shifted by some amount, just move the ORIGIN by that amount.  That is, just start labeling from the shifted location.  If you need to account for changes in amplitude or period, you can handle those by changing how you label the graph.

We’ve already seen much the same advice, haven’t we?

We need an example, to see this done concretely:

Let's look at an example like

y = 3sin(2x - pi/4)

= 3sin(2(x - pi/8))

I'd start by drawing a sine wave, and the x-axis without any points labeled on it.  It's a sine, so I pick a point between a trough and a crest.  That's my tentative origin.  I know the whole thing is going to be shifted by pi/8, so I change the label of that point from '0' to 'pi/8'.

As we’ve seen before, he put the function argument in factored form so that the compression is done first, then the shift; from this, we see that the period is $$\frac{2\pi}{2} = \pi$$, and the cycle will start at $$\frac{\pi}{8}$$.

The period would normally be 2pi, but we've doubled the frequency, so we should go through one complete cycle by (pi + pi/8).  I move over by one complete cycle, and label that point '9pi/8'.  And now I've got the right scale for my x-axis.  I just have to fill in the rest of the tick marks so that these two points fall where I want them to.

So we first labeled the start of a cycle (the shift), then labeled the end of the cycle by adding the period.

For my y-axis, I just make a tick mark at the height of the maximum of the curve, and label it '3', since that's my amplitude.  And now I have a plot of the function.

If there had been a vertical shift, we could label the midline accordingly, then add and subtract the amplitude for the top and bottom lines, and then work out where the x-axis goes.

You always want to check with something like this, to make sure you haven't dropped a sign, or divided when you were supposed to multiply, or anything like that.  When x is pi/8, the function should be zero:

y = 3sin(2(pi/8 - pi/8)) = 0       Check.

When x is 9pi/8, it should be zero again:

y = 3sin(2(9pi/8 - pi/8)) = 0      Check.

When it's halfway between there (at 5pi/8), it should also be zero:

y = 3sin(2(5pi/8- pi/8)) = 0       Check.

Halfway to there (at 3pi/8), it should be at a maximum:

y = 3sin(2(3pi/8- pi/8)) = 3       Check.

If it's going through those points, you know it's going to be okay on the others.  Does that make sense?

If I were given axes to draw on, I couldn’t quite do all this so freely; I would just do exactly what is described above as a small sketch on the side (a rough draft), or as a mere table of points, and once I knew where all the points are, I’d transfer them onto the grid I was given.

Doctor Ian described a more traditional way:

Of course, if you're given labeled axes already, this won't work.  But that's okay!  What you want to do then is identify the values of x where the function has a value of 0, or +/-A, where A is the amplitude.

So given the function above, I'd want to know:  When will it be true that

0 = 3sin(2(x - pi/8))

Clearly, at x = pi/8 + k*pi, where k = 1, 2, 3, ...  So I'd go to my graph and put dots on the x-axis at those points.  Next, I'd want to know:  When will it be true that

3 = 3sin(2(x - pi/8))

This is going to be true when

2(x - pi/8) = pi/2

x - pi/8 = pi/4

x = pi/4 + pi/8

x = 3pi/8

plus multiples of pi.  So I can label those points on the line y = 3.

The point is, if I can find the zero points, and the minima and maxima, then I can sketch the rest of the graph easily, since I already know the shape.

## But they’re fractions!

Sometimes the details are scary to students, and we get questions like this, from 1998:

Finding Intervals in Trig Graphs

I'm in pre-calculus, and I don't understand graphing sine and cosine functions. I understand it up until you have to divide the interval into four equal parts. One of the problems I'm having a hard time with is the interval negative pi divided by four to seven pi divided by four. In the book, you have to add the two together and multiply by 1/4, 1/2, and 3/4. When I add the two intervals, I get six pi over four. Then I multiply it by 1/4, and I get three pi over eight. But the answer is pi over four. Could you please help me?

I answered with an idea similar to one I mentioned in passing above:

Hi, Sara. I think what you are trying to do is to divide the interval:

(-pi/4, 7pi/4)

into four equal parts. The fact that it doesn't start at zero is what makes this difficult for you, together with the fact that the left end is negative. I get the impression you are just trying to follow an example that did start at zero, without thinking about what it means. So let's start out by picturing what we're doing, rather than just working with numbers.

---+===+===+===+===+===+===+===+===+---
-pi  0               pi         7pi
---                             ---
4                               4


You may notice that I set myself up for success by using $$\frac{\pi}{4}$$ as my unit, so I’ve already got the interval divided into 8 equal parts, which will be useful. My work won’t depend on having done that already, but we’ll get there.

First we have to measure how long the interval is. If you trust my drawing, you can just count the eight pi/4 marks I've made. If you don't, what you have to do is to subtract (NOT ADD!) the two ends:

7 pi    -pi   (7 - -1) pi   8 pi
---- - ---- = ----------- = ---- = 2 pi
4      4         4          4

Now if we want to divide this interval into four equal parts, each one will be a quarter of this length:

2 pi   pi
---- = --
4     2

The distance from a to b is ba, even if they are fractions.

Now the points where you have to "cut" the interval will be every pi/2, starting at your left end point:

-pi   pi   pi
--- + -- = --
4     2    4

pi   pi   3 pi
-- + -- = ----
4    2     4

3 pi   pi   5 pi
---- + -- = ----
4     2     4

Actually, knowing the LCD is going to be 4, I would have rewritten $$\frac{\pi}{2}$$ as $$\frac{2\pi}{4}$$ before doing these additions. In effect, we are adding 2 to the numerator each time (-1, 1, 3, 5).

Just as a check, the next point should be your right end point:

5 pi   pi   7 pi
---- + -- = ----      looks good!
4     2     4

So the 1/4, 1/2, and 3/4 points are pi/4, 3pi/4, and 5pi/4:

---+===+===+===+===+===+===+===+===+---
-pi  0   pi     3pi     5pi     7pi
---     ---     ---     ---     ---
4       4       4       4       4

The two mistakes you made were adding rather than subtracting, and then stopping too soon and taking the length of 1/4 of the interval as the answer, without adding it to the starting point.

This site uses Akismet to reduce spam. Learn how your comment data is processed.