Graph Sine and Cosine Functions

Graphs of the sine and the cosine functions of the form y = a sin(b x + c) + d and y = a cos(b x + c) + d are discussed with several examples including detailed solutions.
We start with the graph of the basic sine function y = sin(x) and the basic cosine function g(x) = cos(x), we then present examples of how to graph transformed versions of these same functions. An effective way of using this tutorial is to start it from the beginning and go through the examples in order.

Graph of the basic sine function: y = sin(x)

Example 1

Find the range and the period of the function y = sin(x) and graph it.

Solution to Example 1

A unit circle (with radius 1) centered at the origin of the system of rectangular axes has 4 special points corresponding to 5 quadrantal angles (0 , π/2, π 3π/2 and 2π) as shown in figure 1 below. The x and y coordinates of a point on the unit circle are the cosine and the sine respectively of the corresponding angle.
x being the angle in
standard position , from the unit circle we can conclude the following:
The
range of sin(x) (the y coordinates) is the set of all values in the interval [-1 , 1] or in inequality form: - 1 ≤ sin(x) ≤ 1
Once cycle of sin(x) may start at x = 0 and finish at x = 2π after which rotation the value of sin(x) are repeated as shown in the unit circle, we therefore say that sin(x) has a
period equal to 2π.
unit circle in trigonometry

Figure 1.Unit Circle in Trigonometry
We need values of sin(x) for different values of x in order to graph it. We shall use the y coordinate ( which gives sin(x) ) of the same 5 quadrantal angles corresponding to the variable x (0 , π/2, π 3π/2 and 2π) of which 3 values (0 , π , 2 π) are zeros of sin(x), one value (π/2) gives a maximum value to sin(x) and one value (3π/2) gives a minimum value to sin(x)as shown in the table below.
x 0 π/2 π 3π/2 2 π
y = sin(x) 0 1 0 -1 0

The graph of y = sin(x) is shown below over one period from 0 to 2π (solid line) and other periods (broken line).
graph of y = sin(x)

Figure 2. Graph of y = sin(x)

Graph of the basic sine function: f(x) = cos(x)

Example 2

Find the range and the period of the function y = cos(x) and graph it.

Solution to Example 2

We will use the same 4 special points corresponding to 5 quadrantal angles (0 , π/2, π 3π/2 and 2π) as shown in the unit circle (figure 1 above). cos(x) is given by the x coordinate of a point on the unit circle corresponding to angle x in standard position.
From the unit circle we can conclude the following:
The range of cos(x) (the x coordinates) is the set of all values in the interval [-1 , 1] in inequality form: - 1 ≤ cos(x) ≤ 1
Once cycle of cos(x) may start at x = 0 and finish at x = 2π after which rotation the value of cos(x) are repeated periodically as shown in the unit circle, we therefore conclude that cos(x) has a period equal to 2π.
We use the values of cos(x) for different values of x from the unit circle (see figure 1) . We shall use the x coordinate ( which gives cos(x) ) of the same 5 quadrantal angles corresponding to the variable x (0 , π/2, π 3π/2 and 2π) of which 2 values (0 , 2 π) gives the maximum value 1 of cos(x), two values (π/2 , 3π/2) gives zeros of cos(x) and one value (π) gives a minimum value to cos(x)as shown in the table below.

x 0 π/2 π 3π/2 2 π
y = cos(x) 1 0 -1 0 1

The graph of cos(x) is shown below over one period from 0 to 2π (solid line) and more periods (broken line).
graph of y = cos(x)

Figure 3. Graph of y = cos(x)

Graph of the function: y = 3 sin(x)

Example 3

Find the range and the period of the function y = 3 sin(x) and graph it.

Solution to Example 3

Comparing the given function y = 3 sin(x) and the basic sine function y = sin(x) there is a multiplication factor of 3. There is no horizontal stretching or shifting since the variable x appear in the same "way" in both functions.
Period = 2π
We have already made a table for sin(x) above, let us extend it and include the given function y = 3 sin(x) to graph.
Note: to obtain values for the function 3 sin(x) you multiply the values of function sin(x) by 3 as shown in the table below.
From table; range: -3 ≤ 3 sin(x) ≤ 3

x 0 π/2 π 3π/2 2 π
y = sin(x) 0 1 0 -1 0
y = 3 sin(x) 0 3 0 -3 0

The graph of 3 sin(x) is shown below over one period from 0 to 2π and as expected there is a vertical stretching of a factor of 3 (compare to y = sin(x) , red). The period did not change as expected but the range is now: [-3 , 3] or in inequality form : -3 ≤ 3 sin(x) ≤ 3
graph of y = 3sin(x)

Figure 4. Graph of y = 3 sin(x)

Graph of the function: y = - 2 cos(x)

Example 4

Find the range and the period of the function y = -2 cos(x) and graph it.

Solution to Example 4

Comparing the given function = - 2 cos(x) and the basic cosine function y = cos(x), there is a vertical stretching of a factor of 2 and there is also a reflection on the x axis because of the minus in - 2. There is no horizontal stretching or shifting since the variable x appear in the same "way" in both functions.
Period = 2π
A table for cos(x) was already made above, let us extend it to include the given function y = - 2 cos(x) to graph.
From table; range: - 2 ≤ -2 cos(x) ≤ 2
In general the range of functions of the form y = a sin(x) or y = a cos(x) is given by the interval
[ - |a| , |a| ] or in inequality form - |a| ≤ y ≤ |a|


x 0 π/2 π 3π/2 2 π
y = cos(x) 1 0 -1 0 1
y = - 2 cos(x) - 2 0 2 0 - 2

The graph of -2 cos(x) is shown below over one period from 0 to 2π (blue solid line) compared to y = cos(x) (red) and we can see that there is a stretching of factor 2 and reflection.
graph of y = - 2 cos(x)

Figure 5. Graph of y = -2 cos(x)

Graph of the function: y = sin(2 x)

Example 5

Find the period of the function y = sin(2 x) and graph it.

Solution to Example 5

Comparing the given function y = sin(2 x) and the basic sine function y = sin(x), there is a horizontal shrinking of a factor of 2.
Explanation
For the function y = sin(2 x) to go through one period, 2 x will have to be as follows
0 ≤ 2 x ≤ 2 π
divide all terms of the above inequality, we obtain
0 ≤ x ≤ π , this is the interval over one period to be used to graph y = sin(2 x)
Hence the period of sin(2x) = π - 0 = π
In general the period of functions of the form y = sin( b x) or y = cos( b x) is given by
2π/ |b| , the period is always positive.
A table for sin(2 x) is made in a similar way as a y = sin(x) with one difference in the values of x over one period from 0 to π (one period). 0, π , π/4 , π/2 and 3π/4 split the period into 4 equal intervals. π/2 is the mid value of 0 and π. π/4 is the mid value of 0 and π/2 and so on.

x 0 π/4 π/2 3π/4 π
y = sin(2 x) 0 1 0 -1 0

The graph of y = sin(2 x) is shown below over one period from 0 to π (blue solid line) compared to y = sin(x) which has a period of 2π(red).
graph of y = sin(2x)

Figure 6. Graph of y = sin(2x)

Graph of the function: y = cos(2 x - π/4)

Example 6

Find the period, phase shift of the function y = cos(2 x - π/4) and graph it.

Solution to Example 6

Rewrite the given function as
y = cos(2(x - π/8))
We first start by ignoring the term - π/8 and define a period for y = cos(2 x)
0 ≤ 2 x ≤ 2π
Divide all terms by 2 to obtain
0 ≤ x ≤ π , period is π as already calculated above.
For the function y = cos(2(x - π/8)) to go through one period the expressions 2(x - π/8) will have to be as follows
0 ≤ 2(x - π/8)≤ 2 π
divide all terms by 2
0 ≤ x - π/8 ≤ π
add π/8 to all terms
π/8 ≤ x ≤ π + π/8, this is the interval over one period to be used to graph y = cos(2 x - π/4)
When we compare the interval of one period for cos(2 x) which is 0 ≤ x ≤ π and the interval for one period of cos(2(x - π/8)) which is π/8 ≤ x ≤ π + π/8, the only difference is the
phase shift to the right by π/8
In general the phase shift of functions of the form y = sin( b x + c ) or y = cos( b x + c) is given by
- c / b. If the phase shift is positive the shift is to right and if it is negative, the shift is to the left.

We construct the table of values as follows:
We have seen above that in this example one period starts from x = π/8 and finishes at x = π + π/8 = 9π/8. Hence we start the table using these two points.

x π/8 9π/8


We next find the mid value between x = π/8 and x = 9π/8 , calculated as follows: (1/2)(π/8 + 9π/8) = 5 π/8 and put it in the table

x π/8 5 π/8 9π/8


We next find the mid value between x = π/8 and 5 π/8 calculated as follows: (1/2)(π/8 + 5π/8) = 3 π/8 ; and the mid value between 5 π/8 and 9π/8 calculated as follows (1/2)(5π/8 + 9π/8) = 7 π/8 and put all these in the table as follows

x π/8 3 π/8 5 π/8 7 π/8 9π/8


We have split the one period interval into 4 equal intervals and these make it easy to evaluate the given function y = sin(2x) which will have the same maximum, minimum values at similar position but within the interval π/8 , 9π/8. We now complete the table by putting the values of the function.

x π/8 3 π/8 5 π/8 7 π/8 9π/8
y = cos(2 x - π/4) 1 0 -1 0 1

The graph of y = cos(2 x - π/4) (blue) is compared to the graph of cos(2 x) (red). They are similar except for the shift of π/8 the right.
graph of y = cos(2x - pi/4)

Figure 7. Graph of y = cos(2x - π/4)

Graph of the function: y = sin(3 x + π/3)

Example 7

Find the period and phase shift of the function y = sin(3 x + π/3) and graph it.

Solution to Example 7


The period is given by: 2π/|b| = 2π/ 3
The phase shift is calculated as follows
- c / b = - ( π/3) / 3 = - π/9
We expect the graph of y = sin(3 x + π/3) to be the graph of y = sin(3 x) shifted by π/9 to the
left because of the minus sign in the phase shift.
For the function y = sin(3 x + π/3) to go through one period the expression 3 x + π/3 will have to be as follows
0 ≤ 3 x + π/3 ≤ 2 π
Solve the above inequality for x to obtain the interval corresponding to one period.
- π/9 ≤ x ≤ 5π/9
Find the mid values as was done in example 6 and complete the table of values.

x - π/9 π/18 2π/9 7π/18 5π/9
y = sin(3 x + π/3) 0 1 0 -1 0

The graph of the given function y = sin(3 x + π/3) (blue) is compared to the graph of sin(3 x) (red). They are similar except for the shift of π/9 to the left.
graph of y = sin(3x + pi/3)

Figure 8. Graph of y = sin(3x + π/3)

Graph of the function: y = - 2 sin(2 x - π/5) + 1

Example 8

Find the range, period and phase shift of the function y = cos(2 x - π/4) and graph it.

Solution to Example 8

We know that the range of sin(2 x - π/5) is given by the interval [-1 , 1] or as an inequality we write
- 1 ≤ sin(2 x - π/5) ≤ 1
Multiply all terms of the inequality by - 2 and change the symbols of inequality
2 ≥ - 2 sin(2 x - π/5) ≥ - 2
Add + 1 to all terms of the inequality and rewrite as
- 2 + 1 ≤ -2 sin(2 x - π/5) + 1 ≤ 2 + 1
Which gives the range of the given function as
- 1 ≤ -2 sin(2 x - π/5) + 3 ≤ 3
In general the range of the function y = a sin( b x + c ) + d or y = a cos( b x + c) + d is given by the interval
[ - |a| + d , |a| + d ] or in inequality form - |a| + d ≤ y ≤ |a| + d

The period is given by
2π/|b| = 2π/|2| = π
The phase shift is given by
- c / b = - (- π/5) / 2 = π/10
To graph y = - 2 sin(2 x - π/5) + 1 over one period the expression (2 x - π/5) has to go through one period as follows
0 ≤ (2 x - π/5) ≤ 2π
Solve the above inequality to obtain
π/10 ≤ x ≤ 11π/10
Use the lowest value π/10 and the highest value 11π/10 in the above inequality (which gives a period) to construct a table of values by splitting the period into 4 equal intervals as follows

x π/10 7π/20 6π/10 17π/20 11π/10
sin(2 x - π/5) 0 1 0 -1 0
- 2 sin(2 x - π/5) 0 -2 0 2 0
y = - 2 sin(2 x - π/5) + 1 1 -1 1 3 1

It is important to note that the graph over one period is
inscribed inside a rectangle of length from π/10 to 11π/10 which the interval over one period found above by solving the inequality 0 ≤ (2 x - π/5) ≤ 2π and a width from the minimum and the maximum (range) values of y = - 2 sin(2 x - π/5) + 1 equal to -2 + 1 = - 1 and 2 + 1 = 3 which is the range already found in the table.
graph of y = -2 sin(2x - π/5) + 1

Figure 9. Graph of y = - 2 sin(2x - π/5) + 1

Graph of the function: y = 2 cos(2 x + 4π/3) - 2

Example 9

Graph the function y = cos(2 x - π/4) over one period.

Solution to Example 9

In example 8 above, we saw that the graph over one period is inscribed within a rectangle of length the starting point and finishing point of one period found by solving the inequality
0 ≤ 2 x + 4π/3 ≤ 2π
Which gives
- 4π/6 ≤ x ≤ 2π/6
and
width given by the range of y = 2 cos(2 x + 4π/3) - 2 which is given by the interval (see formula given above)
[ - |a| + d , |a| + d ] = [ - 2 - 2 , 2 + 2 ] = [ - 4 , 0] or in inequality form - 4 ≤ y ≤ 0
A table of values is constructed using the the starting and finishing point - 4π/6 and 2π/6 found above and splitting the period into 4 equal intervals and the mid values. Then the values of the function whose range is already known are easily determined over one period.

x - 4π/6 -5π/12 - π/6 π/12 2π/6
cos(2 x + 4π/3) 1 0 -1 0 1
2 cos(2 x + 4π/3) 2 0 -2 0 2
2 cos(2 x + 4π/3) - 2 0 -2 -4 -2 0

The graph of y = 2 cos(2 x + 4π/3) - 2 is shown below over one period from - 4π/6 to 2π/6. Note again the rectangle determined above.
graph of y = 2 cos(2x + 4π/3) - 2

Figure 10. Graph of y = 2 cos(2x + 4π/3) - 2

Exercises

For each function find the starting and finishing x values over one period, the range and Graph it over one period.
1) y = (1/2) cos(3x - π/6) + 1
2) y = - sin(0.5 x + π/6) - 1

Solutions to Above Exercises

1) one period : π/18 ≤ x ≤ 13π/18 , range : [1/2 , 3/2] . See graph below
graph of y = (1/2) cos(3x - π6) + 1

Figure 11. graph of y = (1/2) cos(3x - π/6) + 1
2) one period : - π/3 ≤ x ≤ 11π/3 , range : [ - 1/2 , - 3/2] . See graph below
graph of y = - sin(0.5 x + π6) - 1

Figure 12. graph of y = - sin(0.5 x + π/6) - 1

More References and links on quadratic functions and parabolas

sine function
cosine function
unit circle
angle standard position
range of sin(x)
period of trigonometric functions
phase shift of a sine function
Properties of The Six Trigonometric Functions
Home Page