How to rewrite $\frac{1}{-a+ib}$ with partial fractions? I faced some difficulties while trying to calculate $\int e^{-ax}$cos(bx)dx. I rewrote this as the integral of $e^{(-a + ib)x}$ calculating  $\int e^{(-a + ib)x}dx$ (the answer is then the real part of the latter integral). I found $$\int e^{(-a + ib)x}dx = \frac{1}{-a+ib}e^{(-a + ib)x}.$$ My problem is that I don't know how to rewrite $\frac{1}{-a+ib}$, because when I try to use the basic rules for partial fractions, I get stuck. Thanks!
 A: Using
$$\int e^{(-a + ib)x}dx = \frac{1}{-a+ib}e^{(-a + ib)x}$$
and $e^{(-a + i b) x} = e^{-a x} \, (\cos(b x) + i \sin(b x))$ then
\begin{align}
\int e^{(-a + ib)x}dx &= \frac{1}{-a+ib}e^{(-a + ib)x} \\
&= \frac{1}{-a + i b} \cdot \frac{-a - i b}{-a - i b} \, e^{(-a + ib) x} \\
&= \frac{-a - i b}{a^{2} + b^{2}} \,  e^{(-a + ib) x} \\
&= \frac{e^{-a x}}{a^{2} + b^{2}} \, [ (a \cos(bx) - b \sin(b x)) + i \, (b \cos(b x) + a \sin( b x))] 
\end{align}
for which
\begin{align}
\int e^{-a x} \, \cos(b x) \, dx &= \frac{e^{-a x}}{a^{2} + b^{2}} \, (a \cos(bx) - b \sin(b x)) \\
\int e^{- a x} \, \sin(b x) \, dx &= \frac{e^{-a x}}{a^{2} + b^{2}} \, (b \cos(b x) + a \sin( b x))
\end{align}
Suppose the limits of the integral are $(0, \infty)$ then these become
\begin{align}
\int_{0}^{\infty} e^{-a x} \, \cos(b x) \, dx &= \frac{a}{a^{2} + b^{2}} \\
\int_{0}^{\infty} e^{- a x} \, \sin(b x) \, dx &= \frac{b}{a^{2} + b^{2}} 
\end{align}
A: write $$\frac{1}{-a+bi}\cdot \frac{-a-bi}{-a-bi}$$
A: First off, I think that the problem that you are having is with simplifying
$$ \frac{1}{-a+ib}, $$
which is not a partial fractions problem at all.  Instead, multiply upstairs and downstairs by the conjugate $-a-ib$, then simplify.  That will finish the problem for you.
That said, starting from the initial integral, I get the following (without having to track real and imaginary parts, at the cost of doing a little extra computation):
\begin{align}
\int \mathrm{e}^{-ax} \cos(bx) \,\mathrm{d}x
&= \frac{1}{2} \int \mathrm{e}^{-ax} \left( \mathrm{e}^{ibx} + \mathrm{e}^{-ibx}\right) \,\mathrm{d}x \\
&= \frac{1}{2} \int \mathrm{e}^{(-a+ib)x} + \mathrm{e}^{(-a-ib)x}\, \mathrm{d}x \\
&= \frac{1}{2} \left( \frac{1}{-a+ib}\mathrm{e}^{(-a+ib)x} + \frac{1}{-a-ib}\mathrm{e}^{(-a-ib)x}\right) \\
&= \frac{\mathrm{e}^{-ax}}{2} \left( \frac{1}{-a+ib}\cdot \frac{-a - ib}{-a - ib}\mathrm{e}^{ibx} - \frac{1}{a+ib}\frac{a - ib}{a - ib}\mathrm{e}^{-ibx}\right) \\
&= \frac{\mathrm{e}^{-ax}}{2(a^2+b^2)} \left( \left(-a-ib \right)\mathrm{e}^{ibx} -  \left(a-ib \right)\mathrm{e}^{-ibx}\right) \\
&= \frac{\mathrm{e}^{-ax}}{2(a^2+b^2)} \left( -a\left( \mathrm{e}^{ibx} + \mathrm{e}^{ibx} \right) - ib\left( \mathrm{e}^{ibx} - \mathrm{e}^{ibx} \right)\right) \\
&= \frac{\mathrm{e}^{-ax}}{2(a^2+b^2)} \left( -2a\left( \frac{\mathrm{e}^{ibx} + \mathrm{e}^{ibx}}{2} \right) - (2i)ib\left( \frac{\mathrm{e}^{ibx} - \mathrm{e}^{ibx}}{2i} \right)\right) \\
&= \frac{\mathrm{e}^{-ax}}{2(a^2+b^2)} \left( -2a\cos(bx) + 2b \sin(bx) \right) \\
&= \frac{\mathrm{e}^{-ax}(b\sin(bx) - a\cos(bx))}{(a^2+b^2)}.
\end{align}
That being said, I think that it might be more straight-forward to tackle this integral via the usual integration by parts trickery:
\begin{align}
I
&= \int \mathrm{e}^{-ax} \cos(bx)\,\mathrm{d}x \\
&= \frac{\mathrm{e}^{-ax}\sin(bx)}{b} + \frac{a}{b} \int \mathrm{e}^{-ax}\sin(bx)\,\mathrm{d}x \\
&= \frac{\mathrm{e}^{-ax}\sin(bx)}{b} - \frac{a \mathrm{e}^{-ax} \cos(bx)}{b^2} - \frac{a^2}{b^2} \int \mathrm{e}^{-ax}\cos(bx)\,\mathrm{d}x \\
&= \frac{\mathrm{e}^{-ax}\sin(bx)}{b} - \frac{a \mathrm{e}^{-ax} \cos(bx)}{b^2} - \frac{a^2}{b^2}I.
\end{align}
Solving for $I$, we obtain
\begin{align}
\left(1+\frac{a^2}{b^2}\right)I
= \frac{\mathrm{e}^{-ax}\sin(bx)}{b} - \frac{a \mathrm{e}^{-ax} \cos(bx)}{b^2}
&\implies \left( \frac{b^2 + a^2}{b^2} \right) I
= \frac{\mathrm{e}^{-ax}}{b^2} \left( b \sin(bx) - a \cos(bx) \right) \\
&\implies I
= \frac{\mathrm{e}^{-ax}}{a^2 + b^2} \left( b \sin(bx) - a \cos(bx) \right),
\end{align}
which is the same as the above, but requires no complexification.
