TRIGONOMETRY

GRAPHING OF THE SINE FUNCTION

i.e. y = A sin (kx +c)
by Wayne Brown
Blue Ridge High School

Clear[f,x,k,a,c]; f[x_,k_,a_,c_] = a Sin[ k x + c];
graphofcurve= f[x,k,a,c];

Impact of a:

If necessary, activate the following cells to see the graphs.

k=1; c=0;
Do[Show[Plot[graphofcurve,{x,- 4 Pi, 4 Pi},
  Ticks->{{-4 Pi,-3 Pi,-2 Pi, -Pi, Pi, 2 Pi,3 Pi, 4 Pi},
           Automatic},
  PlotRange->{-5,5},AxesLabel->{"x","y"},
  PlotStyle->{{RGBColor[0,0,1],
  Thickness[.01]}},
  DisplayFunction->Identity],
 Graphics[{Text["y=", {1,5}, {-1,0}],
           Text[N[a,2], {2,5}, {-1,0}],
           Text["sin", {4,5}, {-1,0}],
           Text["x", {6,5}, {-1,0}]}],
     DisplayFunction->$DisplayFunction],
  {a,.5,4,.5}]

Animate the above graphics.  It will show you the graphs of y= a sin x  where  a is changing from .5 to 4.  What effect does this a value have on the regular graph of y= sin x.  Use the up and down arrow keys during this animation to get a good look at each graph.

Formal Answer:

The amplitude  will equal a.  The amplitude is how high and low each bump will go.

Impact of k:

If necessary, activate the following cell to see the graphs.

a=4; c=0;
Do[Show[Plot[graphofcurve,{x,- 4 Pi, 4 Pi},
  Ticks->{{-4 Pi,-3 Pi,-2 Pi, -Pi, Pi, 2 Pi,3 Pi, 4 Pi},
           Automatic},
  PlotRange->{-5,5},AxesLabel->{"x","y"},
  PlotStyle->{{RGBColor[0,0,1],
  Thickness[.01]}},
  DisplayFunction->Identity],
 Graphics[{Text["y=", {1,5}, {-1,0}],
           Text[N[a,1], {2,5}, {-1,0}],
           Text["sin", {3,5}, {-1,0}],
           Text[N[k,2], {6,5}, {-1,0}],
           Text["x", {8,5}, {-1,0}]}],
     DisplayFunction->$DisplayFunction],
  {k,1/2,3,1/2}]

Animate the above graph.  You will probably want to use the up and down arrow keys to take a good look at each graph.  This will show graphs of y=4 sin (kx) where k will vary from .5 to 3.  What effect does the k value have on the graph of y= 4 sin (kx).  Hint:  Take a look at how often it takes each graph to repeat.

Formal Answer:

The Period will equal 2Pi/k.  The period is how long it takes for the graph to repeat itself.  So the larger k is the smaller the period will be, which means the graph will repeat itself more often.

Impact of c, along with k:

If necessary, activate the following cell to see the graphs.

Clear[g,x,k,a]; g[x_,k_,a_] = a Sin[ k x];
a=4; k=1;

basecurve= g[x,k,a];

Do[Show[Plot[{graphofcurve,basecurve},{x,- 4 Pi, 4 Pi},
  Ticks->{{-4 Pi,-3 Pi,-2 Pi, -Pi, Pi, 2 Pi,3 Pi, 4 Pi},
           Automatic},
  PlotRange->{-5,5},AxesLabel->{"x","y"},
  PlotStyle->{{RGBColor[0,0,1],Thickness[.01]},
  {RGBColor[1,0,0],Thickness[.005]}},
  DisplayFunction->Identity],
 Graphics[{Text["y=", {1,5}, {-1,0}],
           Text[N[a,1], {2,5}, {-1,0}],
           Text["sin(", {3,5}, {-1,0}],
           Text[N[k,2], {6,5}, {-1,0}],
           Text["x +", {8,5}, {-1,0}],
           Text[c, {10,5}, {-1,0}],
           Text[")", {13,5}]}],
     DisplayFunction->$DisplayFunction],
  {c,0,Pi,Pi/8}]

Animate the above set of graphs.  You may want to use the up and down arrow keys during the animation to take a close look at each graph.  The graph in red is y=4sin x , and the graph in blue is the graph of           y=4sin (x + c) where c is changing from 0 to Pi by increments of Pi/8. What effect does the c have?

Formal Answer:

The c value will shift the graph to the left or right.  The formal name for this shift is phase shift.  The phase shift = -c/k.  Notice: k also helps determine how much of a shift there will be.  If the phase shift is negative it moves the graph to the left, and if the phase shift is positive it moves the graph to the right.

Putting it all together to sketch y=a sin(kx + c)

We will now take a look at how we use this new material to sketch
y=a sin (kx + c).   Our first example will be y=3sin (2x + Pi/2).  In this example, a=3, k=2, and c=Pi/2, which means the amplitude is 3, the period is 2Pi/2 = Pi, and the phase shift is -(Pi/2)/2 = -Pi/4.

STEP 1:  Graph the curve using only the new amplitude and period.  In                         this  case,  graph the equation y=3sin(2x).  The amplitude = 3, so we need each bump to go up to 3 and down to -3.  The period is Pi, so since the sine curve passes through the origin it will need to complete one cycle by Pi and then another cycle by 2 Pi. So, lets have Mathematica  graph the key points to our sketch.  First plot the origin, since the simple sine curve passes through it.  If necessary,  activate the following cell.

Clear[g,x,k,a]; g[x_,k_,a_] = a Sin[ k x];
a=3; k=2;

ListPlot[{{0,0}},PlotStyle->{PointSize[.012],RGBColor[1,0,0]},
        Ticks->{{-2 Pi, -Pi, Pi, 2 Pi},
                  Automatic},
  PlotRange->{{-2 Pi,2 Pi},{-5,5}},AxesLabel->{"x","y"}];

Now plot the points for the new period.  Since the new period is Pi, the graph will complete a cycle at Pi and 2 Pi, and the same thing applies for negative values.  The following commands will plot those points.  If necessary,  activate the following cell.

ListPlot[Table[{x,g[x,k,a]},{x,-2 Pi,2 Pi, Pi}],
        PlotStyle->{PointSize[.012],RGBColor[1,0,0]},
        Ticks->{{-2 Pi, -Pi, Pi, 2 Pi},
                  Automatic},
       PlotRange->{{-2 Pi,2 Pi},{-5,5}},AxesLabel->{"x","y"}];

Since the sine curve has a top bump and a bottom bump in each complete cycle, the curve will pass through the x-axis halfway between each of these previous points. The following commands will plot these new points.  If necessary,  activate the following cell.

ListPlot[Table[{x,g[x,k,a]},{x,-2 Pi,2 Pi, Pi/2}],
        PlotStyle->{PointSize[.012],RGBColor[1,0,0]},
        Ticks->{{-2 Pi, -Pi, Pi, 2 Pi},
                  Automatic},
       PlotRange->{{-2 Pi,2 Pi},{-5,5}},AxesLabel->{"x","y"}];

Now, lets put in the points at the top and bottom of each bump.  To do this look at the first cycle which is between 0 and 2 Pi.  The curve hits the x-axis at 0, Pi/2, and Pi.  So, halfway between 0 and Pi/2 will be the top of the first bump. This point is (3 , Pi/4).  Likewise, halfway between Pi/2 and Pi will be the bottom point of the lower bump. This point is             (-1, 3Pi/4).  Then we do the top and bottom points for all the other bumps of our curve.  The following commands will plot these points.  If necessary,  activate the following cell.

ListPlot[Table[{x,g[x,k,a]},{x,-2 Pi,2 Pi, Pi/4}],
        PlotStyle->{PointSize[.012],RGBColor[1,0,0]},
        Ticks->{{-2 Pi, -Pi, Pi, 2 Pi},
                  Automatic},
       PlotRange->{{-2 Pi,2 Pi},{-5,5}},AxesLabel->{"x","y"}];

Now we are ready to draw a smooth curve through these points.  The following commands will draw this curve.  If necessary,  activate the following cell.

withoutphaseshift = Show[Plot[g[x,k,a],{x,-2 Pi, 2 Pi},
         Ticks->{{-2 Pi, -Pi, Pi, 2 Pi},
                  Automatic},
         DisplayFunction->Identity],
ListPlot[Table[{x,g[x,k,a]},{x,-2 Pi,2 Pi, Pi/4}],
        PlotStyle->{PointSize[.012],RGBColor[1,0,0]},
        Ticks->{{-2 Pi, -Pi, Pi, 2 Pi},
                  Automatic},
       PlotRange->{{-2 Pi,2 Pi},{-5,5}},AxesLabel->{"x","y"},
       DisplayFunction->Identity],DisplayFunction->$DisplayFunction];

This is our sine curve with its new period.  Our last step is to do the phase shift.  This is very easy to do now.  Since the phase shift in this case is a -Pi/4, we move all the points on our previous sketch Pi/4 units to the left.  The simplest thing to do usually is to move our key points to the left Pi/4 units first.  The following commands will do this for us.  If necessary,  activate the following cell.

c= Pi/2;
withpspoints = Show[{withoutphaseshift,
       ListPlot[Table[{x,f[x,k,a,c]},{x,-2 Pi,2 Pi, Pi/4}],
        PlotStyle->{PointSize[.024],RGBColor[0,0,1]},
        Ticks->{{-2 Pi, -Pi, Pi, 2 Pi},
                  Automatic},
       PlotRange->{{-2 Pi,2 Pi},{-5,5}},AxesLabel->{"x","y"},
       DisplayFunction->Identity]},
       DisplayFunction->$DisplayFunction];

The points in blue are the key points shifted to the left Pi/4 units.

Now, we are ready to draw our final sketch.  Connect the shifted points with a nice smooth curve.  The following commands will do this for us.  If necessary,  activate the following cell.

Show[{withpspoints,Plot[graphofcurve,{x,-2 Pi, 2 Pi},
         PlotStyle->{{RGBColor[0,0,1],Thickness[.01]}},
         Ticks->{{-2 Pi, -Pi, Pi, 2 Pi},
                  Automatic},
         DisplayFunction->Identity]},
         DisplayFunction->$DisplayFunction];

The bold curve is the graph of y=3sin (2x + Pi/2).

Now lets have you try one on your own.  On a sheet of paper make a sketch of the following curve.  Try to sketch           y=4sin (x - Pi/4).  Once you have done it on paper, activate the following cell, and see if Mathematica agrees.

Clear[x,k,a,c];k=1;a=4;c= -Pi/4; 
Plot[graphofcurve,{x,-2Pi,2Pi},
     Ticks->{{-2 Pi,- Pi,Pi,2 Pi},Automatic},
     AxesLabel->{x,y},PlotStyle->{Thickness[.01]}];

The  cosine graph is sketched the same way as the sine curve, except its original passes through the point (0,1) instead of the origin.