# Integral of $\sqrt{1+\tan^2x}$ [duplicate]

Possible Duplicate:
Ways to evaluate $\int \sec \theta d \theta$

I'm having a bit of a problem with an integral. The original problem was the length of a curve given parametrically. I've managed to reduce that integral to:

$$\int_0^{\pi/4}\sqrt{1+\tan^2x}\ \mathrm{d}x$$

I've tried some substitions for $\tan x$, but always got stuck on a worse form.

• Are you aware that $\cos^2(x) + \sin^2(x) = 1$? If so, then write $1 + \tan^2(x) = \frac{\cos^2(x) + \sin^2(x)}{\cos^2(x)}$. – JavaMan Jun 10 '11 at 12:41

## 3 Answers

This integral is discussed in most calculus books. I will write a detailed solution, because thinking about this integral gives a good workout in techniques of integration.

You have already been told about the useful identity $$1+\tan^2 x=\frac{1}{\cos^2 x}.$$

You may have seen this identity as

$$1+\tan^2x =\sec^2 x.$$

There are slightly tricky things about taking square roots, but they are not a problem in the interval where you are working. We end up wanting to find $\int \sec x dx$, or equivalently $\int dx/(\cos x)$.

The strategy we will use is one that is useful when we are integrating a combination of powers of $\sin x$ and $\cos x$, with one of the powers odd.

Rewrite the integral as $$\int \frac{\cos x}{\cos^2 x}dx = \int \frac{ \cos x}{1 -\sin^2 x}dx.$$

Make the substitution $u=\sin x$. Then $du=\cos x dx$. So now our indefinite integral is $$\int \frac{du}{1-u^2}.$$ It is more convenient to make the substitution in the "limits" of integration. When $x=\pi/4$, we have $u=1/\sqrt{2}$ and when $x=0$, we have $u=0$, so we want $$\int_{u=0}^{\pi/4} \frac{du}{1-u^2}.$$

Our integral is now in perfect shape for the method of "partial fractions." By going through the machinery of partial fractions, or by inspection, we have $$\frac{1}{1-u^2}=\frac{1}{1-u^2}=\frac{1/2}{1-u}+\frac{1/2}{1+u}.$$

We have arrived at $$\int_0^{1/\sqrt{2}} \left(\frac{1/2}{1-u}+\frac{1/2}{1+u}\right)du.$$

Finally, everything is easy. By substitution, or by inspection, we have $$\int\frac{1/2}{1-u}du=-(1/2)\ln(|1-u|) +C \qquad\text{and}\qquad \int\frac{1/2}{1+u}du=(1/2)\ln(|1+u|) +C.$$ (We don't have to worry about the constant of integration, since now we will be substituting the limits.) If we are in the mood, we can combine things, using the properties of logarithms, to conclude that the indefinite integral is $$\frac{1}{2}\ln\left(\left|\frac{1+u}{1-u}\right|\right)+C.$$

A lot of work! But at least we got to practice a lot of techniques of integration. The integral $\int \sec x dx$ is one of the nastiest ones that one is likely to meet. Actually, it does show up in real applications.

A magic way: We want $$\int \sec x dx.$$ Multiply "top" and "bottom" by $\sec x +\tan x$. We get $$\int \frac{\sec^2 x +\sec x\tan x}{\sec x+\tan x}dx.$$ Let $u=\sec x+\tan x$. Then from standard (?) differentiation formulas, we have $$du =\sec x\tan x+\sec^2 x.$$ Note that this is more or less exactly what we have on top. So our indefinite integral simplifies to $$\int \frac{du}{u}=\ln |u| +C$$ and it's over.

Why the magic substitution? Because it works, and I happen to remember it. However, the slow, systematic procedure that was the first one discussed is the one you should concentrate on.

And there are a number of other approaches to the integral!

• Thanks! Great explanation. – vvondra Jun 11 '11 at 9:45
• @rockford: You are welcome. The idea of writing this much detail was that you would learn something beyond the actual question. – André Nicolas Jun 11 '11 at 9:52

As DJC told you, you may write $1+\tan^2 x$ using a common denominator as $$\frac{\cos^2 x+ \sin^2 x}{\cos^2 x} = \frac{1}{\cos^2 x}$$ so the square root of it is simply $\cos x$. Well, it's the absolute value - for real values of $\cos x$ - but $\cos x$ is positive between $0$ and $\pi/4$, anyway.

So the goal is to integral $1/\cos x$ from $0$ to $\pi/4$. One finds the indefinite integral first. It is $$\int \frac{1}{\cos x} dx = \ln \left[\frac{\cos (x/2) + \sin(x/2)}{\cos (x/2) - \sin(x/2)}\right] + C$$ You may differentiate the right hand side to see that you get the left hand side. Now, the definite integral is the difference of this function between $\pi/4$ and $0$ which is actually ${\rm arcsinh}(1)$.

Here is a way to understand the "Magic way."

What is the derivative of $\sec(x)$? It is $\tan(x)\sec(x)dx$. What is the derivative of $\tan(x)$? It is $\sec(x)^2dx$. From looking at this, we can see that if we factor $\sec(x)$ out of the sum, we get the sum again ! Precisely this means that $$(\sec(x)+\tan(x))'=\sec(x)(\sec(x)+\tan(x)).$$ Hence $$\sec(x)=\frac{(\sec(x)+\tan(x))'}{\sec(x)+\tan(x)}=\left(\log |\sec(x)+\tan(x)|\right)'$$ where the last equality comes from recognizing the logarithmic derivative.

Hope that helps.