# What is the integral of $e^{\cos x}$

Question:

Find out $$\displaystyle{\int e^{\cos x}~dx}$$.

My Attempt:

Let $$\cos x = y$$. Hence $$-\sin x\ dx = dy$$ or $$dx = \displaystyle{\frac{-dy}{\sin x}=\frac{-dy}{\sqrt{1-\cos^2x}}=\frac{-dy}{\sqrt{1-y^2}}}$$ So

\begin{align}\int e^{\cos x}~dx &= \int e^y\left(\frac{-dy}{\sqrt{1-y^2}}\right)\\ &=-\int\frac{e^y}{\sqrt{1-y^2}}~dy \end{align}

This integral is one I can't solve. I have been trying to do it for the last two days, but can't get success. I can't do it by parts because the new integral thus formed will be even more difficult to solve. I can't find out any substitution that I can make in this integral to make it simpler. Please help me solve it. Is the problem with my first substitution $$y=\cos x$$ or is there any other way to solve the integral $$\displaystyle{\int\frac{e^y}{\sqrt{1-y^2}}~dy}$$?

• there in no solution known Commented Oct 12, 2017 at 9:09
• I don’t think the indefinite integral could be expressed in elementary functions.
– BAI
Commented Oct 12, 2017 at 9:09
• Commented Oct 12, 2017 at 11:09
• A related question. Commented Aug 21, 2019 at 8:43
• Use a Jacobi Anger expansion Commented Aug 31, 2023 at 21:21

Although this indefinite integral has no known closed form, certain definite integrals are known... $$\int_0^\pi e^{\cos x}\;dx = \pi\;I_0(1) ,$$ where $I_0$ is a modified Bessel function

First of all: there is no close form solution in terms of elementary functions.

What can you do, but it's not an exact result and also its validity is bounded, is to express the exponential as a Taylor series:

$$e^{\cos x} = \sum_{k = 0}^{+\infty} \frac{(\cos x)^k}{k!}$$

hence the integral becomes

$$\sum_{k = 0}^{+\infty} \frac{1}{k!}\int \cos^k(x)\ \text{d}x$$

The integral can be evaluated with a "close" form (not really since it does involte an Hypergeometric Function which is itself a series) as follow:

$$\int \cos^k(x)\ \text{d}x = -\frac{\sin (x) \cos ^{k+1}(x) \, _2F_1\left(\frac{1}{2},\frac{k+1}{2};\frac{k+3}{2};\cos ^2(x)\right)}{(k+1) \sqrt{\sin ^2(x)}}$$

Hence in the end the solution:

$$\sum_{k = 0}^{+\infty} \frac{1}{k!}\left(-\frac{\sin (x) \cos ^{k+1}(x) \, _2F_1\left(\frac{1}{2},\frac{k+1}{2};\frac{k+3}{2};\cos ^2(x)\right)}{(k+1) \sqrt{\sin ^2(x)}}\right)$$

You may get satisfied in taking the first $n$ terms of the series...

Remarks

As I said, it's not a real close solutions, since it does involve two series and a Taylor expansion, but I believe it's the best you can obtain.

• "First of all: there is no close form solution in terms of elementary functions." Can this be proven, or is it just that no closed form is known? Commented Oct 12, 2017 at 21:07
• @Qudit By applying the Risch Algorithm you can easily prove and find that there is no close form / elementary function primitive! Commented Oct 13, 2017 at 6:45

This is just a response to your comments about having tried integration by parts for this problem.

By parts:

$$\int 1\cdot e^{\cos x}\text dx = x\cdot e^{\cos x}+\int x \cdot\sin x \cdot e^{\cos x}\text dx$$

Applying parts (and substitution of $\cos x$) for the integral on the right hand side, we get:

$$\int x \cdot\sin x \cdot e^{\cos x}\text dx = -x\cdot e^{\cos x}+\int e^{\cos x}\text dx$$

This, unfortunately, simply gives us the circular, and not very helpful, result that:

$$\int e^{\cos x}\text dx = \int e^{\cos x}\text dx$$

This indefinite integral has no closed form $$I(x)=\int_0^xe^{\cos(t)}dt$$ The usual expansions of $$I (x)$$ are generally obtained by expanding $$e ^ x$$ and integrating $$\int \cos ^ \alpha (x) dx$$, thus obtaining a series in terms of the hypergeometric function. Since I am not very familiar with the hypergeometric function, I will show you first how it is possible to express $$I (x)$$ in Taylor series and then I will show you how it is possible to decompose the hypergeometric function in a more familiar way

Applying the Faà di Bruno's formula for the composite function $$f(x)=\exp(\cos(x))$$ we can show that $$f^{(2n+1)}(0)=0$$ and $$f^{(2n)}(0)$$ are the number of partitions of a $$2n$$-set into even blocks A005046 therefore we can express $$f (x)$$ with the following taylor series:

$$\frac{e^{\cos(x)}}{e}=1+\sum_{n=1}^{\infty} (-1)^n\Bigg(\sum_{k=1}^{2n}\sum_{h=0}^{k-1}\frac{(-1)^h(h-k)^{2n}}{2^{k-1}k!}\binom{2k}{h} \Bigg)\frac{x^{2n}}{(2n)!}$$

$$\frac{1}{e}\int_0^xe^{\cos(t)}dt=x+\sum_{n=1}^{\infty} (-1)^n\Bigg(\sum_{k=1}^{2n}\sum_{h=0}^{k-1}\frac{(-1)^h(h-k)^{2n}}{2^{k-1}k!(2n+1)!}\binom{2k}{h} \Bigg)\frac{x^{2n+1}}{(2n)!}$$

We can add to the answer of the user @Turing the following expression to transform the indefinite integral $$\int \cos(x)^kdx$$ into a definite integral, very easy to calculate numerically: by the integral expression of the hypergeometric function

$$_2F_1\left(a,b;c;z\right)=\frac{\Gamma(c)}{\Gamma(b)\Gamma(c-b)}\int_0^1 \frac{t^{b-1}(1-t)^{c-b-1}}{(1-t z)^a}dt$$

$$\int_0^x e^{\cos(t)}dt =2(-1)^{\lfloor x/\pi\rfloor}\cos(x)\sum_{k=0}^\infty \frac{ \cos(x)^{k}}{k!}\int_0^1\frac{t^{k/2}}{\sqrt{t(t \cos(x)^2)-1}}dt$$

Or using the series expansion of the hypergeometric function:

$$_2F_1\left(a,b;c;z\right)=\sum_{h=0}^\infty \frac{\Gamma(a+h)\Gamma(b+h)\Gamma(c)}{\Gamma(a)\Gamma(b)\Gamma(c+h)} \frac{z^h}{h!}$$

$$\frac{\Gamma(\frac{1}{2}+h)\Gamma(\frac{k+1}{2}+h)\Gamma(\frac{k+3}{2})}{\Gamma(\frac{1}{2})\Gamma(\frac{k+1}{2})\Gamma(\frac{k+3}{2}+h)}=\frac{(1+k)\Gamma\left(h+\frac{1}{2}\right)}{(1+k+2h)\sqrt{\pi}}=\frac{(1+k)(2h)!}{4^{h}(1+k+2h)h!}$$

$$_2F_1\left(\frac{1}{2},\frac{k+1}{2};\frac{k+3}{2};\cos(x)^2\right)=\sum_{j=0}^\infty \frac{(1+k)(2j)!}{4^{j}(1+k+2j)j!} \frac{\cos(x)^{2j}}{j!}=\sum_{j=0}^\infty \frac{(1+k)}{4^{j}(1+k+2j)} \binom{2j}{j}\cos(x)^{2j}$$

$$\int \cos(x)^k dx=(-1)^{\lfloor x/\pi\rfloor+1}\sum_{h=0}^\infty \frac{1}{4^{h}(1+k+2h)} \binom{2h}{h}\cos(x)^{1+k+2h}+c$$

$$\int e^{cos(x)}dx=(-1)^{\lfloor x/\pi\rfloor+1}\sum_{k=0}^{\infty}\sum_{h=0}^\infty \frac{\binom{2h}{h}}{4^{h}(1+k+2h)k!} \cos(x)^{1+k+2h}+c$$

$$\int e^{\cos x}~dx$$

$$=\int\sum\limits_{n=0}^\infty\dfrac{\cos^{2n}x}{(2n)!}dx+\int\sum\limits_{n=0}^\infty\dfrac{\cos^{2n+1}x}{(2n+1)!}dx$$

$$=\int\left(1+\sum\limits_{n=1}^\infty\dfrac{\cos^{2n}x}{(2n)!}\right)dx+\int\sum\limits_{n=0}^\infty\dfrac{\cos^{2n+1}x}{(2n+1)!}dx$$

For $$n$$ is any natural number,

$$\int\cos^{2n}x~dx=\dfrac{(2n)!x}{4^n(n!)^2}+\sum\limits_{k=1}^n\dfrac{(2n)!((k-1)!)^2\sin x\cos^{2k-1}x}{4^{n-k+1}(n!)^2(2k-1)!}+C$$

This result can be done by successive integration by parts.

For $$n$$ is any non-negative integer,

$$\int\cos^{2n+1}x~dx$$

$$=\int\cos^{2n}x~d(\sin x)$$

$$=\int(1-\sin^2x)^n~d(\sin x)$$

$$=\int\sum\limits_{k=0}^nC_k^n(-1)^k\sin^{2k}x~d(\sin x)$$

$$=\sum\limits_{k=0}^n\dfrac{(-1)^kn!\sin^{2k+1}x}{k!(n-k)!(2k+1)}+C$$

$$\therefore\int\left(1+\sum\limits_{n=1}^\infty\dfrac{\cos^{2n}x}{(2n)!}\right)dx+\int\sum\limits_{n=0}^\infty\dfrac{\cos^{2n+1}x}{(2n+1)!}dx$$

$$=x+\sum\limits_{n=1}^\infty\dfrac{x}{4^n(n!)^2}+\sum\limits_{n=1}^\infty\sum\limits_{k=1}^n\dfrac{((k-1)!)^2\sin x\cos^{2k-1}x}{4^{n-k+1}(n!)^2(2k-1)!}+\sum\limits_{n=0}^\infty\sum\limits_{k=0}^n\dfrac{(-1)^kn!\sin^{2k+1}x}{(2n+1)!k!(n-k)!(2k+1)}+C$$

$$=\sum\limits_{n=0}^\infty\dfrac{x}{4^n(n!)^2}+\sum\limits_{n=1}^\infty\sum\limits_{k=1}^n\dfrac{((k-1)!)^2\sin x\cos^{2k-1}x}{4^{n-k+1}(n!)^2(2k-1)!}+\sum\limits_{n=0}^\infty\sum\limits_{k=0}^n\dfrac{(-1)^kn!\sin^{2k+1}x}{(2n+1)!k!(n-k)!(2k+1)}+C$$