# How to calculate this definite integral :- $\int_0^\pi \frac{x}{a^2\cos^2x + b^2\sin^2x} \,dx$?

This question was in a test I took: calculate the value of the integral $$\int_0^\pi \dfrac{x}{a^2\cos^2x + b^2\sin^2x} \,dx.$$

I was not able to solve it. Now, I've tried to do some substitutions for $x$ but honestly I don't actually know how to proceed with this integral.

As I have not solved such questions before, I don't know the general direction in which I need to go so I don't know which efforts to include here and which to not.

All I know is that those constants a & b are the source of much of the trouble for me but I don't know how to get rid of them.

I also want to know whether there is only a single way to solve it (which maybe I've not practised enough) or - like many other problems - it can be solved by more than one method.

I would really appreciate if I find different solutions of this problem here but (if you can help it) please don't include any incredibly tough/ esoteric theorems or concepts/ higher-level stuff that I can't be expected to know at my current level. Thanks!

• can we assume that $$a,b>0$$? Oct 13, 2017 at 16:24
• @Dr.SonnhardGraubner, I don't think it was explicitly given in the question. But I am interested, why is that important? Oct 13, 2017 at 16:30
• @Dr.SonnhardGraubner One can at least assume that $a=|a|$ and $b=|b|$ for sure.
– A.Γ.
Oct 13, 2017 at 16:33
• The definite integral is $\frac{\pi ^2}{2 a b}$ The indefinite integral is VERY difficult! tinyurl.com/ybzu5492 Oct 13, 2017 at 16:52
• @Raffaele, how did you get the solution for the definite integral so quickly? Oct 13, 2017 at 17:47

Use $\int _a^b f (x)=\int _a^b f (a+b-x ) \, dx$ to get $2I=\int _a^b \frac {\pi}{a^2\cos^2 (x)+b^2\sin^2 (x)} \,dx$ now take $\cos^2 (x)$ common and let $\tan (x)=t$ thus $\sec^2 (x) \, dx=dt$ hope you can continue with basic integral from here.
• Sorry, but I don't follow how you got $2I=\int _a^b \frac {\pi}{a^2\cos^2 (x)+b^2\sin^2 (x)}$ from the given property. Oct 13, 2017 at 16:34
• Where it says "take $\cos^2 x$ common", I think it means write $$\frac \pi {a^2\cos^x + b^2\sin^2 x} \, dx = \left( \frac \pi { a^2 + b^2 \frac{\sin^2 x}{\cos^2 x} }\right) \left( \frac{dx}{\cos^2 x} \right)$$ and then $\sin^2 x/\cos^2 x$ becomes $\tan^2 x$ and $dx/\cos^2 x = \sec^2 x\, dx = d(\tan x). \qquad$ Oct 13, 2017 at 16:37
• See we have $I=\int _a^b f (x)dx=\int_a^b (\frac {\pi}{a^2cos^2 (x)+b^2sin^2 (x)}-\frac{x}{a^2cos^2 (x)+b^2sin^2 (x)}dx$ now see that the part in front of minus is f (x) $hence the result. Oct 13, 2017 at 16:39 • make the substitution$x = \pi - u$and simplify and you will get that$\int_0^\pi \frac {x}{a^2\cos^2 x + b^2\sin^2 x} \ dx = \int_0^\pi \frac {\pi - u}{a^2\cos^2 u + b^2\sin^2 u} \ duOct 13, 2017 at 16:40 • You are welcome @ Mr Reality. Oct 13, 2017 at 17:09 \begin{align} & \int_0^\pi \frac x {a^2\cos^2x+b^2\sin^2x} \, dx = I \\[10pt] & \int_0^\pi \frac x {a^2\cos^2x+b^2\sin^2x} \, dx = \int_0^\pi \frac {\pi-x} {a^2\cos^2(\pi-x)+b^2\sin^2(\pi-x)} \, dx \\[10pt] I = {} & \int_0^\pi \frac{\pi-x}{a^2\cos^2x+b^2\sin^2x} \, dx \\[10pt] = {} & \int_0^\pi \frac \pi {a^2\cos^2x+b^2\sin^2x} \, dx - I \\[10pt] 2I = {} & \frac 1 {a^2} \int_0^\pi \frac{\pi\sec^2 x}{1 + \left( \frac b a \tan x \right)^2} \, dx \\[10pt] = {} & \left. \frac \pi {ab} \tan^{-1} \left( \frac b a \tan x \right) \right|_0^\pi \end{align} The answer using the famous identity • The answer cannot be0$, as the integrand is positive over the range of integration... Oct 13, 2017 at 16:43 • you can use that$\frac {\sec^2 x}{a^2 + b^2 \tan^2 x}$is symmetric about the line$x = \frac {\pi}{2}$so$\int_0^{\pi} \frac {\pi \sec^2 x}{a^2 + b^2\tan^2 x} \ dx = 2\int_0^{\frac {\pi}{2}} \frac {\pi \sec^2 x}{a^2 + b^2\tan^2 x} \ dx \implies I = \frac {\pi^2}{2|ab|}$Oct 13, 2017 at 16:52 • And to note why the$0$answer was wrong : the FTC doesn't hold if there is a discontinuity in the domain of integration. Oct 13, 2017 at 16:57 • Where the dicontinuity in the domain of integration ? Oct 13, 2017 at 17:02 • @HussienMohamed : It is at$x=\pi/2,$where the tangent and secant have a vertical asymptote. One could consider them continuous there by taking their value to be$\infty,$construing that not as$+\infty$or$-\infty,$but as a single$\infty\$ at both ends of the line, but one must exam the conditions under which this way of proceeding is valid. Otherwise your method looks good, although I'd be more explicit about explaining some of the details. Oct 13, 2017 at 17:04