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

Integral of tan x

It might not look like it at first, but the reverse chain rule let's us find the integral of tan(x).

Want to join the conversation?

  • blobby green style avatar for user hchowitz
    This is all nice and logical, but when I look up a definition of the integral of tanx dx, I see that it's the postive natural log of the absolute value of secant x, plus C. How do we get from -ln of the absolute value of cosine to the postive ln of the absolute value of secant?
    (34 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      That is an application of basic properites of trigonometric functions and logarithms:
      first cos x = 1 / sec x
      Thus,
      − ln | cos x| = − ln |1/sec x|
      = − {ln (1) − ln |sec x|}
      = − {0 - ln |sec x|}
      = ln |sec x|
      Thus,
      −ln |cos x| = ln |sec x|
      (104 votes)
  • marcimus pink style avatar for user Andrew Maysick
    Can we apply the same logic for the integral of Cot(x) dx? If so, wouldn't that imply that the integral of Cot(x) is equal ln |sinx| + c?
    (17 votes)
    Default Khan Academy avatar avatar for user
  • piceratops seedling style avatar for user Daniel Longo
    At , I understand the concept of looking for f'(x)*f(x). I don't understand how f(x) is equal to 1/f(x). I'm missing an important piece of logic here. Can you help me understand it better? Thanks
    (7 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      I think it is a matter of f(x) in the example being used in more than one way. Let me try to explain the same thing in a way that might be more clear:

      All of the standard forms for integrals involve the following:
      (some function of u)(derivative of u -- note, of u, not the whole function) You must have the derivative of whatever you are calling u in order to use the form. If you don't have that derivative, then you have to solve the integral some other way.
      So, the key to solving these problems is to pick something to call u so that you have a function of u that you know how to integrate multiplied by the derivative of whatever you called u.

      The form that Sal was using was:
      ∫ (1/u) du = ln |u| + C

      Thus anytime you have:
      [ 1/(some function) ] (derivative of that function) then the integral is
      ln | (some function) | + C
      Let us use this to find ∫− tan (x) dx
      tan x = sin x / cos x, thus:
      ∫− tan (x) dx = ∫ (− sin x / cos x) dx
      Now let us see if we can put this in the form of 1/u du
      = 1/(cos x) [− sin x dx ]
      Let cos x = u , thus - sin x dx = du
      So, yes, this matches the form of ∫ (1/u) du = ln |u| + C
      thus, since we declared u = cos x, we know that
      ∫− tan (x) dx = ln |cos x| + C
      (8 votes)
  • blobby green style avatar for user Gilman Lodhi
    I'm a little confused here...isn't the integral of tan(x)= ln |Sec(x)| ? I'm sorry this might be a dumb question but i missed this lecture.
    (5 votes)
    Default Khan Academy avatar avatar for user
  • male robot hal style avatar for user Kshitij Patil
    how would u antiderivate log (x+1)
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user Qeeko
      What follows is one way to proceed, assuming you take log to refer to the natural logarithm.

      Recall that ∫ log(u) du = ulog(u) - u + C, where C is any real number. Using the substitution u = x + 1, du = dx, we may write ∫ log(x + 1) dx = ∫ log(u) du = ulog(u) - u + C. Now we may substitute u = x + 1 back into the last expression to arrive at the answer:
      ∫ log(x + 1) dx = (x + 1)log(x + 1) - x + C,
      where C is any real number.

      If you take log to mean logarithm to the base ten, you would proceed exactly as above, using the relation log(x) = ln(x) / ln(10). The answer would then be
      ∫ log(x + 1) dx
      = (1 / ln[10]) ∫ ln(u) du
      = (1 / ln[10]) · [uln(u) - u] + C
      = ulog(u) - u / ln(10) + C
      = (x + 1)log(x + 1) - x / ln(10) + C'.
      (4 votes)
  • spunky sam red style avatar for user Marvin Cohen
    Is it possible to take the integral of ln(x) using the reverse chain rule? If not, what other method(s) apply?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • leaf red style avatar for user dfbarbour
    Is u-substitution slightly more general than the reverse chain rule, or are they essentially identical? Is u-substitution just a mnemonic for the reverse chain rule? Is there any advantage to using one over the other?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leafers ultimate style avatar for user TripleB
      They are the same thing and when Sal refers to the reverse chain rule it's the same as "doing u-substitution in your head". In general to start you should do u-substitution and formally write out your values for u and du. But when you are comfortable with that and/or you have simpler integration problems you can just do the u-substitution "in your head". It's analogous to knowing that 4 * 25 = 100 and so you don't have to do the long multiplication every time.
      (2 votes)
  • leafers sapling style avatar for user cdbrenke
    It would be worth stating that cos(x) cannot equal any multiple of (pi +*n)\2 where n is an odd integer, right?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      cos x cannot equal anything greater than 1 nor less than -1, unless you delve into complex cosine. Thus, you would be constrained to
      |½ (π+n)| ≤ 1
      Whence, -2-π ≤ n ≤ 2-π
      Which is approximately: -5.14 ≤ n ≤ -1.14
      If n is required to be an integer, the only valid integers are:
      -5, -4, -3, and -2
      (1 vote)
  • blobby green style avatar for user James Kim
    if we u substitute as -cos x instead of cos x, we would, in the end result, get -ln|-cos x| + c as the integral of tan x. How is this possible
    (1 vote)
    Default Khan Academy avatar avatar for user
  • leaf green style avatar for user Vinoth Kumar Chinnasamy
    Integral of (tan x dx) ==> integral (sin x/cos x)dx
    U=1/cos x;
    dU/dx = (sin x) / ( cos x)^2 ;
    cos x dU= ((sin x)/(cos x) )dx;
    (1/U)*dU = ( (sinx)/(cosx))*dx
    so
    integral (sin x/cos x)dx = integral (1/U)*dU
    ===> ln(U)+c
    ===>ln(1/cos x) +C ? where i'm making mistake
    (1 vote)
    Default Khan Academy avatar avatar for user
    • stelly green style avatar for user The #1 Pokemon Proponent
      I can't tell where you made the mistake (because of your unorthodox method) so I'll solve the integral and you try to see where you made a mistake.
      let u = cos(x)
      then du/dx is -sin(x) or du = -sin(x)dx
      ∫ (tan(x))dx = ∫ (sin(x)/cos(x))dx = ∫ (-1/-1)(sin x/cos x)dx = (-1)∫(-1)(sin x/cos x) dx
      = -∫(-sin x/cos x)dx = -∫ du/u = -(ln|u|) + C = -ln|cos x| + C
      (2 votes)

Video transcript

- [Voiceover] Let's see if we can evaluate the indefinite integral of tangent x dx. Like always, pause the video and see if you can figure it out on your own and I will give you a hint, think reverse chain rule. Alright, so you have attempted it and you would say well reverse chain rule, that's kind of your seeing a function and your seeing it's derivative and you can integrate with respect to that function. All you see here is a tangent of x, what am I talking about? Well, whenever you see a tangent of x or a cosecant or a secant, at least in my brain, I always like to break it down into how it's defined in terms of sine and cosine because we do at least have some tools at our disposal for dealing with sines and cosines. Or at least our brains, at least my brain, has an easier time processing them. We know tangent of x is the same thing as sine of x over cosine of x so let me rewrite it that way. This is equal to the indefinite integral of sine of x over cosine of x dx and you could even write it this way and this is a little bit of a hint. You could even write it as sine of x times one over cosine of x. If you couldn't figure it out the first time, I encourage you to pause the video again and, once again, think reverse chain rule. So, what am I talking about when I keep saying reverse chain rule? Let's just review that before I proceed with this example. If I were to just tell you, well what's the indefinite integral of one over x dx? We know that, that's going to be the natural log of the absolute value of x plus c. Now, if I were to ask you what is the indefinite integral of f prime of x times one over f of x dx. What is that going to be? Here's where the reverse chain rule applies. Where I have one over f of x, if only I had it's derivative being multiplied by this thing then I could just integrate with respect to f of x. Well, I do, I have it's derivative right over here. It's multiplying times this thing. I can use the reverse chain rule to say that this is going to be equal to the natural log of the absolute value of the thing that I have in the denominator, which is f of x plus c and that is exactly... I've made it too wide so you can't see everything... but that's exactly what's going on right over here. I have, if I say this thing right over here, cosine of x is f of x, then sine of x is not quite the derivative, it's the negative of the derivative. F prime of x would be negative sine of x. How do I get that, how do I engineer it? What if I just threw a negative there and a negative there so it is essentially multiplying by negative one twice which is still going to stay positive. Negative sine of x, right over here, I'm trying to squeeze it in between the integral sine and the sine of x, this right over here, now that I put a negative sine of x, that is the derivative of cosine of x. This is f prime of x so I can just apply the reverse chain rule. This is going to be, we deserve a little mini drum roll here, this is going to be equal to the natural log of the absolute value of our f of x, which is going to be cosine of x. Then, of course, we have our plus c and we can't forget we had this little negative sitting out here so we're going to have to put the negative right over there. And we are done, we just figured out that's kind of a neat result because it feels like that's something we should know how to take the indefinite integral of. The indefinite integral of tangent of x is, and it's neat they're connected in this way, is the negative natural log of the absolute value of cosine of x plus c.