# Integrating $\int\frac{dx}{(x-a)(x-b)}$ by means of a trigonometric substitution

I've been trying to integrate $$\int\frac{dx}{(x-a)(x-b)}$$

By using the substitution $$x=a \cos^2 \theta + b \sin^2 \theta$$

The only problem here is I arrived at the result $$\frac{2}{a-b} \ln |\csc 2\theta - \cot 2\theta|+c$$

and I having trouble on how to substitute from $$\theta$$ to $$x$$.

• Update: I think I've found the solution: It's the Pythagorean identity – Loo Soo Yong Feb 27 '19 at 18:49
• Do you have that $a$ and $b$ are both positive real numbers? Or is it allowed that one or both are negative? – Clayton Feb 27 '19 at 19:06
• I believe that both are positive real numbers – Loo Soo Yong Feb 27 '19 at 19:11
• Fantastic substitution btw! – user150203 Mar 1 '19 at 9:58

You can use a Weierstrass substitution: $$t:=\tan\theta\implies\csc 2\theta-\cot 2\theta=\frac{1+t^2}{2t}-\frac{1-t^2}{2t}=t=\sqrt{\frac{x-a}{b-x}}$$since$$x-a=(b-a)\sin^2\theta,\,b-x=(b-a)\cos^2\theta.$$

Take the middle of the two roots $$x_0=\dfrac{a+b}2$$ and make a substitution $$t=x-x_0$$

Then $$\displaystyle\int\dfrac{\mathop{dx}}{(x-a)(x-b)}=\int\dfrac{\mathop{dt}}{\left(t^2-(\frac{a-b}2)^2\right)}=-\dfrac 2{a-b}\tanh^{-1}\left(\dfrac{2t}{a-b}\right)+C\quad$$ for $$x\in[a,b]$$

Note: for $$x$$ outside $$[a,b]$$ use the form in $$\operatorname{cotanh}^{-1}$$ instead.

Rem: using the formula $$\tanh^{-1}(x)=\dfrac 12\ln\left(\dfrac{1+x}{1-x}\right)$$, I let you convince yourself it is the same as the answer given by GNU or Clayton.

In a doubt, you can look at this post for a similar approach, where I calculated in detail the equality with other forms of the result.

Integral of product of two inverse polynomials

This is not an answer, but I am posting an alternate method for fun. This algebraic approach should be simpler than the trigonometric substitution, and thus it's useful in exams/tests in which time is limited.

Observe that the integrand is a rational function which can be decomposed into two simple .

$$\frac{1}{(x-a)(x-b)} = \frac{1}{a-b} \left[ \frac{1}{x-a} - \frac{1}{x-b}\right]$$

This gives

\begin{aligned} \int\frac{dx}{(x-a)(x-b)} =& \frac{1}{a-b} \left[ \int\frac{dx}{x-a} - \int\frac{dx}{x-b}\right] \\ =& \frac{1}{a-b} (\ln|x-a| - \ln|x-b|) + C. \end{aligned}

As stated in the comments, we assume $$a$$ and $$b$$ are positive real numbers. In this case, without loss of generality, we may assume $$a\leq b$$. This gives $$x=a\cos^2(\theta)+b\sin^2(\theta)=a\cos^2\theta+a\sin^2\theta+(b-a)\sin^2\theta=a+(b-a)\sin^2\theta.$$This allows us to solve for $$\theta$$ so that we find $$\theta=\arcsin\sqrt{\frac{x-a}{b-a}\,}.$$Plugging into $$\csc(2\theta)$$ and $$\cot(2\theta)$$, applying double-angle formulas, and reducing the trigonometry (first using algebra to reduce to $$\tan\theta$$ and then using triangles), we find that $$\int\frac{1}{(x-a)(x-b)}\,dx = \frac{1}{a-b}\left(\ln|x-a|-\ln|x-b|\right)+C.$$

• The sign of the coefficient on the left should be inverted. Please see my answer as well as Wolfram Alpha for reference. – GNUSupporter 8964民主女神 地下教會 Mar 8 '19 at 9:23
• It was a typo, @GNUSupporter8964民主女神地下教會: thanks. I used Wolfram to verify as well :P Also, I can't speak for others, but I'd suggest definitely feel free to correct typos like that in the future :) – Clayton Mar 8 '19 at 13:10