# Integration of a function

Hello,
Recently, a friend challenged me to solve the integration of this function:
f(x) = tan^4(x)/cos^3(x)
After about a page of work, i found that i must integrate this:
x^4 / sqrt(x^2 -1)

Simply, the question is:
How can i integrate x^4/sqrt(x^2-1)?

D H
Staff Emeritus
A friend or a teacher asked you to solve this? This looks a bit too much like homework.

So, some hints:
1. Reduce f(x) to a polynomial in sec(x).
2. There is a handy formula for reducing $\int \sec^m x dx$ to a (somewhat) simpler form that reduces the power m in the integral to m-2. Find it, or derive it.
3. Eventually you will need to find $\int \sec x dx$.

do you mean by reduction formula like:
S(f(x)*g(x))dx = fx*Sg(x) - S(Sg(x)*f'(x))dx?
note: S = the... integration sign
sorry for writing this way :)

D H
Staff Emeritus
No. Here is an example of a reduction formula:

$$\int \cos^m x\,dx = \frac 1 m\cos^{m-1}x\sin x \;+\;\frac{m-1}m\int\cos^{m-2}x\,dx$$

Notice how the above reduces the power of cos(x) by two from the integral on the left-hand side to the integral on the right-hand side. This expands recursively. Also note that the above pertains to cos(x), not sec(x). The above is not the integral you want to use. The above integral is illustrative but is not directly applicable to this problem.

Before I help you any further, is this homework? Be honest, now.

its not really a homework.. a friend of mine got challenged by this question by another friend by his tutor (as he said) so he came asking me how to solve it (as the class math guy).. anyway, in addition for further help, where can i find the... proof that the reduction formula is correct..
im just not one of the types who take laws and do them.. i want to know where did it come from (i'd be thankful if you can show me where did it come from)
thanks for helping, would appreciate further help :)

When one of the powers of sin or cos is odd, then integration is trivial. In this case you can write (with S = Sin(x), C = Cos(x)):

S^4/C^7 dx =

S^4 C/C^8 dx =

S^4/(1-S^2)^4 dS

Which can be easily solved using partial fractions.

D H
Staff Emeritus
Regarding proving that the reduction formula given in post #4 is correct: just differentiate both sides with respect to x.

Deriving such formula is a bit trickier. That formula is obviously similar in form to integration by parts; in fact, you can derive the above by integration by parts. Just rewrite $\cos^mx$ as $\cos^{m-1}x\,\cos x$. That is a bit tedious, however.

Suppose you have a function f(x) of which you want to find the indefinite integral. Suppose also that you find, by cleverness or just good guessin', some function u(x) such that

$$\frac{du}{dx} = f(x) - g(x)[/itex] In other words, your guess is good, but not quite right. In terms of the desired integral, [tex]\int f(x)\,dx = u(x) + \int g(x)\,dx$$

Now suppose we want to integrate $\cos^n x$ wrt x. Let's guess the solution involves $u(x)=\sin x\cos^{n-1}x$ in some way. Differentiating wrt x,

\aligned \frac{du}{dx} &= \cos x \cos^{n-1}x + (n-1)\sin x \cos^{n-2} x(-\sin x) \\ &= \cos^n x - (n-1) (1-\cos^2 x) \cos^{n-2} x\\ &= n \cos^n x - (n-1)\cos^{n-2} x \endaligned

and thus

$$\int \cos^n\,x dx = \frac 1 n \sin x\cos^{n-1}x + \frac{n-1}n\int \cos^{n-2}x\,dx$$

Once again, the above is *not* the reduction formula you want to use to help solve this problem. You want something that works with secant, not cosine. You want to find a way to reduce

$$\int sec^n x\, dx$$

to something simpler. Before I give the answer away, try differentiating $\sin x \sec^{n-1} x$ with respect to x.

@Count_Iblis:
well how can integrate (1/(2(x-1))+1/(2(x+1)))^4?

@D_H
what do you exactly mean by "differentiate" ..?
i know that sinx sec^n-1 x is tan(x) * sec^n-2(x)
so the integration of tan(x) * sec^n-2 (x) is simply (sec^(n-1) (x))/(n-1) ... is that what i should find?

D H
Staff Emeritus
@D_H
what do you exactly mean by "differentiate" ..?
i know that sinx sec^n-1 x is tan(x) * sec^n-2(x)
Differentiate means "compute the derivative of".

D H
Staff Emeritus
Just to be crystal clear, try computing

$$\frac d{dx}(\sin x\cdot \sec^{n-1}x)$$

Try to express the result in terms of secant(x) only (i.e., there should be no other trig functions in the result).

The reason finding a reduction formula for $\int \sec^n x\,dx$ will help is because $\tan^4x/\cos^3x = (tan^2 x)^2\sec^3 x = (\sec^2 x - 1)^2\sec^3 x$.

Last edited:
CrimeBeats, there are some very efficient ways to do partial fraction expansion. E.g., in this case, you can write:

x^4/(x^2 - 1)^4

(x^2 - 1 + 1)^2/(x^2 - 1)^4 =

1/(x^2 - 1)^2 + 2/(x^2 - 1)^3 + 1/(x^2 -1)^4

This is not yet the complete partial fraction expansion but we are close. Let's hijack the partial fraction expansion of 1/(x^2 -1):

1/(x^2 - 1) = 1/2 [1/(x - 1) - 1/(x + 1)]

Differentiate both sides w.r.t. x:

-2x/(x^2 - 1)^2 = 1/2 [1/(x+1)^2 - 1/(x-1)^2] ----->

1/(x^2 - 1)^2 = 1/4 1/x [1/(x-1)^2 - 1/(x+1)^2]

The 1/x factor here seems to spoil things. However, this problem can easily be fixed as follows.

We have:

1/x 1/(x-1)^2 = 1/(x-1 + 1) 1/(x-1)^2 =

1/(x-1)^2 [1 - (x-1) + O(x-1)^2].

The singular part of the expansion around x = 1 is thus:

1/(x-1)^2 - 1/(x-1)

The singular part of the expansion around x = -1 is found in the same way. You write the 1/x factor as:

1/x = 1/(x+1-1) = -1/[1 - (x+1)]

and expand this in powers of x+1.

The sum of the two singular parts is the partial fraction expansion,. This is because the difference of the rational function and the sum of the singular parts of the expasions doesn't have any singulularites anymore and thus must be a polynomial. In our case, the difference clearly tends to zero at infinity, which means that it has to be zero everywhere. Note that doing partial fraction expansions this way requires one to consider all singularities in the complex plane.

D H
Staff Emeritus
Back to the original post,

After about a page of work, i found that i must integrate this:
x^4 / sqrt(x^2 -1)
How, exactly, did you arrive at this? I have a sinking suspicion you made a mistake in the page of math that led to this result.

I now see a one line solution to the integral, so simple that you can do it without paper and pencil.

D H
Staff Emeritus
I get a one-line solution in the end, but getting there is ugly. Did you use half-angle formulae or some such?

I get a one-line solution in the end, but getting there is ugly. Did you use half-angle formulae or some such?

What I thought was a one line solution is actually a four line solution. You can do a partial integration where you integrate the factor
tan^4(x) 1/cos^2(x). You then get an integral with integrand proportional to

tan^5(x) 1/cos^2(x) sin(x)

I forgot about that sin(x) factor when I thought that there was a one line solution. However, things are not so bad, as you can do a partial integration again. If you integrate the factor tan^5(x) 1/cos^2(x) you end up with an integral with integrand proportional to

tan^6(x) cos(x) =sin^6(x)/cos^5(x)

You then do partial integrations where you integrate sin(x)/cos^n(x), at each step the power of cos in the denominator gets reduced by 2 and the power of sin in the numerator gets reduced by 2. So after 2 steps you end up with the integral of sin^2(x)/cos(x) =

-cos(x) + 1/[cos(x)].

So, after four simple partial integration steps in total we end up with the integral of 1/cos(x). My favorite way of evaluating that is to shift x so that it becomes 1/sin(t) and then we use double angle formula:

1/sin(t) = 1/[2 sin(t/2) cos(t/2)] =

[sin^2(t/2) + cos^(t/2)]/[2 sin(t/2) cos(t/2)] =

1/2 tan(t/2) + 1/2 cot(t/2)

Integrating sin^4(x)/cos^(7) directly would yield 1/cos^3(x) after two steps, if you then replace the 1 by sin^2(x) + cos^2(x), you get the 1/cos(x) term and the other term can be partially integrated to yield the 1/cos(x) term. So, you then arrive at 1/cos(x) in only 3 steps but you have to keep track of two terms that combine to the
1/cos(x) term.

D H
Staff Emeritus
I like the reduction formula approach better. Personal preference.

First convert $\tan^4x/\cos^3x$ to a polyomial in $\sec x$:

$$\tan^4x/\cos^3x = (\tan^2x)^2\sec^3x = (\sec^2x-1)^2\sec^3x = \sec^7x - 2\sec^5x + \sec^3x$$

Thus

$$I = \int \frac{\tan^4x}{\cos^3x}dx = \int \left(\sec^7x - 2\sec^5x + \sec^3x\right)\,dx$$

The reduction formula applicable to this problem is

$$\int sec^nx\,dx =\frac 1 {n-1}\tan x \sec^{n-2} + \frac{n-2}{n-1}\int sec^{n-2}x\,dx$$

Note that integrating the $\sec^7x$ term will result in a solution term and a modification to the $\sec^5x$ term in the integral. Similarly, integrating the $\sec^5x$ term will result in another solution term and a modification to the final $\sec^3x$ term in the integral.

Starting with the $\sec^7x$ term,

$$\int \sec^7x\,dx = \frac 1 6 \tan x \sec^5 x + \frac 5 6 \int \sec^5 x\,dx$$

Substituting this back into the expression for the integral I,

$$I = \frac 1 6 \tan x \sec^5 x + \int \left(-\,\frac 7 6 \sec^5 x + \sec^3 x\right)\,dx$$

Reducing the $\sec^5x$ term yields

$$I = \frac 1 6 \tan x \sec^5 x - \,\frac 7 {24} \tan x \sec^3 x + \frac 1 8 \int sec^3 x\,dx$$

Using the reduction formula one last time to simplify that $\sec^3x$ integral,

$$I = \frac 1 6 \tan x \sec^5 x - \,\frac 7 {24} \tan x \sec^3 x + \frac 1 {16} \tan x \sec x + \frac 1 {16} \int \sec x\,dx$$

That is as far as the reduction can go. The final integral is well-known (but also takes many forms). I'll use

$$\int \sec x\,dx = \ln(\sec x + \tan x)$$

Thus

$$I = \frac 1 6 \tan x \sec^5 x - \,\frac 7 {24} \tan x \sec^3 x + \frac 1 {16} \tan x \sec x + \frac 1 {16} \ln(\sec x + \tan x)$$

Making this just a bit prettier,

$$I = \frac 1 {48} \Bigl(\tan x \sec x\left(8\sec^4 x - 14 \sec^2 x + 3\right) + 3 \ln(\sec x + \tan x)\Bigr)$$

Last edited:
@D_H comment #9,10:
f = sinx sec^n-1 x
f = tanx sec^n-2 x
f' = (n-2)tan^2 x sec^n-2 x + sec^n x
f' = ((n-2)sin^2 x +1)sec^n x

whats wrong -.-

@Count_Iblis comment#11 :
i've tried to think in another way...
i supposed that x^4/(x^2-1)^4 = A/(x-1)^4 + B/(x+1)^4
i found A = B = 1/16
then i integrated, the answer i got in this way was
-1/(48*(x-1)^3) -1/(48*(x+1)^3)
then we put x back as sin..

@D_H comment #12
this might be long... however here it is
i made it like S (sec^3 x tan x) (tan^3 x) dx
i made f = tan^3 x
y' = sec^3 x tan x
so its 1/3 * tan^3 x sec^3 x - S (sec^5 x tan^2 x) dx
= 1/3 * tan^3 x sec^3 x - S (tan^4 x sec^3 x)dx + S(sec^3 x tan^2 x) dx
since the required has repeated, i moved it to the another side... so that
S (tan^4 x sec^3 x)dx = 1/6 * tan^3 x sec^3 x + 1/2 * S(sec^3 x tan^2 x) dx
after doing almost the same as begin to the integration on the right:
= 1/6 * tan^3 x sec^3 x + 1/6 tan x sec^3 x - 1/6 S (sec^5) dx
then for the last integration on the right i made d = sec x and thats how i got x^4 / sqrt(x^2 -1)

sure its pain to read this :)

@D_H comment #16:
I guess what i've done in the above solution is reducing the tan.. yours reduced sec... i had to try more :)

so... is the answer -1/(48*(x-1)^3) -1/(48*(x+1)^3) is not correct... but why? cant i use partial integration for high powers?

D H
Staff Emeritus
CrimeBeats: I modified your response to take advantage of the LaTex capability offered at PhysicsForums. You might want to consider learning it.

@D_H comment #12
this might be long... however here it is
i made it like $I = \int (\sec^3 x \tan x) (\tan^3 x)\,dx$
i made $f = tan^3 x$, $y' = sec^3 x tan x$
so its

\aligned I &= \frac 1 3 \tan^3 x \sec^3 x - \int (\sec^5 x \tan^2 x)\, dx \\ &= \frac 1 3 \tan^3 x \sec^3 x - \int (tan^4 x sec^3 x)\,dx + \int(sec^3 x tan^2 x)\,dx \endaligned

since the required has repeated, i moved it to the another side... so that

$$I = \frac 1 6 \tan^3 x \sec^3 x + \frac 1 2 \int (\sec^3 x \tan^2 x) dx$$
You made a sign error here. $\sec^2x = \tan^2x+1$. At this stage you should have obtained

$$I = \int \tan^4x \sec^3 x\,dx = \frac 1 6 \tan^3x\sec^3x - \frac 1 2 \int tan^2x\sec^3x\,dx[/itex] after doing almost the same as begin to the integration on the right: [tex]I = \frac 1 6 \tan^3 x \sec^3 x + \frac 1 6 \tan x \sec^3 x - \frac 1/6 \int (sec^5)\,dx$$

then for the last integration on the right i made d = sec x and thats how i got x^4 / sqrt(x^2 -1)

You could have done it this way.

$$\int \frac{u^4}{\sqrt{u^2-1}}\,du = \frac 1 8 \Bigl(u \sqrt{u^2-1} (2 u^2+3)+3 \ln\left(\sqrt(u^2-1)+u\right)\Bigr)$$

Now you have to substituting back in $u=\sec x[/tex], $$\int sec^5 x\,dx = \frac 1 8 \Bigl(\sec x \tan x (2 \sec^2x+3)+3 \ln(\sec x + \tan x)\Bigr)$$ so... is the answer -1/(48*(x-1)^3) -1/(48*(x+1)^3) is not correct... but why? cant i use partial integration for high powers? Differentiate this. Does that yield the original function? i dont think i have a sign mistake... it had 2 (-) so i just made it +... can you revise that? D H Staff Emeritus Science Advisor You definitely have a sign error. You properly integrated [itex]\int \tan^4x\sec^3x\,dx$ to yield
$$\int \tan^4x\sec^3x\,dx = \frac 1 3 \tan^3 x \sec^3 x - \int \sec^5 x \tan^2 x\, dx$$

Your mistake was in the next step, where you said
$$\int \tan^4x\sec^3x\,dx = \frac 1 3 \tan^3 x \sec^3 x - \int \tan^4 x \sec^3 x\,dx + \int \sec^3 x \tan^2 x\,dx$$

You need to use $\sec^2x=\tan^2x + 1$ here. You should have obtained

$$\int \tan^4x\sec^3x\,dx = \frac 1 3 \tan^3 x \sec^3 x - \int \tan^4 x \sec^3 x\,dx - \int\sec^3 x \tan^2 x\,dx$$

@Count_Iblis comment#11 :
i've tried to think in another way...
i supposed that x^4/(x^2-1)^4 = A/(x-1)^4 + B/(x+1)^4
i found A = B = 1/16

D.H. already pointed out that this can't be right. You can ask how you still found A and B and what that means. The terms A/(x-1)^4 and
B/(x+1)^4 correctly describe the leading behavior at the singularities at x = ±1. But there are less singular terms as well that are missing. The question is as always: How can you obtain the correct result with the least amount of computations?

In this case writing out the full partial fraction expansion with undetermined coefficients is not recommended, as that involves a lot unnecessary computations. The more computations you have to do, the greater the chances of error are. In general (not just for patial fractioin expansions), this means that you have to master many different methods to solve the same type of problems, even if one particular method would suffice. Learning to select an efficient method is as much part of learning math as learning to use some general method.

So, when you wrote down the partial fraction expansion of x/(x^2-1) to try to extract the partial fraction expansion of its fourth power, that was a good move. However, you went wrong when you wrote down the incomplete partial fraction expansion of the fourth power. So, let's try something different. We have:

[x/(x^2-1)]^4 = 1/(x-1)^4 [x/(x+1)]^4

What we need to do is to expand [x/(x+1)]^4 around
x = 1 to third order. That will yield all the singular terms of the expansion around x = 1. You then don't have to compute the singular terms of the expansion around x = -1, as they all follow from the first expansion by using that the function is an even function. Like partial fraction expansions, there are many different ways to do series expansions, and the method that is the most universal (i.e. using the Taylor expansion formula) is usually the most inefficient method and should thus be avoided. Let's write

x = 1 + t

then we need to expand in powers of t.

We have:

x/(x+1) = 1 - 1/(x+1) = 1 - 1/(2+t) =

1/2 + t/4 - t^2/8 + t^3/16 + ...

You can directly take the fourth power of this expansion. You can also take the logarithm, expand the logarithm, multiply by 4, take the exponential and then expand that. This is, believe it or not, far simpler than directly computing the fourth power:

Log[1/2 + t/4 - t^2/8 + t^3/16 + ...] =

Log(1/2) + Log[1 + t/2 - t^2/4 + t^3/8 + ...] =

Log(1/2) + t/2 - t^2/4 + t^3/8+... - (t/2 - t^2/4+...)^2/2 +

(t/2 +...)^3/3 +... =

Log(1/2) + t/2 - t^2/4 - t^2/8 + t^3/8+ t^3/8 + t^3/24 =

Log(1/2) + t/2 - 3/8 t^2 +7/24 t^3 + ...

We then have:

Exp[4 (Log(1/2) + t/2 - 3/8 t^2 +7/24 t^3 +...)] =

1/16 Exp[2 t - 3/2 t^2 + 7/6 t^3 + ...] =

1/16 [1 + (2 t - 3/2 t^2 + 7/6 t^3 + ...) + (2 t - 3/2 t^2 + ...)^2/2 + (2 t +...)^3/6 + ....] =

1/16 [1 + 2 t - 3/2 t^2 + 2 t^2 + 7/6 t^3 -3 t^3 + 4/3 t^3 + ...] =

1/16 + 1/8 t + 1/32 t^2 -1/32 t^3 + terms of order t^4 and higher

This yields the expansion:

1/(x-1)^4 [x/(x+1)]^4 =

1/16 1/(x-1)^4 + 1/8 1/(x-1)^3 + 1/32 1/(x-1)^2 -1/32 1/(x-1) + regular terms

If we now replace x by -x on both sides then the lefth hand side stays the same becaiuse the function is even. The full right hand side also stays the same if you include all the regular terms. However, the singular and regular terms separately do not stay the same. What is clear is that the singular terms of the expansion around 1 become precisely the singular terms in the expansion around -1. So, the sum of all the singular terms of both expansions is:

1/16 1/(x-1)^4 + 1/8 1/(x-1)^3 + 1/32 1/(x-1)^2 -1/32 1/(x-1)

1/16 1/(x+1)^4 - 1/8 1/(x+1)^3 + 1/32 1/(x+1)^2 + 1/32 1/(x+1)

And this is then the desired partial fraction expansion, as this expression has exactly the same singular behavior as the original ratonal expression. The difference between this expression and the rational function is certainly a rational function, but one without any siungularities and is thus a polynomial. However it is clear that for x to infinity, this polynomial would have to have a limit of zero, which means that the polynomial is in fact identical to zero.

thanks for helping. made me understand integration yet deeper.. although this is not required for me... yet.