I am wondering how to evaluate the indefinite integral

$$\int \frac{dx}{\sin(\ln(x))} \quad (1)$$

Attempt 1

I tried using Weierstrass substitution.

The Weierstrass substitution, (named after K.Weierstrass (1815)), is a substitution used in order to convert trigonometric functions rational expressions to polynomial rational expressions. Integrals of this type are usually easier to evaluate.

This substitution is constructed by letting: $$t = \tan\left(\frac{x}{2}\right) \iff x = 2\arctan(t) \iff dx = \frac{2}{t^2+1}$$

Using basic trigonometric identities it is easy to prove that: $$\cos x = \dfrac{1 - t^2}{1 + t^2}$$

$$\sin x = \dfrac{2t}{1 + t^2}$$

But I couldn't express $\ln(x)$ in terms of $t$.

Attempt 2

I tried using integration by parts but I couldn't find a workaround, it gets more complicated, really fast.

$$ \int \frac{dx}{\sin(\ln(x))} \ = x \sin(\ln(x)) - \int \frac{\cot \left(\ln \left(x\right)\right)}{x\sin \left(\ln \left(x\right)\right)} $$

Attempt 3

The most logical substitution I could think of. It doesn't seem to lead anywhere though.

Let, $\ln(x) = u \iff dx = \, e^u du$

$$ (1) \iff \int \frac{dx}{\sin(\ln(x))} = \int \frac{e^u}{\sin(u)} du = \int \frac{(e^u)'}{\sin(u)} du = $$

$$ \frac{(e^u)'}{\sin(u)} - \int e^u \left(\frac{1}{\sin(u)}\right)' = \frac{(e^u)'}{\sin(u)} - \int e^u \frac{\cos(u)}{\sin^2(u)} = ?$$

Attempt 4

A combination of attempts 1,2, 3.

Let $\ln(x) = t$ then $dx = e^t dt$, therefore,

$$\int \frac{dx}{\sin(\ln(x))} dx = \int \frac{e^t }{\sin(t)}dt \quad (1)$$

Let's first evaluate $$ \int \frac{1\:}{\sin\left(t\right)}dt \quad (2)$$

Using the Weierstrass substitution $$ t = \arctan(\frac{x}{2})$$ it is easy to prove that

$$ (2) = \int \frac{1\:}{\sin\left(t\right)}dt= \ln \left|\tan \left(\frac{t}{2}\right)\right|+C$$


$$ (1) \iff I = \int e^x\left(\ln \:\left|\tan \:\left(\frac{t}{2}\right)\right|\right)'dt = e^x \ln \:\left|\tan \:\left(\frac{t}{2}\right)\right| - \int (e^x)' \ln \:\left|\tan \:\left(\frac{t}{2}\right)\right|dt = $$

$$ e^x \ln \:\left|\tan \:\left(\frac{t}{2}\right)\right| - \left( e^x \ln \:\left|\tan \:\left(\frac{t}{2}\right)\right| - \int e^x \left(\ln \:\left|\tan \:\left(\frac{t}{2}\right)\right|\right)'dt \right) $$

$$ I = 0 + I \iff 0=0$$

Tautology. No answer here.

Attempt 5

Ask a question on MathExchange: Any ideas?

Note: A complex-plane solution was proposed in the comments, but I am evaluating this on $\mathbb{R}$

  • 2
    $\begingroup$ $\sin(\ln x) = (e^{i\ln x} - e^{-i\ln x})/(2i) \implies 1/\sin(\ln x) = 2i/(x^i - x^{-i})$ Use partial fractions. The result can be expressed in terms of hypergeometric functions. $\endgroup$ – Nikunj Jul 16 at 9:42
  • 2
    $\begingroup$ It appears not to be elementary. $\endgroup$ – Gae. S. Jul 16 at 9:43
  • $\begingroup$ $I=\frac{e^asin(ln x)}{sin(lnx)}$ try using differntiation over integration(Fermat's trick) $\endgroup$ – Anonymous Jul 16 at 17:34
  • 2
    $\begingroup$ Second integral then is $\int \frac{\cos t}{\sin^2t}$ and it is easy to integrate. $\endgroup$ – Hrishabh Jul 18 at 6:19
  • 3
    $\begingroup$ @TobyMak I deleted this answer to avoid further confusion. I just started a bounty. Let's see. $\endgroup$ – Dimitris Jul 18 at 10:09

By Euler's formula,


In the integral, this works out to give us

$$\int\frac{\mathrm dx}{\sin(\ln(x))}=\int\frac{2i~\mathrm dx}{x^i-x^{-i}}=2i\int\frac{x^i~\mathrm dx}{x^{2i}-1}=-2i\int\frac{x^i~\mathrm dx}{1-x^{2i}}$$

By expanding with geometric series, this then becomes

$$\int\frac{x^i~\mathrm dx}{1-x^{2i}}=\sum_{k=0}^\infty\int x^{(2k+1)i}~\mathrm dx=\sum_{k=0}^\infty\frac{x^{1+(2k+1)i}}{1+(2k+1)i}$$

Observe that the ratio of consecutive terms in this series is given by


which implies the series is a hypergeometric function:


and altogether,

$$\int\frac{\mathrm dx}{\sin(\ln(x))}=-2ix^{1+i}{}_2F_1\left(\frac{1+i}2,1;\frac{1+3i}2;x^{2i}\right)\color{#999999}{{}+C}$$

which likely cannot be simplified further, though can be rewritten using various hypergeometric identities.

Note: The above manipulations require that the series converges, but the end results in terms of hypergeometric functions hold everywhere they both exist, as they are defined through the use of analytic continuation.

| cite | improve this answer | |
  • 1
    $\begingroup$ That's a great answer. I will accept it soon. Thank you @SimplyBeautifulArt $\endgroup$ – Dimitris Jul 18 at 18:43
  • 1
    $\begingroup$ If $x>0$ is real, then $|x^{2i}| = 1$ and the hypergeometric series diverges. $\endgroup$ – GEdgar Jul 18 at 21:15
  • 1
    $\begingroup$ @GEdgar The series definition diverges, but the hypergeometric function can easily be analytically continued to such values (particularly as an Abel sum i.e. limit). $\endgroup$ – Simply Beautiful Art Jul 19 at 2:04
  • 1
    $\begingroup$ I think you need more explanation than the "divergent series" computation in this answer, though. Perhaps showing that your computation is correct for certain complex values $x$ where the series converges, then taking limit as $x$ approaches the real axis. $\endgroup$ – GEdgar Jul 19 at 14:11

To avoid hypergeometric functions use the partial fraction decomposition:

$$\frac{1}{\sin x} = \frac{1}{x} + \sum\limits _{n=1} ^{\infty}(-1)^n \left (\frac{1}{x-n\pi}-\frac{1}{x+n\pi}\right ), $$

replace $x$ with $\ln x$ and use

$$\int\frac{dx}{\ln x \pm n\pi}=e^{\mp n\pi}\text{Ei}(x\pm n\pi)+\text{const}$$

where $\text{Ei}(x)=-\int_{-x}^{\infty}\frac{e^{-t}dt}{t}$ is the so called exponential integral

| cite | improve this answer | |

Change variables $y=\sin x$ to convert this to the indefinite integral $$ \int\frac{e^y}{\sin y}\;dy . $$

This is not an elementary function.
Reference: 2.665 in

Gradshteyn, I. S.; Ryzhik, I. M.; Zwillinger, Daniel (ed.); Moll, Victor (ed.), Table of integrals, series, and products. Translated from the Russian. Translation edited and with a preface by Victor Moll and Daniel Zwillinger, Amsterdam: Elsevier/Academic Press (ISBN 978-0-12-384933-5/hbk; 978-0-12-384934-2/ebook). xlv, 1133 p. (2015). ZBL1300.65001.

| cite | improve this answer | |

This answer is wrong, but I am leaving it here for the archive (comments discussion), until we find a proper solution.

Thanks to your comments, here is the solution. (Apparently approach 3 was on the right path)

Let, $\ln(x) = u \iff dx = e^u \, du$

$$ \int \frac{dx}{\sin(\ln(x))} = I= \int \frac{e^u}{\sin(u)} du = \int \frac{(e^u)'}{\sin(u)} du = $$

$$ \frac{e^u}{\sin(u)} - \int e^u \left(\frac{1}{\sin(u)}\right)' = \frac{(e^u)'}{\sin(u)} - \int e^u \frac{\cos(u)}{\sin^2(u)} = $$

$$ \frac{e^u}{\sin(u)} - \int e^u \frac{\cos(u)}{2cos(u)sin(u)} = $$

$$ \frac{e^u}{\sin(u)} - \frac{1}{2}\int \frac{e^u}{sin(u)} = $$

$$ \frac{e^u}{\sin(u)} - I \iff $$

$$ 2I = \frac{(e^u)'}{\sin(u)} $$

$$ I = \frac{e^u}{2\sin(u)} $$

Therefore, substituting back the initial variables:

$$ I = \frac{e^{\ln(x)}}{2\sin(\ln(x))} $$

| cite | improve this answer | |
  • 1
    $\begingroup$ There's a small typo near the beginning: it should be $dx = e^u \ du$. $\endgroup$ – Toby Mak Jul 18 at 7:14
  • $\begingroup$ Thanks @TobyMak $\endgroup$ – Dimitris Jul 18 at 7:16
  • 4
    $\begingroup$ For some reason, in the third line, your $\sin^2 u$ became $\sin 2u = 2 \cos u \sin u$. That seems weird to me. $\endgroup$ – Toby Mak Jul 18 at 7:25
  • 1
    $\begingroup$ Also in the step before, there shouldn't be negative before the integral. I'm actually convinced the OP is attempting the impossible and the integral doesn't have an elementary anti-derivative. $\endgroup$ – NoName Jul 18 at 7:30
  • 1
    $\begingroup$ $I = \frac{e^{\ln(x)}}{2\sin(\ln(x))}$ on differentiation does not seem to give back the original integral. Maybe because you messed up $(sin^2x)$ as $ sin 2x$ $\endgroup$ – Hrishabh Nayal Jul 18 at 7:38

Let's prove the theorem, stated by @PleasecorrectGrammarMistakes, that$$\tfrac{d}{dx}\left[(-1-i)x^{1+i}F\left(\tfrac{1-i}{2},\,1;\,\tfrac{3-i}{2};\,x^{2i}\right)\right]=\csc\ln x$$provided $|x^{2i}<1$. We'll begin by noting$$[y^n]F(a,\,1;\,a+1;\,y)=\frac{\Gamma(a+n)\Gamma(n+1)\Gamma(a+1)}{\Gamma(a)\Gamma(1)\Gamma(a+n+1)n!}=\frac{a}{a+n},$$so the left-hand side is$$\sum_{n\ge0}(-1-i)\frac{1-i}{2n+1-i}(1+(2n+1)i)x^{(2n+1)i}=-2i\sum_{n\ge0}x^{(2n+1)i}=\frac{-2ix^i}{1-x^{2i}}.$$We can rewrite this as$$\frac{2i}{x^i-x^{-i}}=\frac{2i}{e^{i\ln x}-e^{-i\ln x}}=\csc\ln x,$$as required.

| cite | improve this answer | |
  • $\begingroup$ Could you please explain a little more the equations? As a computer scientist, I struggle to catch the meanings. For example, I know that $\Gamma$ is the gamma function but what about $F$? And what is the main idea here? We try to show that the functional equation $\csc(ln(x))$ is equal to what exactly? $\endgroup$ – Dimitris Jul 18 at 16:36
  • $\begingroup$ @Veriun $F$, more fully ${}_2F_1$, is the Gaussian hypergeometric function. The main idea is that, while the antiderivatives aren't elementary, they're expressible in terms of hypergeometric functions, as are the solutions of all ODEs of a certain very general type. $\endgroup$ – J.G. Jul 18 at 19:19
  • $\begingroup$ If $x>0$ is real, then $|x^{2i}| = 1$ and the hypergeometric series diverges. $\endgroup$ – GEdgar Jul 18 at 21:17
  • $\begingroup$ @GEdgar Thanks; fixed. $\endgroup$ – J.G. Jul 19 at 6:14

Based on the hypergeometric answers of J.G. and Simply Beautiful Art.

Taking another branch of the solution of the hypergeometric differential equation from those answers, we can get solutions like this: $$ f(x) = \mathrm{Re}\left[ {\frac { \left( 1+i \right) {x}^{1+i}}{{x}^{2\,i}-1} \;{\mbox{$_2$F$_1$}\left(1,1;\frac{3-i}{2};\,{\frac {{x}^{2\,i}}{{x}^{2\,i}-1}}\right)} } \right] $$ which satisfies $$ f'(x) = \frac{1}{\sin(\log x)} $$ in the interval $(0.21 , 0.55)$. Here we are inside the radius of convergence of the hypergeometric function.

| cite | improve this answer | |

I used MMA to calculate this indefinite integral and found that his result contains a hypergeometric function, so the primitive function of this indefinite integral cannot be expressed by elementary functions.

enter image description here

| cite | improve this answer | |
  • 1
    $\begingroup$ Good thought, but Wolfram suggested this already. We are looking for a rigorous proof, if this is the case. $\endgroup$ – Dimitris Jul 18 at 10:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.