Take the 2-minute tour ×

I am trying to evalute the following integral:

Integrate[Cos[θ] Cos[ArcTan[a^2/b^2 Tan[φ]]], {φ, 0, 2π}]

I know that for $a=b$ I should get 0 out of the integral since I would be integrating something of the form $A \cos \phi d\phi$ completely around a circle.

The issue is that the answer for the equation above is: $\frac{4 b^2 \cos (\theta ) \cos ^{-1}\left(\frac{a^2}{b^2}\right)}{\sqrt{b^4-a^4}}$

Which, if I take the limit $a=b$ like this:

Limit[(4 b^2 ArcCos[a^2/b^2] Cos[θ])/Sqrt[-a^4 + b^4], b -> a]

Results in $4 \cos \theta$ which is typically not 0.

It seems like the $\arctan$-$\tan$ combination is messing things up, but I am not sure. Can anybody explain why this happens and how I can get to the correct solution?


I am already assuming $a>0$, $b>0$ and both $a$ and $b$ to be real.

[EDIT 2] I only just fully understood what the comment of @b.gatessucks implies: I need to divide the integral in pieces and take care to shift the phase of $\tan$ appropriately.

[EDIT 3] Physically the meaning of the argument of the $\cos$ looks like this: ellipse with annotation

Where $\tan \psi = \frac{a^2}{b^2} \tan\phi$. So I know that $\psi$ should run from 0 to 360 deg

share|improve this question
What's happening is that Simplify@Cos[ArcTan[ Tan[\[Phi]]]] -> 1/Sqrt[Sec[\[Phi]]^2] so you have a modulus. –  b.gatessucks Mar 21 '13 at 14:38

2 Answers 2

Thanks to the comment of @b.gatessucks I have solved the issue by splitting the integral into 3 parts where I shift one part by $\pi$ like this:

$\int_{\frac{\pi }{2}}^{\frac{3 \pi }{2}} \cos (\theta ) \cos \left(\tan ^{-1}\left(\frac{a^2 \tan (\phi )}{b^2}\right)+\pi \right) \, d\phi +\int_0^{\frac{\pi }{2}} \cos (\theta ) \cos \left(\tan ^{-1}\left(\frac{a^2 \tan (\phi )}{b^2}\right)\right) \, d\phi +\int_{\frac{3 \pi }{2}}^{2 \pi } \cos (\theta ) \cos \left(\tan ^{-1}\left(\frac{a^2 \tan (\phi )}{b^2}\right)\right) \, d\phi$

which gives me the answer

$-\frac{i b^2 \sqrt{b^4-a^4} \cos (\theta ) \left(2 \cosh ^{-1}\left(\frac{a^2}{b^2}\right)-\log \left(-i \left(\frac{a^2}{\sqrt{a^4-b^4}}+1\right)\right)+\log \left(i \left(1-\frac{a^2}{\sqrt{a^4-b^4}}\right)\right)\right)}{2 |a^4-b^4| }$

Taking the limit of $a=b$ in that case correctly evaluates to 0. (In fact, the integral always evaluates to 0, because I integrate a constant value over a closed curve)

share|improve this answer
Please post the Mathematica code for that (as well). Pretty-print is difficult to evaluate. –  Yves Klett Mar 21 '13 at 16:34
It's not clear to me that this is correct (for the original question). The standard inverse tangent is a function and has a fixed range, normally -Pi/2 to Pi/2. In that case one has that Cos[ArcTan[X]] is greater than or equal to zero for all (real) X, including X = Tan[phi]. Unless the integrand is identically zero (except on a set of measure zero), the integral should be a positive multiple of Cos[theta]. Perhaps you want the factor to be Cos[ArcTan[a^2 Sin[phi], b^2 Cos[phi]]], which integrates to zero in agreement with your answer. –  Michael E2 Mar 21 '13 at 22:20
@MichaelE2 no I am sure the phase-shift is the correct thing to do. The reason is that ArcTan[(a/b)^2 Tan[[Phi]]] represents the angle the interface normal of an ellipse makes with the x-axis as determined from the angle the local x,y coordinates make with the x-axis (this angle is $\phi$). So I know that the whole thing should run from 0 to 360 deg and that the minima and maxima should coincide with those found when a=b. ---- So maybe I didn't explain enough of the background of the problem in my original question, but this is what I was looking for –  Michiel Mar 22 '13 at 6:48
That is the alternative I suggested: ArcTan[a^2 Sin[phi], b^2 Cos[phi]] equals ArcTan[a^2 Tan[phi]/ b^2] plus phase shift, just what you show on the ellipse. Mathematica already has the function you want, and you don't have to break the integral apart. See the two versions of ArcTan in the documentation. –  Michael E2 Mar 22 '13 at 10:20
I had tried it, but it gave a very different result. However, looking at the documentation I found that I should use ArcTan[b^2 Cos[phi]],a^2 Sin[phi]] to get the correct result. Thanks! If you could write it as an answer I will definitely accept it. –  Michiel Mar 22 '13 at 12:47

I will drop cos(theta) and rename a/b=x. Then you integral has the form:

 int = Integrate[ Cos[ArcTan[x^2 Tan[\[Phi]]]], {\[Phi], 0, 2 \[Pi]}, 
  Assumptions -> x > 0]


(4 ArcCosh[x^2])/Sqrt[-1 + x^4]

At x=1 one can find a finite limit:

Limit[int, x -> 1]

equal to 4. One can also plot it:

Plot[int, {x, 0, 2}]

returning this plot: enter image description here

share|improve this answer
Thanks for the explanation of how to get the answer to the integral, but I found out that it was in fact not the answer to the integral that was incorrect, but rather what I fed it: the Cos[ArcTan[ Tan[[Phi]]]] which has a modulus at $\pi/2$ –  Michiel Mar 21 '13 at 15:58

Your Answer


