Graphing the Sine and Cosine Functions

by Shelley Walsh ©2000

y=sinx, y=cosx

We start by learning what the basic graphs of sine and cosine look like. This can be done by plotting points. Set up a chart and plug in values for x and find the corresponding y's. Multiples of pi/4 are enough to get an idea of the shape. If you do that, your graphs should look something like this.

Here are some interesting things to notice about these graphs for use with later more difficult graphs.
  1. They are both periodic with period 2pi.
  2. They both wriggle back and forth between -1 and 1 in a smooth way.
  3. Sine starts at 0 and goes up to 1, and cosine starts at 1 and goes down to 0.
  4. The cosine curve looks just like the sine curve except that it is translated.

Amplitude

Graph y=asinx and y=acosx for various values of a, noting that the a is a stretching factor. If a is negative the graph turns upside down. For sine and cosine |a| is how far the graph gets away from the x-axis, so it is called the amplitude.



Period

Now look at what happens when you multiply a number inside the function by looking at the graphs of y=sinbx and y=cosbx for various values of b.

ã With a little bit of playing around with this you realize that this number effects how fast it goes through its business and that comes down to effecting its period. And you can come up this formula for the period.

y=asinbx, y=acosbx

Next you can put these two together to graph things where both the period and the amplitude have been changed.

Showing an amplitude other than 1 on your graph is quite easy. You just draw you graph like it was stretched or shrunk by that amount, but showing a period other than 2pi is a little harder, because there is a lot that the graph does in the course of its period. If we are talking about sine starting from 0, it starts at 0 and then goes up to 1 and then goes back down to 0 again and then goes down to -1 and then goes back to 0 to start all over again. So strictly as a kind of artistic aid, it is helpful to divide up the period into 4 pieces.


This means that for graphing a sine or cosine with period other than 2pi, it is helpful to know how big those pieces are. To figure this out, since there are 4 of them, you need to divide the period by 4, so I have introduced a total nonstandard piece of terminology called the quarter period, abbreviated q.p.. For a drawing tool for graphing then it is handy to compute the q.p. by the following formula.
Once you compute this number and you know your amplitude, then here is how you do your graphs.

Sine

First assume a is positive. Start at (0,0). Go to the right q.p. distance and up a distance of the amplitude. Then go another q.p. and back down to 0. Then go another q.p. and down to the minus of the amplitude. Then go another q.p. and back up to 0. Then continue your graph until you run out of paper so that you can show me you know it is supposed to be periodic and also copy the same pattern to the left of 0 to show me it goes on there as well. Perfect artistry isn't necessary, but I don't like sharp pointed graphs, so at least show that you have tried to make it look smooth.
If a is negative then do the same thing but flip it upside down.

Cosine

First assume a is positive. Start at (0, the amplitude). Go to the right q.p. distance and down to 0. Then go another q.p. and down to minus the amplitude. Then go another q.p. and up to 0. Then go another q.p. and back up to the amplitude. Then continue your graph until you run out of paper so that you can show me you know it is supposed to be periodic and also copy the same pattern to the left of 0 to show me it goes on there as well. Perfect artistry isn't necessary, but I don't like sharp pointed graphs, so at least show that you have tried to make it look smooth.
If a is negative then do the same thing but flip it upside down.

What if b is negative?

One more thing, I have been assuming throughout this that b is positive. No problem. If it is negative use the even or oddness of cosine or sine to get rid of the minus sign and take it from there.

Practice all this until you are good at it and then you will be ready for the next step which is translating.

Phase Shifts

Most general case,  y=Asin(Bx+C)+D,  y=Acos(Bx+C)+D

Don't worry about the letters A,B,C,D. You're going to do it with number anyway. I'm just writing it that way to be general. If you like, think of it as y=something times sin(someting else times x +  a different something else) + another different something else.

The thing to do with problems like this is reduce it to a problem you already know how to solve by changing your coordinate system. I'll show it for sine and it is the same for cosine. If you subtract the D and factor out the B then the expression becomes

This means you can get it into the form  y+E=AsinB(x+F).

Again, don't panic about the letters, they are going to be numbers.

The trick is to make a substitution and think of this as changing your coordinate system. So let X=x+F and Y=y+E and now the equation becomes Y=AsinBX, which should look familiar. You have graphed equations of this form before, so before doing any translating a good first exercise you can do when you get to this point is to graph that equation using the methods we have learned before.

The way to graph the original equation is to think of (X,Y) as a new coordinate system. Since they are only off from the (x,y) coordinate system my additions, this is a translated coordinate system. If you have succeeded in graphing this new equation, then you have graphed the original one in the (X,Y) coordinate system. The only problem with this, though, is that you were supposed to do it in the (x,y) coordinate system. To fix this what you need to do is find out where the (X,Y) coordinate system is relative to the (x,y) coordinate system. But this is quite simple because to find out where a coordinate system is all you have to do is find out where its origin is. For that all you need to know is that the origin is at (0,0). So you need to ask yourself, for what values of x and y are X and Y equal to 0. To find out that, set them each equal to 0 and solve, so the origin of the new coordinate system is where x+E=0 and y+F=0. We could solve for these in terms of E and F and find formulas, but you have enough formulas to remember, so it is easiest if you just set these things equal to 0 when you get the numbers. Once you have found out what the origin of the new coordinate system is the thing to do is draw a coordinate system through that point and simply ignore your original coordinate system and graph Y=AsinBX as if the dotted coordinate system was your coordinate system just like you graphed it in the warm-up exercise.

One more thing. The amount the graph gets shifted along the x-axis has a name. It is called the phase shift. If it is shifted to the right the phase shift is plus and if it is shifted to the left the phase shift is minus.

Shelley's Math Articles