Functions containing sine or cosine can be expressed as complex exponentials using
Euler's formula.
Example: suppose we wanted to integrate:

Then the cosine function can be expressed in its Euler form:


This is far easier to integrate.
Alternatively, we may also take note of real and imaginary portions of complex numbers
Cosine is the real portion of a complex number written in cos x + i sin x form
This calculation continues as:
=Re (1/(1+i)) * exp((1+i)*x)
=Re ( 1/2 + i*1/2 ) * exp(x) * (cos (x) +i*sin(x))
=Re 1/2*exp(x)*cos(x)+1/2*i*exp(x)*sin(x)-1/2*i*exp(x)*cos(x)+1/2*exp(x)*sin(x)
=1/2 exp(x)*cos(x) + 1/2 exp(x)*sin(x)