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?

  • 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!!)
    (9 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.
      (7 votes)
  • 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?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • 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:

    sin(-2x-2)=y

    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
  • 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.
    (2 votes)
    Default Khan Academy avatar avatar for user
  • marcimus red style avatar for user Marcimus when the imposter is susඞඞ
    at didn't sal shift everything up by three?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • 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.
      (3 votes)
  • 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?
    (1 vote)
    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.
      (1 vote)
  • marcimus orange style avatar for user CrunchyRoll
    Where did the names "Sine" and "Cosine" originate from? How about tangent, secant, etc? Was it named after someone? Or was it just some random name generator?
    (1 vote)
    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.