use integration by parts to prove the following reduction formula:

|cos^nx dx =1/n cos^(n-1)xsinx +(n-1)/n |cos(n-2)xdx

|cos^nx dx = |cos^(n-1)x. cosx dx

Take:
u = cos^(n-1)x
du = (n-1) cos^(n-2)x. (-sinx) dx
dv = cosx dx
v = sinx

By integration by part formula we have:
|cos^nx dx =
= cos^(n-1)x. sinx + (n-1)|sin^2x. cos^(n-2)x dx
= cos^(n-1)x. sinx + (n-1)|(1-cos^2x). cos^(n-2)x dx
= cos^(n-1)x. sinx + (n-1)|cos^(n-2)x dx + (1-n)|cos^nx dx

|cos^nx dx - (1-n)|cos^nx dx = cos^(n-1)x. sinx + (n-1)|cos^(n-2)x dx
n|cos^nx dx = cos^(n-1)x. sinx + (n-1)|cos^(n-2)x dx
|cos^nx dx = (1/n) cos^(n-1)x. sinx + ((n-1)/n)|cos^(n-2)x dx

To prove the reduction formula using integration by parts, we need to use the following formula for integration by parts:

∫u * v dx = u * ∫v dx - ∫(u' * ∫v dx) dx

Let's start by setting u = cos^(n-1)x and dv = cos(x)dx. Then, we can calculate du and v by taking the derivatives and integrals of u and v, respectively:

du = (n-1) * cos^(n-2)x * (-sin(x)) dx
v = ∫cos(x) dx = sin(x)

Now, we can substitute these values in the integration by parts formula:

∫cos^nx dx = cos^(n-1)x * sin(x) - ∫(n-1) * cos^(n-2)x * (-sin(x)) * sin(x) dx

Simplifying the above equation, we get:

∫cos^nx dx = cos^(n-1)x * sin(x) + (n-1) ∫cos^(n-2)x * sin^2(x) dx

Using the trigonometric identity sin^2(x) = 1 - cos^2(x), we can rewrite the equation as:

∫cos^nx dx = cos^(n-1)x * sin(x) + (n-1) ∫cos^(n-2)x * (1 - cos^2(x)) dx

Expanding the equation further, we have:

∫cos^nx dx = cos^(n-1)x * sin(x) + (n-1) ∫cos^(n-2)x dx - (n-1) ∫cos^n(x) dx

Now, we rearrange the equation to isolate the desired integral:

∫cos^nx dx + (n-1) ∫cos^n(x) dx = cos^(n-1)x * sin(x) + (n-1) ∫cos^(n-2)x dx

Finally, dividing both sides by n, we obtain:

(1/n) ∫cos^nx dx + (n-1)/n ∫cos^n(x) dx = (1/n) * cos^(n-1)x * sin(x) + (n-1)/n ∫cos^(n-2)x dx

This is the desired reduction formula:

∫cos^nx dx = (1/n) * cos^(n-1)x * sin(x) + (n-1)/n ∫cos^(n-2)x dx

And that's how you can derive the reduction formula using integration by parts.