Thursday, 23 February 2017

LaTeX and Integrating Square Root of Tangent Function

The following integration follows the steps outlined in this YouTube video that I watched, so I'm not claiming any originality here. However, I wanted to practise my LaTeX skills and so, using MacTex, a LaTeX implementation for OS X, and TeXShop, the front-end text editor, I translated the steps outlined in the video into LaTeX. MacTex produced a crisp PDF output file but later I wondered what would happen if I copied the code and pasted it into this blog. Well, turns out it rendered almost perfectly. The result is shown below:

**********************************************

How can we deal with  \( \! \! \int \sqrt{\tan x} \, \mathrm {d} x \)? If the square root sign wasn't there it would be easy and we'd get \( \ - \log(\cos x)+C \). However, it is there and we need to find a way to deal with it. Well, it turns out that there is a judicious substitution that we can use to get the process started and that substitution is \( u=\sqrt{\tan x} \).

This means that \( u^2=\tan x \) and so \( {2 \, u \, \mathrm {d} u} /{\mathrm {d}  x}=\sec^2 x \). \( \mathrm{d}x \)can now be written as \( 2 \, u \, \mathrm {d} u /sec^2 x \) and thus the integral becomes \( \! \! \int 2 \, u^2 \, \mathrm{d} u/\sec^2x \)and the problem now is to express \( \sec^2 x \) in terms of \(u\). Fortunately that's not too difficult with recourse to a little trigonometry. We know \( \tan x=u^2 \) and if we write this as \( \tan x=u^2/1 \) (opposite over adjacent) then the hypotenuse of the associated right-angled triangle is \( \sqrt{1+u^4} \).

Thus \( \cos x=1/\sqrt{1+u^4} \), \( \sec^2 x=1+u^4 \) and the integral becomes: $$\! \! \int \frac{2 \, u^2}{1+u^4} \mathrm {d} u$$There is still a way to go before we arrive at the solution to our problem but this is a far more manageable integral than the one that we started with. Now we need to spend some time manipulating the integral to get it into the right form. Firstly, let's divide top and bottom by \(u^2\). This gives us: $$\! \! \int \frac {2} {u^2+1/u^2} \mathrm {d} u$$The next step is to us modify the numerator 2 so that it looks like this:$$1+1/u^2+1-1/u^2$$Now we separate the integral into two halves as follows:$$\! \! \int \frac {1 + 1/u^2}{u^2+1/u^2} \mathrm {d} u \quad + \quad \! \! \int \frac {1 - 1/u^2}{u^2+1/u^2} \mathrm {d} u$$The denominators in both integrals can be rewritten as shown:$$\! \! \int \frac {1 + 1/u^2}{(u-1/u)^2+2} \mathrm {d} u \quad + \quad \! \! \int \frac {1 - 1/u^2}{(u+1/u)^2-2} \mathrm {d} u$$Each integral needs to be dealt with separately so let's begin with the integral on the left hand side. However, we need to make another substitution before we proceed. Let $t=u-1/u$. Differentiating both sides w.r.t. u, gives $\mathrm {d} t/\mathrm{d}u=1+1/u^2$ and so the integral on the left hand side can be rewritten:$$\! \! \int \frac {1 + 1/u^2}{(u-1/u)^2+2} \mathrm {d} u=\! \! \int \frac {1}{t^2+2} \mathrm {d} t$$An integral of the form $$\! \! \int \frac {1}{t^2+a^2} \mathrm {d} t =\frac{1}{a} \tan^{-1} \bigg (\frac{t}{a}\bigg ) + C $$and so we end up with $$\frac{1}{\sqrt{2}}\tan^{-1} \bigg (\frac {t}{\sqrt{2}}\bigg ) + C $$Now we need to backtrack, replacing $t$ by $u$ and $u$ by $\sqrt{\tan x}$. This will give us firstly $$\frac{1}{\sqrt{2}}\tan^{-1} \bigg (\frac {u-1/u}{\sqrt{2}}\bigg ) + C $$And then $$\frac{1}{\sqrt{2}}\tan^{-1} \bigg (\frac {\sqrt{\tan x}-1/\sqrt{\tan x}}{\sqrt{2}}\bigg ) + C $$But this is only the left hand side of our integral! Now we need to go back and deal with the right hand side integral which was:$$\quad \! \! \int \frac {1 - 1/u^2}{(u+1/u)^2-2} \mathrm {d} u$$This time let $t=u+1/u$. Differentiating both sides w.r.t. u, gives $\mathrm {d} t/\mathrm{d}u=1-1/u^2$ and so the integral on the left hand side can be rewritten:$$\quad \! \! \int \frac {1 - 1/u^2}{(u+1/u)^2-2} \mathrm {d} u=\! \! \int \frac {1}{t^2-2} \mathrm {d} t$$This integral can be solved by rewriting $t^2-2$ as $(t-\sqrt{2})(t+\sqrt{2})$ and then using the method of partial fractions to find A and B in the expression:$$\frac{A}{t-\sqrt{2}}+\frac{B}{t+\sqrt{2}}$$This leads to $(A+B)t+(A-B)\sqrt{2}=1$, $A=-B$, $2A\sqrt{2}=1$ and $A=1/2\sqrt{2}$
Hence $B=-1/2\sqrt{2}$ and the integral can be now be rewritten as:$$\int \frac{1/2\sqrt{2}}{t-\sqrt{2}} \mathrm {d} t-\int \frac{1/2\sqrt{2}}{t+\sqrt{2}} \mathrm {d} t$$Both these integrals are natural logarithms and so the result obtained is:
$$\frac{1}{2\sqrt{2}}(\ln (t-\sqrt{2})-\ln (t+\sqrt{2}))+C$$This simplifies to:$$\frac{1}{2\sqrt{2}}\ln \bigg(\frac {t-\sqrt{2}}{t+\sqrt{2}} \bigg )+C$$Now we need to backtrack, replacing $t$ by $u$ and $u$ by $\sqrt{\tan x}$. This will give us firstly$$\frac{1}{2\sqrt{2}}\ln \bigg(\frac {(u+1/u)-\sqrt{2}}{(u+1/u)+\sqrt{2}} \bigg )+C$$And then $$\frac{1}{2\sqrt{2}}\ln \bigg(\frac {(\sqrt{\tan x}+1/\sqrt{\tan x})-\sqrt{2}}{(\sqrt{\tan x}+1/\sqrt{\tan x})+\sqrt{2}} \bigg )+C$$Putting both integrals together now we get the result that:$$\! \! \int \sqrt{\tan x} \mathrm {d} x=\frac{1}{\sqrt{2}}\tan^{-1} \bigg (\frac {\sqrt{\tan x}-1/\sqrt{\tan x}}{\sqrt{2}}\bigg )+ \\ \frac{1}{2\sqrt{2}}\ln \bigg(\frac {(\sqrt{\tan x}+1/\sqrt{\tan x})-\sqrt{2}}{(\sqrt{\tan x}+1/\sqrt{\tan x})+\sqrt{2}} \bigg )+C$$
It was an arduous process but in the end our goal was accomplished.

No comments:

Post a Comment