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

Graph of y=tan(x)

Sal draws the graph of the tangent function based on the unit circle definition of the function. Created by Sal Khan.

Want to join the conversation?

  • male robot hal style avatar for user Marioland
    Where is Sal getting square root of 2 over 2 at ?
    (73 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user David Calkins
      At that point, Sal is dealing with pi/4 or 45 degrees, which is an angle that you can know sin, cos, and tan values without having to calculate anything. 45 degrees is one of those "special" angles that it would be good to memorize or at least know how to very easily find its sin/cos/tan value without a calculator.

      If you have a right triangle where the other two angles are both 45 degrees, that means your two non-hypotenuse side lengths are going to be the same (it's an isosceles right triangle). For this "special" triangle, you can remember easily the values 1, 1, and √2. The hypotenuse will be the larger value (√2) and the other two sides will both be 1. This makes sense, especially when we plug these values into the Pythagorean theorem:

      a^2 + b^2 = c^2
      1^2 + 1^2 = (√2)^2
      1 + 1 = 2
      2 = 2

      So now we have our sides, so we can very easily find sin/cos/tan values.
      sin = O/H = 1/√2
      cos = A/H = 1/√2
      tan = O/A = 1/1 = 1

      I personally don't know why they don't like irrational numbers in the denominator of fractions, but they don't. So they usually convert that fraction (in both sin and cos) by multiplying by √2/√2:

      sin = O/H = 1/√2 = 1/√2 * √2/√2 = (1*√2) / (√2*√2) = √2/2
      cos = √2/2

      Because 45 degrees is so easy to remember, Sal just quickly wrote in that its sin and cos are √2/2. Just remember that when you're working with negative angles, the quadrant changes, and so your sign my change. sin(-45) = -√2/2
      (155 votes)
  • duskpin seedling style avatar for user Rushna ☯
    Why do you have to draw the dotted vertical lines at ?
    (16 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user SRIVATHSAN B
    Why do we take the angle in radians and not in degrees?
    (16 votes)
    Default Khan Academy avatar avatar for user
    • leafers ultimate style avatar for user Icefalcon
      Once you get to higher math, like calculus, it becomes more clear. One simple example, though, is finding arc length. If you have a 30º arc with a radius of 1, to find the arc length you convert 30º to a fraction of 180º (30/180, or 1/6) and multiply that by πr. In radians, all you have to do is multiply the radius by the arc measure. π/6 * 1 = π/6, which you would get both ways. 30º is obviously a simple example, but it still is easier to receive the angle in radians instead.

      Another way (involving calculus) is the derivatives of trigonometric functions. The derivative of a function is the function's slope at a given point, and (in radians) the derivative of sin(x) = cos(x). When you put it in degrees, however, the derivative of sin(x) is π/180 * cos(x).

      Hope this helps!
      (31 votes)
  • ohnoes default style avatar for user Maaz Zubair
    At several times in the video, Sal refers to "vertical asymptotes". Could anyone please explain their definition?
    (9 votes)
    Default Khan Academy avatar avatar for user
    • aqualine tree style avatar for user Judith Gibson
      A vertical asymptote is a line that the graph would approach but never reach.
      It occurs at values where the function is undefined, in this case where its denominator is zero.
      For tangent, that would be at values of x that make cos(x) = 0 --- in other words, at x = 90 degrees and at x = 270 degrees for 0 <= x <=360.
      (26 votes)
  • blobby green style avatar for user athena.mendoza3
    What would be the range and the domain then?
    (11 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Unnat
    its scary how much sense this makes
    (10 votes)
    Default Khan Academy avatar avatar for user
  • stelly blue style avatar for user aniketprasad123
    OK so the the very important question is
    what is the domain and range of tangent function??
    (4 votes)
    Default Khan Academy avatar avatar for user
    • female robot grace style avatar for user loumast17
      mushuwu has the range right, but domain not so much. if you graph it you will notice vertical asymptotes along a regular interval. now, the key to finding this interval is knowing that tangent is sine divided by cosine. What can you never do in a division problem? divide by 0. so cosine can never be 0, and that is what the vertical asymptotes mean.

      When is cosine 0? at pi/2 and 3pi/2. plus 2pi * n of course, where n is any integer. so pi/2 plus every 2pi rotation of that after, and the same for 3pi/2

      Let me know if that doesn't make sense.
      (8 votes)
  • aqualine ultimate style avatar for user philip
    so what is the domain on the tangent function since there are gaps in the line?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • starky ultimate style avatar for user Ron Joniak
      Domain: all real numbers except pi/2 + k pi, k is an integer.

      It cannot be pi/2 or any multiple of pi/2 because that creates an instance where tangent is divided by 0.
      In the graph of tangent, pi/2 or any multiple of pi/2 is represented by an asymptote.
      (8 votes)
  • blobby green style avatar for user Wendy xxx
    How do you find the vertical asymptotes?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • cacteye blue style avatar for user Jerry Nilsson
      𝑓(𝑥) = 𝑎 tan(𝑏𝑥 + 𝑐) + 𝑑 = 𝑎 sin(𝑏𝑥 + 𝑐)∕cos(𝑏𝑥 + 𝑐) + 𝑑

      The vertical asymptotes of 𝑓(𝑥) occur when
      cos(𝑏𝑥 + 𝑐) = 0

      This happens when
      𝑏𝑥 + 𝑐 = 𝜋∕2 + 𝑛𝜋 for any integer 𝑛

      ⇒ 𝑥 = (𝜋∕2 + 𝑛𝜋 − 𝑐)∕𝑏
      = (𝜋∕2 − 𝑐)∕𝑏 + 𝑛𝜋∕𝑏
      (6 votes)
  • leafers seedling style avatar for user Sumedh Rathi
    What is the Domain of the function y=tanx ? As it is evident that every multiple of pi/2 is not defined.
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

- [Voiceover] What I hope to do in this video is get some familiarity with the graph of tangent of theta. And to do that, I'll set up a little unit circle so that we can visualize what the tangent of various thetas are. Let's say that's a y-axis and this is my x-axis. That is my x-axis, and the unit circle would look something like this. We already know, this is all a refresher of the unit circle definition of trig functions, that if I have an angle, an angle theta, where one side is a positive x-axis and then the other side, so this is the other side, so the angle is formed like this, that where this ray intersects the unit circle, the coordinates of that, the x and y coordinates are the sine of theta. Sorry, the x-coordinate is the cosine of theta. It's the cosine of theta, sine of theta. The x-coordinate here is cosine theta. The y-coordinate there is the sine of theta. But we're concerned about tangent of theta. We know that tangent of theta is the same thing as the sine of theta over the cosine of theta. Or if you're starting from the origin and you're going and you're taking the value of essentially the y-coordinate, the y-coordinate over the x-coordinate, it's essentially the slope of this line. This is going to be your change in y over change in x. This right over here is going to be the slope, the slope, I guess you could say, of this ray right over here. That's going to help us visualize what the tangents of different thetas are. Let me clean up my unit circle a little bit just so that we can ... All right, there we go. So now let's make a table. So let's make a table. So for various thetas, let's think about what tangent of theta is going to be, tangent of theta. So maybe the easiest one, if theta is zero radians, so if it's zero radians, what is the slope of this ray? That ray's, the slope is zero. As x changes, y doesn't change at all. Now let's think about, and I'm just going to pick values that are very easy for us to think about what the tangent of those values are, and they'll help us form, they'll help us think about the shape of the graph of y is equal to tangent of theta. So let's take pi over four radians. This one right over here, theta is equal to pi over four. Now why is that interesting? And sometimes, it's easier thinking degrees. It's a 45-degree angle. This here, your x-coordinate and your y-coordinate is the same. You might remember, it's square root of two over two, square root of two over two. But the important thing is whatever you move in the x direction, you move the same in the y direction. So the slope of this ray right over here is going to be equal to one, or another way of thinking about it, tangent of theta is going to be equal to one. Or sine of theta over cosine of theta, they're the same thing, so you're going to get one. Let me just clean that up here just because I'm going to keep reusing the same unit circle. So if I have theta is pi over four, then the tangent of theta is going to be equal to one. Now what if theta is equal to negative pi over four? That is this right over here. Let me just draw a little triangle here. So when x, this x-coordinate over here, is square root of two over two, we know that. We've seen that multiple times, square root of two ... Actually, let me label it a little bit better. So here, our theta is equal to negative pi over four radians. Or if you like to think in degrees, this would be negative 45 degrees. And now, your sine and cosine of this angle are going to be the opposites of each other. The cosine is square root of two over two. The x-coordinate of where this intersects is square root of two over two. The y-coordinate here is negative square root of two, negative square root of two over two. So what's the tangent? Well, it's going to be your sine over your cosine, which is going to be negative one, and you see that. For however much you move in the x direction, you move the opposite of that. You move the negative of that in the y direction. Let me clean this up a little bit because I want to keep reusing my unit circle. So there you go. And so this is going to be negative one. This is going to be negative one. Actually, let's just start plotting a few of these points. If we assume that this is the theta axis, if you can see that, that's the theta axis, and if this is the y-axis, that's the y-axis, we immediately see tangent of zero is zero. Tangent of pi over four is one, thinking in radians. Tangent of negative pi over four is negative one. Now let's think of it. Right now, if you just saw that, you might say, "Oh, maybe this is some type of a line," but we'll see very clearly it's not a line because what happens as our angle gets closer and closer to, as our angle gets closer and closer to pi over two, what happens to the slope of this line? So that is theta. We're getting closer and closer to pi over two. This ray, I guess I should say, is getting closer and closer to approaching the vertical, so its slope is getting more and more and more positive, and if you go all the way to pi over two, the slope at that point is really undefined but it's approaching, one way to think about it is it is approaching infinity. So as you get closer and closer to pi over two, so I'm going to make a ... I'm going to draw essentially a vertical asymptote right over here at pi over two because it's not going to be ... I guess one way we could think about it, it's approaching infinity there, so this is going to be looking something like this. It's going to be looking something like this. The slope of the ray as you get closer and closer to pi over two is getting closer and closer to infinity. What happens when the angle is getting closer and closer to negative pi over two? Is getting closer and closer to negative pi over two? Well, then, the slope is getting more and more and more negative. It's really approaching negative. It's approaching negative infinity. So let me draw that. Once again, not quite defined right over there, we have a vertical asymptote, and we are approaching negative infinity. We are approaching negative infinity. That's what the graph of tangent of theta looks just over this section of, I guess we could say the theta axis, but then we could keep going. Then we could keep going because if our angle, right after we cross pi over two, so let's say we've just crossed pi over two, so we went right across it, now what is the slope? What is the slope of this thing? Well, the slope of this thing is hugely negative. It looks almost like what I just drew down here. It's hugely negative. So then the graph jumps back down here, and it's hugely negative again. It's hugely negative. And then as we increase our theta, as we increase our theta, it becomes less and less and less negative all the way to when we go to, what is this ... all the way until we go to ... let me plot this ... this angle right over here. Now what is this angle? This, well, I haven't told you yet. Let's say that this angle right over here is three pi over four. Now why did I pick three pi over four? Because that is pi over two plus pi over four. Or you could say two pis over for plus another pi over four is three pi over four. And the reason why this is interesting is because it is another, it's forming another, I guess you could say pi over four- pi over four-pi over two triangle, or a 45-45-90 triangle, where the x and y-coordinates or the x and y distances have the same magnitude. But now, the x is going to be negative and the y is positive. So the slope here is going to be the slope, the same slope as we had for negative pi over four radians. We're going to have a slope of negative one. At three pi over four, we have a slope of negative one. Then we increase our angle all the way to pi. Now our slope is back to zero. Our slope is back to zero. And then as we go beyond that, as we go to, as we increase by another pi over four, our slope goes back to being positive one. Our slope goes back to being positive one. And then once again, as we approach three pi over two, our slope is becoming more and more and more positive, getting, approaching positive infinity. This slope knows if you move a little bit in the x direction, you're moving a lot up in the y direction. So once again, so now the graph is going to look like this. Let me do it in a color that you can actually see. The graph is going to look something like this. And it will just continue to do this. It will just continue to do this every pi radians, actually, let me do that as a dotted line, every pi radians over and over and over again. Let me go back, pi, and I can draw these asymptotes. I can draw these asymptotes. Let me draw that and that. And so the graph of tangent, the graph of tangent of theta is going to look, is going to look something like this. And we could obviously, it's periodic, we could just keep doing it on and on and on in both directions.