# Struggling with an integral with trig substitution

I've got another problem with my CalcII homework. The problem deals with trig substitution in the integral for integrals following this pattern: $\sqrt{a^2 + x^2}$. So, here's the problem:

$$\int_{-2}^2 \frac{\mathrm{d}x}{4 + x^2}$$

I graphed the function and because of symmetry, I'm using the integral: $2\int_0^2 \frac{\mathrm{d}x}{4 + x^2}$

Since the denominator is not of the form: $\sqrt{a^2 + x^2}$ but is basically what I want, I ultimately decided to take the square root of the numerator and denominator:

$$2 \int_0^2 \frac{\sqrt{1}}{\sqrt{4+x^2}}\mathrm{d}x = 2 \int_0^2 \frac{\mathrm{d}x}{\sqrt{4+x^2}}$$

From there, I now have, using the following: $\tan\theta = \frac{x}{2} => x = 2\tan\theta => dx = 2\sec^2\theta d\theta$

$$\begin{array}{rcl} 2\int_{0}^{2}\frac{\mathrm{d}x}{4+x^2}\mathrm{d}x & = & \sqrt{2}\int_{0}^{2}\frac{\mathrm{d}x}{\sqrt{4+x^2}}\mathrm{d}x \\ & = & \sqrt{2}\int_{0}^{2}\frac{2\sec^2(\theta)}{\sqrt{4+4\tan^2(\theta)}}\mathrm{d}\theta \\ & = & \sqrt{2}\int_{0}^{2}\frac{2\sec^2(\theta)}{2\sqrt{1+\tan^2(\theta)}}\mathrm{d}\theta \\ & = & \sqrt{2}\int_{0}^{2}\frac{\sec^2(\theta)}{\sqrt{\sec^2(\theta)}}\mathrm{d}\theta \\ & = & \sqrt{2}\int_{0}^{2}\frac{\sec^2(\theta)}{\sec(\theta)}\mathrm{d}\theta \\ & = & \sqrt{2}\int_{0}^{2}\sec(\theta)\mathrm{d}\theta \\ & = & \sqrt{2}\left [\ln{\sec(\theta)+\tan(\theta)} \right|_{0}^{2}] \\ & = & \sqrt{2}\left [ \ln{\frac{\sqrt{4+x^2}}{2}+\frac{x}{2} } \right|_{0}^{2} ] \end{array}$$

I'm not sure if I've correctly made the integral look like the pattern it's supposed to have. That is, trig substitutions are supposed to be for $\sqrt{a^2 + x^2}$ (in this case that is, there are others). This particular problem is an odd numbered problem and the answer is supposed to be $\frac{\pi}{4}$. I'm not getting that. So, the obvious question is, what am I doing wrong? Also note, I had trouble getting the absolute value bars to produce for the ln: don't know what I did wrong there either.

Thanks for any help, Andy

-
Why is it OK to take the square root of numerator and denominator? By your reasoning, $1/2 = 1/\sqrt{2}$. – Ron Gordon Apr 1 '13 at 20:43
You do know that $\displaystyle \int \frac{dx}{a^2+x^2} = \frac{1}{a} \arctan \frac{x}{a} + C$, right? – Andrew Salmon Apr 1 '13 at 20:43
@AndrewSalmon Evidently not! – Adam Saltz Apr 1 '13 at 20:47
On thing at least is incorrect: Don't write $\ln\sec\theta+\tan\theta$ if you mean $\ln(\sec\theta+\tan\theta)$. Those are two different things. – Michael Hardy Apr 1 '13 at 21:32
@RonGordon hooray! $\sqrt2$ is rational :-) – oldrinb Apr 1 '13 at 22:40

Hint: you can cut your work considerably by using the trig substitution directly into the proper integral, and proceeding (no place for taking the square root of the denominator):

You have $$2\int_0^2 \frac{dx}{4+x^2}\quad\text{and NOT} \quad 2\int_0^2 \frac{dx}{\sqrt{4+x^2}}$$

But that's good, because this integral (on the left) is what you have and is already in in the form where it is appropriate to use the following substitution:

Let $x = 2 \tan \theta$, which you'll see is standard for integrals of this form.

As suggested by Andrew in the comments, we can arrive at his suggested result, and as shown in Wikipedia:

Given any integral in the form

$$\int\frac{dx}{{a^2+x^2}}$$

we can substitute

$$x=a\tan(\theta),\quad dx=a\sec^2(\theta)\,d\theta, \quad \theta=\arctan\left(\tfrac{x}{a}\right)$$

Substituting gives us:

\begin{align} \int\frac{dx}{{a^2+x^2}} & = \int\frac{a\sec^2(\theta)\,d\theta}{{a^2+a^2\tan^2(\theta)}} \\ \\ & = \int\frac{a\sec^2(\theta)\,d\theta}{{a^2(1+\tan^2(\theta))}} \\ \\ & = \int \frac{a\sec^2(\theta)\,d\theta}{{a^2\sec^2(\theta)}} \\ \\ & = \int \frac{d\theta}{a} \\ &= \tfrac{\theta}{a}+C \\ \\ & = \tfrac{1}{a} \arctan \left(\tfrac{x}{a}\right)+C \\ \\ \end{align}

Note, you would have gotten precisely the correct result had you not taken the square root of $\sec^2\theta$ in the denominator, i.e., if you had not evaluated the integral of the square root of your function.

-
But the original poster did use the substitution $x=2\tan\theta$. – Michael Hardy Apr 1 '13 at 21:34
Thank you all. I think I see my problem. The textbook says that these substitutions are for forms of $\sqrt{a^2 + x^2}$, then proceeds to give many examples of $\int\frac{dx}{\sqrt{a^2 + x^2}}$. Because this didn't have the radical, I was making the assumption that $x^2 = 2tan(\theta) => x = \sqrt{2tan(\theta)}$. I saw that what was given was the form I needed, but was lacking the one component that I thought was necessary. Learning can be so humbling. Thanks again. – Andrew Falanga Apr 2 '13 at 16:22
Andrew: We are all humbled when learning something new! (See my profile: first quote!) You did the hard part of your problem, and applied the substitution correctly: it's just that trying to make it conform to $\sqrt{\cdot}$ wasn't needed here. – amWhy Apr 2 '13 at 16:27

I think you correctly computed $$\sqrt{2}\int_0^2 \frac{dx}{\sqrt{4+x^2}}$$ but this has nothing to do with $2\int_0^2 \frac{dx}{4+x^2}$. They certainly aren't guaranteed to be equal. For example, $$\int_0^1 x^2 \; dx = 1/3$$ while $$\int_0^1 x \;dx = 1/2.$$

Let's get back to your original question. You can use a trig substitution for this problem, but Andrew Salmon has proposed an easier way. $$2\int_0^2 \frac{dx}{4+x^2} = \frac{2}{4}\int_0^2 \frac{dx}{1 + (\frac{x}{2})^2}.$$ Now substitute $u = x/2$ and use the formula $\int \frac{dx}{1+x^2} = \arctan(x) + C$.

To use a trig substitution, note that $4+x^2 = (\sqrt{4+x^2})^2$, so $4+x^2$ is of the appropriate form. (Alternatively, be bold! and do the substitution without worrying about this.) Just use $x = 2\tan(\theta)$.

-

Consider the triangle with angle $\theta$, adjacent$=2$, opposite$=x$, and hypotenuse$=\sqrt{4+x^2}$. Then

$${2\over\sqrt{4+x^2}}={\text{adj}\over\text{hyp}}=\cos\theta.$$

Also, we need the $d\theta$ element, so let's take the simplest relation ${x\over 2}=\tan\theta$. Then $dx=2\sec^2\theta$. Thus,

$$\int_{x=-2}^2{4\over4+x^2}dx=\int\cos^2\theta\sec^2\theta d\theta=\theta=\tan^{-1}{x\over2}\bigg|_{x=-2}^2=\tan^{-1}(1)-\tan^{-1}(-1)={\pi\over2}.$$

Simply divide by 4.

-
oops, i forgot the 2 from dx=2sec theta – Brady Trainor Apr 2 '13 at 4:08

Let $x=2\tan\theta$ and $dx=2 \sec^2\theta$

$2\tan\theta = -2, 2$

$\theta = \frac{-\pi}{4}, \frac{\pi}{4}$

$\int_{\frac{-\pi}{4}}^\frac{\pi}{4}\frac{2\sec^2\theta}{4+4\tan^2\theta}d\theta$

$\int_{\frac{-\pi}{4}}^\frac{\pi}{4}\frac{2\sec^2\theta}{4\sec^2\theta}d\theta$

$\int_{\frac{-\pi}{4}}^\frac{\pi}{4}\frac{1}{2} d\theta$

$\frac{\pi}{8}-\frac{-\pi}{8} = \frac{\pi}{4}$

Sorry about the formatting. I'm just learning latex.

-
That's ok, I have to admit, the LaTeX formatting threw me for a loop too. In fact, I'd typed this up the night before I posted but couldn't get the parser to understand what I meant. I gave up in frustration. The next day, I discovered, it was because I need to have the arguments to the trig functions wrapped in parenthesis. lol (you'd think as a programmer, I'd have known that) – Andrew Falanga Apr 2 '13 at 16:13