# Integral of cosecant function: understanding different approaches

• B
• mcastillo356
mcastillo356
Gold Member
TL;DR Summary
Natural logarithm is always the answer, but I would like an explanation of the different answers.
Hi, PF

Trigonometric Integrals

"The method of substitution is often useful for evaluating trigonometric integrals" (Calculus, R. Adams and Christopher Essex, 7th ed)

Integral of cosecant

$$\displaystyle\int{\csc{(x)}}=\displaystyle\int{\displaystyle\frac{1}{\sin{(x)}}}=-\ln{(|\csc{(x)}+\cot{(x)}|)}=\ln{(|\csc{(x)}-\cot{(x)}|)}=\ln{\Bigg|\tan\Bigg(\displaystyle\frac{1}{2}x\Bigg)\Bigg|}$$

The textbook recommends to memorize all of this: should I, or give a try and outline a proof? I mean, this is the first time I'm suggested to memorize. But, just some questions:

(i) Why the negative natural logarithm of the sum inside the absolute value is equal to the positive one, provided the subtraction?.
(ii) Could I approach somehow to some kind of explanation about the evaluation of this integral?.

Greetings!

PD: Post without preview.

Why don’t you differentiate
$$-\ln |cosec\ x + \cot x|$$
with x to confirm that it should be cosec x ? You may get a hint of integration by this.

SammyS and mcastillo356
mcastillo356 said:
TL;DR Summary: Natural logarithm is always the answer, but I would like an explanation of the different answers.

Hi, PF

Trigonometric Integrals

"The method of substitution is often useful for evaluating trigonometric integrals" (Calculus, R. Adams and Christopher Essex, 7th ed)

Integral of cosecant

$$\displaystyle\int{\csc{(x)}}=\displaystyle\int{\displaystyle\frac{1}{\sin{(x)}}}=-\ln{(|\csc{(x)}+\cot{(x)}|)}=\ln{(|\csc{(x)}-\cot{(x)}|)}=\ln{\Bigg|\tan\Bigg(\displaystyle\frac{1}{2}x\Bigg)\Bigg|}$$

The textbook recommends to memorize all of this: should I, or give a try and outline a proof? I mean, this is the first time I'm suggested to memorize. But, just some questions:

(i) Why the negative natural logarithm of the sum inside the absolute value is equal to the positive one, provided the subtraction?.

Recall your basic trig identities. $$|\csc x + \cot x||\csc x - \cot x| = |\csc^2x - \cot^2 x| = \left|\frac{1 - \cos^2 x}{\sin^2 x}\right| = 1.$$ Therefore $$\ln |\csc x + \cot x | + \ln |\csc x - \cot x| = 0.$$

(ii) Could I approach somehow to some kind of explanation about the evaluation of this integral?.
This follows from $$\frac{d}{dx} \csc x = -\csc x \cot x \qquad \frac{d}{dx} \cot x = -\csc^2 x.$$ Adding or subtrtacting these these gives $$\begin{split} \frac{d}{dx} (\csc x + \cot x) &= -\csc x (\csc x + \cot x) \\ \frac{d}{dx} (\csc x - \cot x) &= \csc x (\csc x - \cot x)\end{split}$$ and hece $$\begin{split} \csc x &= -\frac{1}{\csc x + \cot x} \frac{d}{dx}(\csc x + \cot x) \\ &= \frac{1}{\csc x - \cot x} \frac{d}{dx}(\csc x - \cot x). \end{split}$$

mcastillo356, dextercioby, mathwonk and 1 other person
Here are two articles that might interest you:

mcastillo356 said:
TL;DR Summary: Natural logarithm is always the answer, ...
The Amazing Relationship Between Integration And Euler’s Number
mcastillo356 said:
... but I would like an explanation of the different answers.
The Art of Integration

Especially when it comes to trigonometric functions, the exponential function is not always the answer, at least not the first one. It is often the Weierstraß or half-tangent substitution to transform the trigonometric function into a polynomial function. It is really a useful technique, even if the resulting polynomials might end up in the "always-answer".

mcastillo356 and dextercioby
anuttarasammyak said:
Why don’t you differentiate
$$-\ln |cosec\ x + \cot x|$$
with x to confirm that it should be cosec x ? You may get a hint of integration by this.
Thank you! Now I've got a hint.
@pasmith, @fresh_42, I will reply in three days.
Greetings!

An alternative derivation is $$\begin{split} \frac{1}{\sin x} &= \frac{1}{2\sin(\tfrac x2) \cos(\tfrac x2)} \\ &=\frac{\cos(\tfrac x2)}{2\sin(\tfrac x2)\cos^2(\tfrac x2)} \\ &= \frac{1}{\tan(\tfrac x2)} \frac12 \sec^2(\tfrac x2) \\ &= \frac{1}{\tan(\tfrac x2)} \frac{d}{dx} \tan(\tfrac x2) \\ &=\frac{d}{dx} \ln |\tan(\tfrac x2)|.\end{split}$$ You can again check using basic identities that $$\csc x - \cot x = \tan(\tfrac x2).$$

vanhees71, mcastillo356 and dextercioby
#3 is the usual derivation, i.e.

csc(x) dx = csc(x).[(csc(x) + cot(x))/(csc(x) + cot(x))] dx

= [csc^2 + csc(x)cot(x)]/(csc(x) + cot(x)) dx

= - d(csc(x) + cot(x))/(csc(x) + cot(x)).

= -d[ln(csc(x) + cot(x))], (where the argument is positive).

Last edited:
mathwonk said:
#3 is the usual derivation, i.e.

= - d(csc(x) + cot(x))/(csc(x) + cot(x)).

= -ln(csc(x) + cot(x)), (where the argument is positive).
Hi, @mathwonk, is this the derivative of a constant?
I don't understand.
Greetings!

if u = csc(x) + cot(x), it is du/u = d[ln(u)], not d(u/u) = 0.

oops, I edited to put in the "d's".

mcastillo356
Another derivation is
$$\int \csc x\,dx = \int\frac{1}{\sin x}\cdot \frac{\sin x}{\sin x}\,dx = \int\frac{\sin x}{1-\cos^2 x} \,dx = \int \frac{du}{u^2-1}$$ where ##u=\cos x##. Then use partial fractions to do the integral.

mcastillo356 and dextercioby
vela said:
Another derivation is
$$\int \csc x\,dx = \int\frac{1}{\sin x}\cdot \frac{\sin x}{\sin x}\,dx = \int\frac{\sin x}{1-\cos^2 x} \,dx = \int \frac{du}{u^2-1}$$ where ##u=\cos x##. Then use partial fractions to do the integral.
As we know, it is the case of a quadratic denominator. Eventually,
$$\displaystyle\int{\displaystyle\frac{1}{u^2-1}}$$
##=\displaystyle\int{\displaystyle\frac{1}{u+1}}+\displaystyle\int{\displaystyle\frac{1}{u-1}}##

$$\displaystyle\int{\frac{1}{u^2-1}}\,du=\displaystyle\frac{1}{2}\cdot{\ln{|u-1|}-\ln{|u+1|}}+C$$

So there must be displayed some more algebra, but I don't know to go any further. If I could be given advice...
Greetings!
PD: Post without preview
Second PD: Edited in red on centered text on 08/10/2023. I've taken a look at how to type LaTeX on the forum.
Third PD: Online delimiters typed at las formula, to give another try.
Thanks!

Last edited:
You made a sign error. Anyway, you can combine the logs to get
$$\int \csc x\,dx = \frac 12 \log \frac{\cos x - 1}{\cos x+1}.$$ Then it's just a matter of using trig identities to get the different forms of the solution.

mcastillo356
Hi, PF

First of all, I'm grateful for the effort displayed by all of you. Now I must confess the truth: I've struggled with this topic, for sure, a lot; but I'm mostly impressed with the effort all of you have made to raise my knowledge. Unfortunately, I haven't been able to understand completely your tries to make me figure out the topic; so I've turned to a Spanish math forum. They also have tried to give me advice... An there it goes:

vela said:
You made a sign error. Anyway, you can combine the logs to get
$$\int \csc x\,dx = \frac 12 \log \frac{\cos x - 1}{\cos x+1}.$$ Then it's just a matter of using trig identities to get the different forms of the solution.
 $$\ln\left|\tan \dfrac{x}{2}\right|+C$$ $$=\ln \sqrt{\dfrac{1-\cos x}{1+\cos x}}+C$$ $$=\ln \sqrt{\dfrac{1+\cos^2x-2\cos x}{\sin^2x}}+C$$ $$=\ln \sqrt{\csc^2x+\cot^2x -2\csc x\cot x}+C$$ $$=\ln \sqrt{(\csc x-\cot x)^2}+C=\ln|\csc x-\cot x| +C$$
Source: Spanish "Rincón Matemático" (Traduced as "Mathematical Corner")

Now, in terms of sine, cosine, tangent, and writing
 $$\csc x = \dfrac{1}{\sin x}$$ $$= \dfrac{\sin x}{\sin^2 x}$$ $$= \dfrac{\sin x}{1-\cos^2 x}$$ $$= \dfrac{1}{2}\left(\dfrac{\sin x}{1-\cos x} + \dfrac{\sin x}{1+\cos x}\right)$$
We get
 $$\displaystyle\int{\csc x \, dx}$$ $$= \dfrac{1}{2}\displaystyle\int{ \left(\dfrac{\sin x}{1-\cos x} + \dfrac{\sin x}{1+\cos x}\right) \, dx}$$ $$= \frac{1}{2}\left(\ln(1-\cos x) - \ln(1+\cos x)\right)$$ $$= \frac{1}{2}\ln\left(\dfrac{1-\cos x}{1+\cos x}\right)$$
As...
 $$\dfrac{1-\cos x}{1+\cos x}$$ $$= \dfrac{(1-\cos x)(1+\cos x)}{(1+\cos x)^2}$$ $$= \left(\dfrac{\sin x}{1+\cos x}\right)^2$$
$$\dfrac{1}{2}\ln\left(\dfrac{1-\cos x}{1+\cos x}\right) = \ln\left|\dfrac{\sin x}{1+\cos x}\right|$$
So then, we have
 $$\ln\left|\dfrac{\sin x}{1+\cos x}\right|$$ $$= -\ln\left|\dfrac{1+\cos x}{\sin x}\right|$$ $$= -\ln\left|\dfrac{1}{\sin x}+\dfrac{\cos x}{\sin x}\right|$$
(Same source)
I hope I am keeping the track; it is a "copy and paste" I've made on my own. I'm willing to get your opinions.
Greetings!

It is my own, same as yours.
$$\frac{1}{\sin x}=\frac{(1+\cos x)}{\sin x(1+\cos x)}=\frac{\cos x}{\sin x}+\frac{\sin x}{1+\cos x}$$
$$=\frac{d}{dx}\ln |\sin x| - \frac{d}{dx}\ln |1+\cos x|$$

dextercioby and mcastillo356
fresh_42 said:
Here are two articles that might interest you:

The Amazing Relationship Between Integration And Euler’s Number

The Art of Integration

Especially when it comes to trigonometric functions, the exponential function is not always the answer, at least not the first one. It is often the Weierstraß or half-tangent substitution to transform the trigonometric function into a polynomial function. It is really a useful technique, even if the resulting polynomials might end up in the "always-answer".
Very interesting. I confess I ain't understood lots of concepts (Weierstrass or half-tangent substitution), but I've realized that Euler's number is an amazing discovery. I'm going to put a link thought for beginners that made me notice of the magic behind ##e##.

https://www.mathsisfun.com/numbers/e-eulers-number.html

Greetings!

vanhees71 and fresh_42

• Calculus
Replies
6
Views
1K
• Calculus
Replies
2
Views
1K
• Calculus
Replies
3
Views
1K
• Calculus
Replies
4
Views
1K
• Calculus
Replies
3
Views
1K
• Calculus and Beyond Homework Help
Replies
3
Views
377
• Calculus
Replies
16
Views
1K
• Calculus
Replies
4
Views
2K
• Science and Math Textbooks
Replies
9
Views
1K
• Calculus
Replies
7
Views
3K