# Does $\int{\frac{x}{\cos(x)}dx}$ have an elementary solution?

I need to solve the following integral: $\displaystyle\int\frac{x}{\cos(x)}\,dx$. My procedure is the following:

\begin{align*}\int\frac{x}{\cos(x)}\,dx &= \int x\sec(x)\,dx\\ &=x\ln(\tan(x)+\sec(x))-\int\ln(\tan(x)+\sec(x))\,dx. \end{align*}

But, I'm stuck at this step, after using integration by parts I have $\ln(\tan(x)+\sec(x))$ inside the new integral and then I do not know how to solve it, I was trying using by parts again but it gets more complicated.

Any advice on how to continue? I looked for related questions to this problem here in math.stackexchange but did not find anything useful.

• I very much doubt that $\frac x{\cos x}$ has an elementary primitive. – José Carlos Santos Jul 19 '18 at 18:09
• wolframalpha.com/input/?i=integral+of+x%2Fcos(x) , it is looks like José is correct – ℋolo Jul 19 '18 at 18:09
• Can I trust on WolframAlpha results? I have heard it does not provide good results at the majority of problems. – user573156 Jul 19 '18 at 18:14
• What is the source of the problem,? – clark Jul 19 '18 at 18:15
• @J.Doe: I am always very shocked to read negative comments about Wolfram Alpha. This is a wonderful piece of software including many man-years of extraordinary work by highly talented mathematicians. It is extremely rigorous and powerful, and have never heard of a single mistake it made (but many interpretation errors by the users). And in any case, it is more reliable than the average human. "it does not provide good results at the majority of problems" is shameful disinformation. – Yves Daoust Jul 19 '18 at 18:23

Your integration by parts can be written

\begin{align*}\int\frac{x}{\cos(x)}\,dx &= \int x\sec(x)\,dx\\ &=x \ln \tan\left(\frac{\pi}{4}+\frac{x}{2}\right) -\int\ln \tan\left(\frac{\pi}{4}+\frac{x}{2}\right)\,dx. \end{align*}

and the infinite series for $\ln \tan\left(\frac{\pi}{4}+\frac{x}{2}\right)$ is

$$\ln \tan\left(\frac{\pi}{4}+\frac{x}{2}\right)=2\sum_{k=1}^\infty \frac{2^{2k-1} \beta(2k-1)}{(2k-1)\pi^{2k-1}}x^{2k-1} \tag{1}$$

where $\beta(n)$ is the Dirichlet Beta Function.

Then you also can establish the Cosine Series for $\ln \tan\left(\frac{\pi}{4}+\frac{x}{2}\right)$

$$\ln \tan\left(\frac{\pi}{4}+\frac{x}{2}\right)=-2 \sum _{k=1}^{\infty } \frac{\cos \left(2 (2 k-1) \left(\frac{\pi }{4}+\frac{x}{2}\right)\right)}{2 k-1} \tag{2}$$

from the well known Cosine Series for $\ln \sin x$ and $\ln \cos x$.

Therefore using the approach above you should be able to calculate, for example, the integral $$\int_0^{\pi/3}\frac{x}{\cos(x)}\,dx=\frac{1}{3} \pi \log \left(\tan \left(\frac{\pi }{4}+\frac{\pi }{6}\right)\right)-\frac{2 G}{3}$$

where $G$ is Catalans Constant and without simplification

$$\frac{2 G}{3}=2\sum_{k=1}^\infty \frac{2^{2k-1} \beta(2k-1)}{(2k-1)\,2k\, \pi^{2k-1}}\left(\frac{\pi}{3}\right)^{2k}$$

The pattern appears to be that directly integrating any of the functions $\ln \sin x$, $\ln \cos x$, $\ln \tan x$, $\ln \tan (\pi/4+x/2)$, $\ln \sinh x$, $\ln \cosh x$, $\ln \tanh x$ and $\ln \tanh (\pi/4+x/2)$ does not lead to a new elementary primitive. That associated definite integral closed forms can be evaluated using the above techniques, without introducing complex numbers, is worth remembering.

[Note the infinite series for $\ln \tan x$ is different to (1) given above for $\ln \tan (\pi/4+x/2)$, since the phase shifted $\ln \tan \frac{x}{2}$ function appears when integrating the $\csc$ function, not the $\sec$ function as above. In the the equivalent notation
$\ln \tan x= \log x + \sum_{k=1}^\infty \frac{2^{2k} \,\eta{(2k)}}{k \,\pi^{2k}}x^{2k}$, where $\eta(k)$ is the Dirichlet Eta Function]

Wolfram Alpha returns

$$x (\log(1 - i e^{i x}) - \log(1 + i e^{i x})) + i (\text{Li}_2(-i e^{i x}) - \text{Li}_2(i e^{i x}))$$

which you can trust with closed eyes.

Alpha uses to return solutions valid in $\mathbb C$, which sometimes makes the expression look complicated. In the case on hand, maybe the logarithmic terms can be rewritten with reals only. But maybe not the dilogarithmic ones.

And you can be sure that no elementary solution is possible.

• i will only be sure when you proof this statement. – Dr. Sonnhard Graubner Jul 19 '18 at 18:46
• @Dr.SonnhardGraubner: my mastery of Liouville's theorem and the Risch algorithm is insufficient. But Alpha knows them well. Presumably, Mathematica could give more details. – Yves Daoust Jul 19 '18 at 18:55
• @Dr.SonnhardGraubner: also note that if an elementary solution exists, the dilogarithm has an elementary expression as well. – Yves Daoust Jul 19 '18 at 19:18

Perhaps the expanding of $e^x$ be useful, well \begin{align} \int\dfrac{x}{\cos x}dx &= \int\dfrac{2xe^{-ix}}{1+e^{-2ix}}dx \\ &= \int 2xe^{-ix}\sum_{n\geq0}e^{-2inx}dx \\ &= \sum_{n\geq0}\int 2xe^{-i(2n+1)x}dx \\ &= \sum_{n\geq0}2e^{-i(2n+1)x}\left(\dfrac{ix}{2n+1}+\dfrac{1}{(2n+1)^2}\right) \\ \end{align}