Use complex numbers.
Write #cos(2x) = Re(e^(i 2 x))#
So,
#int e^(-x) cos(2x) dx = Re int e^(-x)e^(i 2 x) dx = Re int e^((-1+2i)x) dx#
Now it's easy to integrate because you know that if #a ne 0#, #int e^(ax) dx = 1/a e^(ax) + cst#. So :
#int e^(-x)cos(2x) dx = Re(1/(-1+2i) e^((-1+2i)x)) + cst#
After that, you have to simplify #1/(-1+2i) e^((-1+2i)x)# :
# e^(-x)/(-1+2i) = e^(-x)(cos(2x) + i sin(2x))/(-1+2i)#
Multiply by #(-1-2i)# everywhere and use the fact that #(a-bi)(a+bi) = a^2+b^2# :
#(cos(2x) + i sin(2x))/(-1+2i) = ((cos(2x) +i sin(2x))(-1-2i))/(1+4)#
Keep only the real part :
#Re((cos(2x) + i sin(2x))/(-1+2i)) = (-cos(2x) + 2 sin(2x))/5#
Finally,
#int e^(-x)cos(2x) dx = e^(-x)/5 (-cos(2x) + 2 sin(2x)) + cst#