Recall that e^(ix) = cos(x) + i*sin(x) where i^2 = -1. Then e^(i(-x)) = cos(-x) + i*sin(-x) = cos(x) – i*sin(x). Adding both e^(ix) and e^(-ix) yields: e^(ix) + e^(-ix) = 2cos(x). So cos(x) = (e^(ix) + e^(-ix)) / 2. With this identity of cos(x) at hand, the expansion of (e^x)cos(x) is as follows: (1) (e^x)cos(x) = (e^x) * (e^(ix) + e^(-ix)) / 2 = (1/2)e^[(1+i)x] + (1/2)e^[(1-i)x] (2) Let u = (1+i)x, z = (1-i)x so that (1/2)e^[(1+i)x] + (1/2)e^[(1-i)x] = (1/2)e^u + (1/2)e^z (3) Expand e^u and e^z e^u = 1 + u + u^2/2! + u^3/3! + u^4/4! + u^5/5! + u^6/6! + u^7/7! + ... e^z = 1 + z + z^2/2! + z^3/3! + z^4/4! + z^5/5! + z^6/6! + z^7/7! + ... Then substituting back (1+i)x and (1-i)x yields e^u = e^[(1+i)x] = 1 + (1+i)x + (1+i)^2 x^2/2! + (1+i)^3 x^3/3! + ... e^z = e^[(1-i)x] = 1 + (1-i)x + (1-i)^2 x^2/2! + (1-i)^3 x^3/3! + ... (4) Evaluate each power of (1+-i)^n in the each term of the Taylor series so that we have e^[(1+i)x] = 1 + (1+i)x + (2i)x^2/2! + (-2+2i)x^3/3! + (-4)x^4/4! + (-4-4i)x^5/5! + (-8i)x^6/6! + (8-8i)x^7/7! + ... e^[(1-i)x] = 1 + (1-i)x + (-2i)x^2/2! + (-2-2i)x^3/3! + (-4)x^4/4! + (-4+4i)x^5/5! + (8i)x^6/6! + (8+8i)x^7/7! + ... Now add each x^n/n! from both equations to get e^[(1+i)x] + e^[(1-i)x] = 2 + 2x + (-4)x^3/3! + (-8)x^4/4! + (-8)x^5/5! + 16x^7/7! + ... Then divide by 2 (from eqn (1)) so that (e^x)cos(x) = (1/2)e^[(1+i)x] + (1/2)e^[(1-i)x] = (1/2) * (e^[(1+i)x] + e^[(1-i)x]) = 1 + x + (-2)x^3/3! + (-4)x^4/4! + (-4)x^5/5! + 8x^7/7! + ... (5) Writing the series in summation form and accounting for the factorials finally gives us (e^x)cos(x) = sum[n = 1...oo, (1/2) * (x^n/n!) * ((1+i)^n+(1-i)^n)] = 1 + x - (1/3)x^3 - (1/6)x^4 - (1/30)x^5 + (1/630)x^7 + ... (with radius of convergence (-oo,oo))
In some beginning courses, the student is encouraged to re-write (e^x)cos(x) as (1 + x + x^2/2! + x^3/3! + ... ) * (1 - x^2/2! + x^4/4! - x^6/6! + ...) and multiply out the expression and collect like terms. Finding the power series using Euler's identity gives an interesting alternative to this.