# Evaluating $\int {e^x \sin (k \pi x) } dx$

I'm trying to integrate $$I = \int {e^x \sin (k \pi x)} dx.$$ I've used Matlab and Wolfram Alpha, which have both given me the result $$I = \frac{e^x(\sin (k \pi x) - \cos (k \pi x))}{k^2 \pi^2 +1 }.$$

How did these programs get this result?

• I do not know, probably by expressing $\sin t$ as $\frac{e^{it}-e^{-it}}{2i}$. But that is not the way it is done in a first calculus course. – André Nicolas Oct 1 '14 at 4:06
• – lab bhattacharjee Oct 1 '14 at 5:35

Consider $e^{ik\pi x} = \cos k\pi x + i \sin k\pi x$. The integrand becomes $e^{(ik\pi + 1)x}$, then take the imaginary part after integrating. We get:

$$\int e^{(ik\pi + 1) x} dx=\frac{e^{(ik\pi+1)x}}{ik\pi + 1}+C = \frac{(1-ik\pi)e^{(ik\pi+1)x}}{1+k^2\pi^2}+C=\frac{(1-ik\pi)e^x (\cos k\pi x+ i \sin k\pi x)}{1+k^2\pi^2}+C$$

Take the imaginary parts of both sides, should yield same result as integration by parts.

$$\therefore \int e^x \sin k\pi x \,dx =\frac{e^x (\sin k\pi x - k\pi \cos k\pi x)}{1+k^2\pi^2}+C$$

• this ought to be taught in first calculus courses along with basic complex arithmetic. Nice answer. – James S. Cook Oct 1 '14 at 4:35

$$I = \int e^x \sin (k \pi x) dx\\=\sin k\pi x\int e^xdx-\int k\pi\cos k\pi x \left(\int e^xdx \right)dx\\=e^x\sin k\pi x-k\pi\int e^x\cos k \pi x\\=e^x\sin k\pi x-k\pi\left(\cos k\pi x\int e^x dx-\int k\pi \sin k\pi x\left(\int e^x dx\right)dx\right) \\ I=e^x(\sin k \pi x -k\pi\cos k\pi x)+k^2\pi^2 I+c$$ $$I=\frac{e^x(\sin k\pi x-k\pi\cos k\pi x)}{1+k^2\pi^2}+c$$

In general: $$I_{a,b}=\int e^{ax}\sin bx dx=\frac{e^{ax}(a\sin bx-b\cos bx)}{a^2+b^2}+c$$

• Also a good solution! @James Harrison's jsut looked nicer. – jamesh625 Oct 1 '14 at 14:23

Hint: Use integration by parts twice.