If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Example: Graphing y=-cos(π⋅x)+1.5

Sal graphs y=-cos(π⋅x)+1.5 by thinking about the graph of y=cos(x) and analyzing how the graph (including the midline, amplitude, and period) changes as we perform function transformations to get from y=cos(x) to y=-cos(π⋅x)+1.5. Created by Sal Khan.

Want to join the conversation?

  • duskpin sapling style avatar for user JJ
    Im surprised they didnt explain another method(which is given by the hints in the exercise in the videos, the method used exercise is much different from the method Sal uses in the video.

    Anyway, for those who are confused as I were when you saw the hints in the exercise, let me save you some time so that you dont have to spend time trying to figure out what you miss in the video and try to brute force using them to solve the problems. Here is my what I have figured out after hours of trials and error, and thanks to Annie's clarification in the comments :

    To graph a sinusoidal function(or to solve the problem in the following exercise), We need two points to draw a sinusoidal function in the interactive widget: a midline point and an extremum point. And the midline should be only 1/4 period apart from the extremum point, another way you can do it is using extremum points(maximum to minimum or minimum to maximum point0 and they should be 1/2 period apart. One thing you have to watch out for is that these points need to be consecutive, which means there they should not be any other midline intersections or extremum points between them.

    Determine the extreme point and midline point(c)based on the graph(sin or cos)


    a=amplitude , b= cycle form 0~2π, c=horizontal shift
    d=midline(vertical shift)

    [sin graphs]
    If its not a horizontal shift(c=0)

    midline: (x=0, y=d)
    extremum point: (x=1/4 period , y=d+a)

    [cos graphs]
    If its not a horizontal shift(c=0)

    midline: (x=1/4 period, y=d)
    extremum point: (x=0, y=d+a)

    To find a period of a function:
    >Between Maximum point to minimum point(no other extremum point between them)=1/2 period
    >Between Midline intersection point to the closest maximum or minimum point=1/4 period

    eg: say, a function a ⋅sin⋅b(x-c)+d has midline intersection point is at x= 0 , the nearest maximum point is x= 3
    1/4 period= distance between max and midline point= 3-0
    1/4 period=3 (to get 1 period multiply both side by 4)
    1 period=12

    a function a ⋅cos⋅b(x-c)+d has a maximum point is at x= 0 , the nearest minimum point is x= 2
    1/2 period= distance between max and min point= 2-0
    1/2 period=2 (to get 1 period multiply both side by 2)
    1 period=4

    If the above is still to confusing to you, you can just memorize the formulas for now. BUT you have to eventually need to understand them one day if you plan on continue learning trigonometry.

    Examples: You are asked to graph y= 5sin(πx/2)-4


    Here is what you do:

    Determine the graph
    >Sin graph, c=0(so no horizontal shift)

    since its a sin graph we use this formula:

    midline: (0,d)
    extremum: (1/4peiord, y=d+a)

    d(midline): d=-4
    period=2π/ π/2=4 and 1/4period= 1

    Now we just have to fill them in.

    midline: (0,d)= ( 0,-4)
    extremum:(1/4peiord, y=d+a)= ( 1,-4+5)= (1,1)

    There you have it, now you all have to do it is plot them and that it! But be mindful that which point you plot on the interactive widget, you should to the point on the y-axis line to plot the midline point, and use another point to plot extreme point, getting them mixed up will result a reversed graph, and give you the wrong graph. One way to check your whether your graph is correct, is simply see if the midline(y=d) and the amplitude match with the equation.

    Hope this helps anyone who struggle to understand the method used in the exercise. Feel free to correct me, if I made any mistakes or missed something. Any insights are welcome too. Thank you for reading.
    (26 votes)
    Default Khan Academy avatar avatar for user
  • leaf green style avatar for user Sally
    Hi, in the next practice: graph sinusoidal functions, some examples use the c=0 (no horizontal shift rule) for the consecutive midline intersection point OR the extremum point. However, I still don't understand which is which and I keep running into mistakes where I mix up the x-values and y-values for different coordinates.

    For example, in the equation y= -5 cos ((pi/16)x) - 4,
    I found these two points: (0, -9) and (8, -4) but I got confused if it should be
    (0, -4) and (8, -9) instead. It turned out to be (0, -9) and (8, -4). How do I tell the difference?

    I hope that made sense!! (maybe I just need to rewatch the explanation videos but the way Sal does it is different than the hints given. They should match it up so it is easier to stick to one way of doing it!!)
    (13 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Annie
      In a * trig (bx+c) = d

      To calculate the x and y coordinates of the midline and extremum points, here is what you must do.

      For sin graphs do this:

      To calculate the extremum point -- x = 1/4 period or 2pi/b, y = a+d
      To calculate the midline -- x = 0 if not shifted horizontally, y = d

      For cos graphs do this:

      To calculate the extremum point -- x = 0 if not shifted horizontally , a+d
      To calculate the midline -- 1/4 period or 2pi/b, y = d

      As you can see, the steps for the extremum point and the midline have switched for both sin and cosin.

      I hope this clears things up and simplifies things a bit better.

      If there is anything unclear or incorrect, please let me know.
      (14 votes)
  • piceratops sapling style avatar for user LaylaBug
    I am confused altogether on this...I have watched the videos over and over and still don't get it.
    (7 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user dartomictech
    Why is x not being expressed as radians like in the previous video? Does (x = 1) graphically correspond to (x = (Π / 2)) in the previous video's graph?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • duskpin ultimate style avatar for user yikian2021
    Hello, just a quick question why does 2pi/ number multiplying x work?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Tanner P
      Good question!

      The period of cos(x) is 2pi. This is because 2pi radians is one trip around the unit circle. Or, graphically, the horizontal distance between the beginning and end of 1 cosine wave is 2pi.

      Okay. Remember when you learned about transformations of functions? If you take f(ax), that is equivalent to a horizontal dilation (a stretch or compression) of the graph of f(x), by a factor of 1/a.

      Now, apply that to cos(ax). We know that if we were talking about regular cos(x), the period would be 2pi. But since cos(ax) is dilated horizontally by a factor of 1/a, the new period is going to be scaled too. And it will be like this: 2pi*1/a = 2pi/a.

      Hope this helps!
      (2 votes)
  • blobby green style avatar for user beneisenberg9
    How do you solve for c given a graphed sine or cosine function? Thanks. 😎
    (1 vote)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      So c has to do with phase shift which moves the waves left and right and is a change by adding or subtracting to x inside the parentheses of the trig function. So you know the sine function without phase shift starts at 0 and increases up to the max value at π/2. So for a phase shift, you have to see how much this same 0 is moved away from the y axis. So cos(x) starts at 1 and goes down, but the 0 going up is at -π/2. Thus, the sin(x+π/2) = cos(x). If you invert the sin wave, it shifts it either ±π, so - sin(x) = sin(x+π)=sin(x-π). The sift of the cos function would be the same except you look for where you start at max and goes down, so sin(x) = cos(x-π/2). While you could also use cos(x+3/2 π), we generally look for the point closest to the axis.
      Note that like all functions, if we add something to x, it moves left and subtracting moves right.
      (5 votes)
  • leaf blue style avatar for user 3010998
    I have a question, my textbook says that the formula for phase shift is: -(c/|b|). It works for sinusoidal functions if the b and c value is positive, but what about if the b and c value is negative like in the following question:


    According to the formula, c=-2 and b=-2 so the phase shift is 1, but isn't the phase shift supposed to be -1?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user David
    How do you decide the difference between a cosine and a sine wave when you use the same steps to find both?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user kubleeka
      Arbitrarily. A cosine wave is just a shifted sine wave, and vice-versa.

      Now, if the y-axis passes right through a crest or trough, it's probably better to write it as a cosine wave, since you won't have to deal with phase shift. Likewise, if the y-axis meets the wave at the midline, you should write it as a sine wave with no phase shift. But if it's in between, it truly doesn't matter.
      (2 votes)
  • blobby green style avatar for user nh
    Hello, may I confirm that the X-axis is always measured in Degrees or Radians, not as COS(x) i.e. the X-axis will never represents the X-coordinate? Thank you.
    (2 votes)
    Default Khan Academy avatar avatar for user
  • stelly green style avatar for user Marissa.L.Medina
    can someone please explain this video to me?
    i've watched it many times but i still don't get it
    are there steps that i am missing
    thanks in advance
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

- [Instructor] We're told to graph y is equal to negative cosine of pi times x plus 1.5 in the interactive widget. So, pause this video and think about how you would do that. And just to explain how this widget works if you're trying to do it on Khan Academy, this dot right over here helps define the midline. You can move that up and down. And then this one right over here is a neighboring extreme point. So either a minimum or a maximum point. So, there's a couple of ways that we could approach this. First of all, let's just think about what would cosine of pi x look like, and then we'll think about what the negative does and the plus 1.5. So, cosine of pi x. When x is equal zero, pi times zero, is just going to be zero, cosine of zero is equal to one. And if we're just talking about cosine of pi x, that's going to be a maximum point when you hit one. Just cosine of pi x would oscillate between one and negative one. And then what would its period be if we're talking about cosine of pi x? Well, you might remember, one way to think about the period is to take two pi and divide it by whatever the coefficient is on the x right over here. So two pi divided by pi would tell us that we have a period of two. And so how do we construct a period of two here? Well, that means that as we start here at x equals zero, we're at one, we want to get back to that maximum point by the time x is equal to two. So let me see how I can do that. If I were to squeeze it a little bit, that looks pretty good. And the reason why I worked on this midline point is I liked having this maximum point at one when x is equal to zero, because we said cosine of pi times zero should be equal to one. So that's why I'm just manipulating this other point in order to set the period right. But this looks right. We're going from this maximum point and we're going all the way down and then back to that maximum point, and it looks like our period is indeed two. So this is what the graph of cosine of pi x would look like. Now, what about this negative sign? Well, the negative would essentially flip it around. So, instead of whenever we're equaling one, we should be equal to negative one. And every time we're equal to negative one, we should be equal to one. So what I could is I could just take that and then bring it down here, and there you have it, I flipped it around. So this is the graph of y equals negative cosine of pi x. And then last but not least, we have this plus 1.5. So that's just going to shift everything up by 1.5. So I'm just going to shift everything up by, shift it up by 1.5 and shift it up by 1.5. And there you have it. That is the graph of negative cosine of pi x plus 1.5. And you can validate that that's our midline. We're still oscillating one above and one below. The negative sign, when cosine of pi time zero, that should be one, but then you take the negative that, we get to negative one. You add 1.5 to that, you get to positive .5. And so this is all looking quite good.