# Evaluating: $\int \frac{t}{\cos{t}} dt$

How would you evaluate the following indefinite integral? In fact, I did evaluate $\int \frac{\cos{t}}{t} dt$ by parametric integration and then I thought of this variant. $$\int \frac{t}{\cos{t}} dt$$

Here you may find the result given by W|A.

• Did you evaluated the primitive of $\cos t/t$? Commented Aug 13, 2012 at 14:43
• @enzotib, that's actually easier, since it's just the cosine integral. This one will require the inverse tangent integral. Commented Aug 13, 2012 at 15:12
• @J.M.: yes, but by definition of cosine integral, not actually evaluating something, like the OP claims. Commented Aug 13, 2012 at 15:15
• @enzotib, maybe OP went further and expressed it in terms of the incomplete gamma function... :D Commented Aug 13, 2012 at 15:20
• @enzotib: In fact, I did try it. Commented Aug 14, 2012 at 7:18

Let's start with $\ \displaystyle f(x):=\log(\tan(x/2))\$ then : $$f'(x)=\frac{\tan(x/2)^2+1}{2\tan(x/2)}=\frac{\sin(x/2)^2+\cos(x/2)^2}{2\cos(x/2)^2\tan(x/2)}=\frac 1{\sin(x)}$$

so that $\ f'\left(t+\frac {\pi}2\right)=\dfrac 1{\cos(t)}$.

We want (ignoring integration constants up to the end) : $$\int \dfrac t{\cos(t)}\,dt=\int tf'\left(t+\frac {\pi}2\right) dt=\left[tf\left(t+\frac {\pi}2\right)\right]-\int f\left(t+\frac {\pi}2\right)\,dt$$ Setting $\ u:=\tan\bigl(\frac x2\bigr)\$ so that $\ dx=\dfrac {2\;du}{1+u^2}$ we rewrite the integral of $f$ as : $$\int f(x)\;dx=\int \log\left(\tan\left(\frac x2\right)\right)\;dx=2\int \frac{\log(u)}{1+u^2}\;du$$ $$=\left[2\log(u)\arctan(u)\right]-2\int \frac {\arctan(u)}u\,du=2\left[\log(u)\arctan(u)-\rm{Ti}_2(u)\right]$$ with $\rm{Ti}_2$ the inverse tangent integral proposed by J.M. (see Lewin 1981 "Polylogarithms and associated functions" ch. 2 for more information). $\rm{Ti}_2$ may be rewritten as Clausen functions or as complex polylogarithms.

We want $\ \int f\bigl(t+\frac {\pi}2\bigr)\,dt\$ so that $\ u:=\tan\bigl(\frac t2+\frac {\pi}4\bigr)\$ and $$\int f\left(t+\frac {\pi}2\right)\,dt=2\left[\log\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\left(\frac t2+\frac {\pi}4\right)-\rm{Ti}_2\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\right]$$

getting : $$\int \dfrac t{\cos(t)}\,dt=t\left[\log\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\right]-2\left[\log\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\left(\frac t2+\frac {\pi}4\right)-\rm{Ti}_2\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)\right]$$

and finally : $$\int_0^t \dfrac x{\cos(x)}\,dx=-\frac {\pi}2\log\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)+2\rm{Ti}_2\left(\tan\left(\frac t2+\frac {\pi}4\right)\right)+C$$ where the additional constant $\ C=-2\;\rm{Ti}_2(1)=-2K\quad$ ($K$ is the Catalan constant).

To rewrite this with Clausen functions we may use (4.31) of Lewin's reference : $$\rm{Ti}_2(\tan \theta)=\theta\log(\tan\theta)+\frac 12\left(\rm{Cl}_2(2\theta)-\rm{Cl}_2(\pi-2\theta)\right)$$

• Thanks for following through, again. :) I had forgotten about the Clausen function... good thing you mentioned it too, for the benefit of those who want to avoid using complex numbers in real results. Commented Aug 14, 2012 at 5:19
• @Raymond Manzoni: Clausen functions? I didn't know they have a name. :-) Thanks. Commented Aug 14, 2012 at 7:13
• @Chris'sister: Glad you liked my 'all real' solution ! Clausen functions are indeed interesting since you may write them as $\displaystyle \rm{Cl}_{2n}(\theta)=\sum_{n=1}^\infty \frac {\sin(n\theta)}{n^{2n}}$ and $\displaystyle \rm{Cl}_{2n+1}(\theta)=\sum_{n=1}^\infty \frac {\cos(n\theta)}{n^{2n+1}}$as found at Mathworld (I think that wikipedia's 'General definition' should rather be something like ... Commented Aug 14, 2012 at 8:51
• $\displaystyle \rm{Cl}_s(\theta)=\sum_{n=1}^\infty \frac {\sin(n\theta+s\pi/2)}{n^s}$ if we accept to change some signs !). These series are frequent in Fourier series and the other half of the cases is handled by the Bernoulli polynomials. Commented Aug 14, 2012 at 8:52
• @Raymond Manzoni: I usually like the solutions from which I have something to learn as this solution is. Commented Aug 14, 2012 at 8:55

Note that $$\frac{1}{\cos t}= \frac{2}{e^{it}+e^{-it}}= \frac{2e^{it}}{1+e^{2it}}$$ so integration by parts gives $$\int\frac{t}{\cos t}dt= \int 2t\frac{e^{it}}{1+e^{2it}}dt= \int 2t\frac{(-i)d(e^{it})}{1+e^{2it}}= \int -2itd(\arctan(e^{it}))=$$ $$-2it\arctan(e^{it})-\int\arctan(e^{it})d(-2it)= -2it\arctan(e^{it})+2i\int\arctan(e^{it})dt$$ It is remains to compute the last integral $$\int\arctan(e^{it})dt= \int\sum\limits_{k=1}^\infty \frac{(-1)^k(e^{it})^{2k+1}}{2k+1}dt= \int\sum\limits_{k=1}^\infty \frac{(ie^{it})^{2k+1}}{i(2k+1)}dt= \int\frac{1}{2i}\left(\sum\limits_{k=1}^\infty\frac{(ie^{it})^k}{k}- \sum\limits_{k=1}^\infty\frac{(-ie^{it})^k}{k}\right)dt= \frac{1}{2i}\sum\limits_{k=1}^\infty\int\frac{(ie^{it})^k}{k}dt- \frac{1}{2i}\sum\limits_{k=1}^\infty\int\frac{(-ie^{it})^k}{k}dt=$$ $$\frac{1}{2i}\sum\limits_{k=1}^\infty\frac{(ie^{it})^k}{ik^2}- \frac{1}{2i}\sum\limits_{k=1}^\infty\frac{(-ie^{it})^k}{ik^2}= \frac{1}{2}\left(\mathrm{Li}_2(-ie^{it})-\mathrm{Li}_2(ie^{it})\right)$$ The final result is $$\int\frac{t}{\cos t}=-2it\arctan(e^{it})+i(\mathrm{Li}_2(-ie^{it})-\mathrm{Li}_2(ie^{it}))$$

• As I've already noted, one might choose to use the inverse tangent integral instead of the dilogarithm in this case... Commented Aug 13, 2012 at 16:07
• I saw your comment after I finished writing this answer Commented Aug 13, 2012 at 16:34
• I like all your provided answers. (+1) Commented Aug 14, 2012 at 9:17
• Thanks @Chris'sister, glad to see nice questions Commented Aug 14, 2012 at 9:45

Letting $$x=\frac{\pi}{2}-t$$ yields \begin{aligned}\int \frac{t}{\cos t} d t&=-\int \frac{\frac{\pi}{2}-x}{\sin x} d x \\ & =-\frac{\pi}{2} \int \csc x d x+\int \frac{x}{\sin x} d x \\ & =\frac{\pi}{2} \ln \left|\csc x+\cot x\right|+ x \ln \left(\frac{1-e^{i x}}{1+e^{ix}}\right) +i\left[\operatorname{Li_2}\left(-e^{i x}\right)-\operatorname{Li_2}\left(e^{i x}\right)\right]+C \\&= \frac{\pi}{2} \ln |\sec t+\tan t|+\left(\frac{\pi}{2}-t\right) \ln \left(\frac{1-i e^{-it}}{1+i e^{-it}}\right)+i\left[\operatorname{Li_2}\left(-i e^{-it}\right)-\operatorname{Li_2}\left(i e^{-it}\right)\right]+C \end{aligned}

the last integral refers to the result of my post, $$\int \frac{x}{\sin x} d x =x \ln \left(\frac{1-e^{i x}}{1+e^{ix}}\right) +i\left[\operatorname{Li_2}\left(-e^{i x}\right)-\operatorname{Li_2}\left(e^{i x}\right)\right]+C$$