### 8.2. Euler's Formula

Having expanded our horizons to include the complex numbers, it's natural to want to extend functions we knew and loved from the world of real numbers so that they can also operate on complex numbers. The only really natural way to do this in general is to use Taylor series. A particularly beautiful thing happens with the functions ex, sin x, and cos x:

\begin{align} e^x &= 1 + \frac{1}{2!}x^2 + \frac{1}{3!}x^3 + ... \\ \cos x &= 1 - \frac{1}{2!}x^2 + \frac{1}{4!}x^4 - ... \\ \sin x &= x - \frac{1}{3!}x^3 + \frac{1}{5!}x^5 - ... \end{align}

If x=iφ is an imaginary number, we have

$e^{iφ} = \cos φ + i \sin φ ,$

a result known as Euler's formula. The geometrical interpretation in the complex plane is shown in Figure F.

Figure F. The complex number eiφ lies on the unit circle.

Although the result may seem like something out of a freak show at first, applying the definition [2] of the exponential function makes it clear how natural it is:

\begin{align} e^x = \lim_{n\rightarrow \infty} \left(1+\frac{x}{n}\right)^n . \end{align}

[2] See page 151 for an explanation of where this definition comes from and why it makes sense.

When x=iφ is imaginary, the quantity (1+iφ/n) represents a number lying just above 1 in the complex plane. For large n, (1+iφ/n) becomes very close to the unit circle, and its argument is the small angle φ/n. Raising this number to the nth power multiplies its argument by n, giving a number with an argument of φ.

Figure G. Leonhard Euler (1707-1783)

Euler's formula is used frequently in physics and engineering.

#### Example 90

◊ Write the sine and cosine functions in terms of exponentials.

◊ Euler's formula for x = -iφ gives cos φ - i sin φ, since cos(-θ) = cosθ, and sin(-θ) = -sinθ.

\begin{align} \cos x &= \frac{e^{ix}+e^{-ix}}{2} \\ \sin x &= \frac{e^{ix}-e^{-ix}}{2i} \end{align}

#### Example 91

◊ Evaluate

$\int e^x \cos x dx$

◊ Problem 15 on p. 99 suggested a special-purpose trick for doing this integral. An approach that doesn't rely on tricks is to rewrite the cosine in terms of exponentials:

\begin{align} \int e^x & \cos x dx \\ &= \int e^x \left(\frac{e^{ix}+e^{-ix}}{2}\right) dx \\ &= \frac{1}{2} \int (e^{(1+i)x}+e^{(1-i)x})dx \\ &= \frac{1}{2} \left( \frac{e^{(1+i)x}}{1+i}+\frac{e^{(1-i)x}}{1-i} \right)+ c \end{align}

Since this result is the integral of a real-valued function, we'd like it to be real, and in fact it is, since the first and second terms are complex conjugates of one another. If we wanted to, we could use Euler's theorem to convert it back to a manifestly real result [3].

[3] In general, the use of complex number techniques to do an integral could result in a complex number, but that complex number would be a constant, which could be subsumed within the usual constant of integration.

#### Example 92

Euler found the equation

$\pi = 20\tan^{-1}\frac{1}{7}+8\tan^{-1}\frac{3}{79} ,$

which allowed the computation of π to high precision in the era before electronic calculators, since the Taylor series for the inverse tangent converges rapidly for small inputs. A cute way of proving the validity of the equation is to calculate

(7+i)20(79+3i)8

as follows in Yacas:

   (7+I)^20*(79+3*I)^8;
-1490116119384765625
00000000000000


The fact that it is purely real, and has a negative real part, demonstrates that the quantity on the right side of the original equation equals π + 2πn, where n is an integer. Numerical estimation shows that n=0. Although the proof was straightforward, it provides zero insight into how Euler figured it out in the first place!