• No results found

Complex Numbers and Trigonometry

N/A
N/A
Protected

Academic year: 2022

Share "Complex Numbers and Trigonometry"

Copied!
10
0
0

Loading.... (view fulltext now)

Full text

(1)

Complex Numbers and Trigonometry

Thomas J. Sargent and John Stachurski March 9, 2021

1 Contents

β€’ Overview2

β€’ De Moivre’s Theorem 3

β€’ Applications of de Moivre’s Theorem4

2 Overview

This lecture introduces some elementary mathematics and trigonometry.

Useful and interesting in its own right, these concepts reap substantial rewards when studying dynamics generated by linear difference equations or linear differential equations.

For example, these tools are keys to understanding outcomes attained by Paul Samuelson (1939) [1] in his classic paper on interactions between the investment accelerator and the Keynesian consumption function, our topic in the lecture Samuelson Multiplier Accelerator.

In addition to providing foundations for Samuelson’s work and extensions of it, this lec- ture can be read as a stand-alone quick reminder of key results from elementary high school trigonometry.

So let’s dive in.

2.1 Complex Numbers

A complex number has a real part π‘₯ and a purely imaginary part 𝑦.

The Euclidean, polar, and trigonometric forms of a complex number 𝑧 are:

𝑧 = π‘₯ + 𝑖𝑦 = π‘Ÿπ‘’π‘–πœƒ= π‘Ÿ(cos πœƒ + 𝑖 sin πœƒ) The second equality above is known as Euler’s formula

β€’ Euler contributed many other formulas too!

(2)

The complex conjugate ̄𝑧 of 𝑧 is defined as

Μ„

𝑧 = π‘₯ βˆ’ 𝑖𝑦 = π‘Ÿπ‘’βˆ’π‘–πœƒ= π‘Ÿ(cos πœƒ βˆ’ 𝑖 sin πœƒ) The value π‘₯ is the real part of 𝑧 and 𝑦 is the imaginary part of 𝑧.

The symbol |𝑧| =√

Μ„

𝑧 β‹… 𝑧 = π‘Ÿ represents the modulus of 𝑧.

The value π‘Ÿ is the Euclidean distance of vector (π‘₯, 𝑦) from the origin:

π‘Ÿ = |𝑧| = √π‘₯2+ 𝑦2 The value πœƒ is the angle of (π‘₯, 𝑦) with respect to the real axis.

Evidently, the tangent of πœƒ is (π‘₯𝑦).

Therefore,

πœƒ = tanβˆ’1(𝑦 π‘₯) Three elementary trigonometric functions are

cos πœƒ = π‘₯

π‘Ÿ = π‘’π‘–πœƒ+ π‘’βˆ’π‘–πœƒ

2 , sin πœƒ = 𝑦

π‘Ÿ = π‘’π‘–πœƒβˆ’ π‘’βˆ’π‘–πœƒ

2𝑖 , tan πœƒ = 𝑦 π‘₯ We’ll need the following imports:

In [1]: import numpy as np

import matplotlib.pyplot as plt

%matplotlib inline from sympy import *

2.2 An Example

Consider the complex number 𝑧 = 1 +√ 3𝑖.

For 𝑧 = 1 +√

3𝑖, π‘₯ = 1, 𝑦 =√ 3.

It follows that π‘Ÿ = 2 and πœƒ = tanβˆ’1(√

3) = πœ‹3 = 60π‘œ.

Let’s use Python to plot the trigonometric form of the complex number 𝑧 = 1 +√ 3𝑖.

In [2]: # Abbreviate useful values and functions Ο€ = np.pi

zeros = np.zeros ones = np.ones

# Set parameters r = 2

ΞΈ = Ο€/3

x = r * np.cos(ΞΈ)

x_range = np.linspace(0, x, 1000) ΞΈ_range = np.linspace(0, ΞΈ, 1000)

(3)

# Plot

fig = plt.figure(figsize=(8, 8))

ax = plt.subplot(111, projection='polar')

ax.plot((0, ΞΈ), (0, r), marker='o', color='b') # Plot r ax.plot(zeros(x_range.shape), x_range, color='b') # Plot x ax.plot(ΞΈ_range, x / np.cos(ΞΈ_range), color='b') # Plot y ax.plot(ΞΈ_range, ones(ΞΈ_range.shape) * 0.1, color='r') # Plot ΞΈ ax.margins(0) # Let the plot starts at origin

ax.set_title("Trigonometry of complex numbers", va='bottom', fontsize='x-large')

ax.set_rmax(2)

ax.set_rticks((0.5, 1, 1.5, 2)) # Less radial ticks

ax.set_rlabel_position(-88.5) # Get radial labels away from plotted line ax.text(ΞΈ, r+0.01 , r'$z = x + iy = 1 + \sqrt{3}\, i$') # Label z

ax.text(ΞΈ+0.2, 1 , '$r = 2$') # Label r

ax.text(0-0.2, 0.5, '$x = 1$') # Label x

ax.text(0.5, 1.2, r'$y = \sqrt{3}$') # Label y ax.text(0.25, 0.15, r'$\theta = 60^o$') # Label ΞΈ ax.grid(True)

plt.show()

(4)

3 De Moivre’s Theorem

de Moivre’s theorem states that:

(π‘Ÿ(cos πœƒ + 𝑖 sin πœƒ))𝑛 = π‘Ÿπ‘›π‘’π‘–π‘›πœƒ= π‘Ÿπ‘›(cos π‘›πœƒ + 𝑖 sin π‘›πœƒ)

To prove de Moivre’s theorem, note that

(π‘Ÿ(cos πœƒ + 𝑖 sin πœƒ))𝑛= (π‘Ÿπ‘’π‘–πœƒ)𝑛

and compute.

(5)

4 Applications of de Moivre’s Theorem

4.1 Example 1

We can use de Moivre’s theorem to show that π‘Ÿ = √π‘₯2+ 𝑦2. We have

1 = π‘’π‘–πœƒπ‘’βˆ’π‘–πœƒ

= (cos πœƒ + 𝑖 sin πœƒ)(cos (-πœƒ) + 𝑖 sin (-πœƒ))

= (cos πœƒ + 𝑖 sin πœƒ)(cos πœƒ βˆ’ 𝑖 sin πœƒ)

= cos2πœƒ + sin2πœƒ

= π‘₯2 π‘Ÿ2 +𝑦2

π‘Ÿ2 and thus

π‘₯2+ 𝑦2= π‘Ÿ2 We recognize this as a theorem of Pythagoras.

4.2 Example 2

Let 𝑧 = π‘Ÿπ‘’π‘–πœƒ and ̄𝑧 = π‘Ÿπ‘’βˆ’π‘–πœƒ so that ̄𝑧 is the complex conjugate of 𝑧.

(𝑧, ̄𝑧) form a complex conjugate pair of complex numbers.

Let π‘Ž = π‘π‘’π‘–πœ” and Μ„π‘Ž = π‘π‘’βˆ’π‘–πœ” be another complex conjugate pair.

For each element of a sequence of integers 𝑛 = 0, 1, 2, … ,.

To do so, we can apply de Moivre’s formula.

Thus,

π‘₯𝑛 = π‘Žπ‘§π‘›+ Μ„π‘Ž ̄𝑧𝑛

= π‘π‘’π‘–πœ”(π‘Ÿπ‘’π‘–πœƒ)𝑛+ π‘π‘’βˆ’π‘–πœ”(π‘Ÿπ‘’βˆ’π‘–πœƒ)𝑛

= π‘π‘Ÿπ‘›π‘’π‘–(πœ”+π‘›πœƒ)+ π‘π‘Ÿπ‘›π‘’βˆ’π‘–(πœ”+π‘›πœƒ)

= π‘π‘Ÿπ‘›[cos (πœ” + π‘›πœƒ) + 𝑖 sin (πœ” + π‘›πœƒ) + cos (πœ” + π‘›πœƒ) βˆ’ 𝑖 sin (πœ” + π‘›πœƒ)]

= 2π‘π‘Ÿπ‘›cos (πœ” + π‘›πœƒ)

4.3 Example 3

This example provides machinery that is at the heard of Samuelson’s analysis of his multiplier-accelerator model [1].

Thus, consider a second-order linear difference equation

π‘₯𝑛+2= 𝑐1π‘₯𝑛+1+ 𝑐2π‘₯𝑛

(6)

whose characteristic polynomial is

𝑧2βˆ’ 𝑐1𝑧 βˆ’ 𝑐2= 0 or

(𝑧2βˆ’ 𝑐1𝑧 βˆ’ 𝑐2) = (𝑧 βˆ’ 𝑧1)(𝑧 βˆ’ 𝑧2) = 0 has roots 𝑧1, 𝑧1.

A solution is a sequence {π‘₯𝑛}βˆžπ‘›=0that satisfies the difference equation.

Under the following circumstances, we can apply our example 2 formula to solve the differ- ence equation

β€’ the roots 𝑧1, 𝑧2 of the characteristic polynomial of the difference equation form a com- plex conjugate pair

β€’ the values π‘₯0, π‘₯1 are given initial conditions

To solve the difference equation, recall from example 2 that

π‘₯𝑛 = 2π‘π‘Ÿπ‘›cos (πœ” + π‘›πœƒ)

where πœ”, 𝑝 are coefficients to be determined from information encoded in the initial conditions π‘₯1, π‘₯0.

Since π‘₯0= 2𝑝 cos πœ” and π‘₯1= 2π‘π‘Ÿ cos (πœ” + πœƒ) the ratio of π‘₯1to π‘₯0is π‘₯1

π‘₯0 = π‘Ÿ cos (πœ” + πœƒ) cos πœ”

We can solve this equation for πœ” then solve for 𝑝 using π‘₯0= 2π‘π‘Ÿ0cos (πœ” + π‘›πœƒ).

With the sympy package in Python, we are able to solve and plot the dynamics of π‘₯𝑛 given different values of 𝑛.

In this example, we set the initial values: - π‘Ÿ = 0.9 - πœƒ = 14πœ‹ - π‘₯0= 4 - π‘₯1= π‘Ÿ β‹… 2√

2 = 1.8√ 2.

We first numerically solve for πœ” and 𝑝 using nsolve in the sympy package based on the above initial condition:

In [3]: # Set parameters r = 0.9

ΞΈ = Ο€/4 x0 = 4

x1 = 2 * r * sqrt(2)

# Define symbols to be calculated Ο‰, p = symbols('Ο‰ p', real=True)

# Solve for Ο‰

## Note: we choose the solution near 0 eq1 = Eq(x1/x0 - r * cos(Ο‰+ΞΈ) / cos(Ο‰), 0) Ο‰ = nsolve(eq1, Ο‰, 0)

Ο‰ = np.float(Ο‰)

(7)

print(f'Ο‰ = {Ο‰:1.3f}')

# Solve for p

eq2 = Eq(x0 - 2 * p * cos(Ο‰), 0) p = nsolve(eq2, p, 0)

p = np.float(p)

print(f'p = {p:1.3f}')

Ο‰ = 0.000 p = 2.000

Using the code above, we compute that πœ” = 0 and 𝑝 = 2.

Then we plug in the values we solve for πœ” and 𝑝 and plot the dynamic.

In [4]: # Define range of n max_n = 30

n = np.arange(0, max_n+1, 0.01)

# Define x_n

x = lambda n: 2 * p * r**n * np.cos(Ο‰ + n * ΞΈ)

# Plot

fig, ax = plt.subplots(figsize=(12, 8)) ax.plot(n, x(n))

ax.set(xlim=(0, max_n), ylim=(-5, 5), xlabel='$n$', ylabel='$x_n$')

# Set x-axis in the middle of the plot ax.spines['bottom'].set_position('center') ax.spines['right'].set_color('none')

ax.spines['top'].set_color('none') ax.xaxis.set_ticks_position('bottom') ax.yaxis.set_ticks_position('left')

ticklab = ax.xaxis.get_ticklabels()[0] # Set x-label position trans = ticklab.get_transform()

ax.xaxis.set_label_coords(31, 0, transform=trans)

ticklab = ax.yaxis.get_ticklabels()[0] # Set y-label position trans = ticklab.get_transform()

ax.yaxis.set_label_coords(0, 5, transform=trans) ax.grid()

plt.show()

(8)

4.4 Trigonometric Identities

We can obtain a complete suite of trigonometric identities by appropriately manipulating po- lar forms of complex numbers.

We’ll get many of them by deducing implications of the equality

𝑒𝑖(πœ”+πœƒ) = π‘’π‘–πœ”π‘’π‘–πœƒ For example, we’ll calculate identities for

cos (πœ” + πœƒ) and sin (πœ” + πœƒ).

Using the sine and cosine formulas presented at the beginning of this lecture, we have:

cos (πœ” + πœƒ) = 𝑒𝑖(πœ”+πœƒ)+ π‘’βˆ’π‘–(πœ”+πœƒ) 2

sin (πœ” + πœƒ) = 𝑒𝑖(πœ”+πœƒ)βˆ’ π‘’βˆ’π‘–(πœ”+πœƒ) 2𝑖

We can also obtain the trigonometric identities as follows:

cos (πœ” + πœƒ) + 𝑖 sin (πœ” + πœƒ) = 𝑒𝑖(πœ”+πœƒ)

= π‘’π‘–πœ”π‘’π‘–πœƒ

= (cos πœ” + 𝑖 sin πœ”)(cos πœƒ + 𝑖 sin πœƒ)

= (cos πœ” cos πœƒ βˆ’ sin πœ” sin πœƒ) + 𝑖(cos πœ” sin πœƒ + sin πœ” cos πœƒ) Since both real and imaginary parts of the above formula should be equal, we get:

(9)

cos (πœ” + πœƒ) = cos πœ” cos πœƒ βˆ’ sin πœ” sin πœƒ sin (πœ” + πœƒ) = cos πœ” sin πœƒ + sin πœ” cos πœƒ

The equations above are also known as the angle sum identities. We can verify the equa- tions using the simplify function in the sympy package:

In [5]: # Define symbols

Ο‰, ΞΈ = symbols('Ο‰ ΞΈ', real=True)

# Verify

print("cos(Ο‰)cos(ΞΈ) - sin(Ο‰)sin(ΞΈ) =",

simplify(cos(Ο‰)*cos(ΞΈ) - sin(Ο‰) * sin(ΞΈ))) print("cos(Ο‰)sin(ΞΈ) + sin(Ο‰)cos(ΞΈ) =",

simplify(cos(Ο‰)*sin(ΞΈ) + sin(Ο‰) * cos(ΞΈ)))

cos(Ο‰)cos(ΞΈ) - sin(Ο‰)sin(ΞΈ) = cos(ΞΈ + Ο‰) cos(Ο‰)sin(ΞΈ) + sin(Ο‰)cos(ΞΈ) = sin(ΞΈ + Ο‰)

4.5 Trigonometric Integrals

We can also compute the trigonometric integrals using polar forms of complex numbers.

For example, we want to solve the following integral:

∫

πœ‹

βˆ’πœ‹

cos(πœ”) sin(πœ”) π‘‘πœ” Using Euler’s formula, we have:

∫ cos(πœ”) sin(πœ”) π‘‘πœ” = ∫(π‘’π‘–πœ”+ π‘’βˆ’π‘–πœ”) 2

(π‘’π‘–πœ”βˆ’ π‘’βˆ’π‘–πœ”)

2𝑖 π‘‘πœ”

= 1

4π‘–βˆ« 𝑒2π‘–πœ”βˆ’ π‘’βˆ’2π‘–πœ”π‘‘πœ”

= 1 4𝑖(βˆ’π‘–

2 𝑒2π‘–πœ”βˆ’ 𝑖

2π‘’βˆ’2π‘–πœ”+ 𝐢1)

= βˆ’1

8[(π‘’π‘–πœ”)

2

+ (π‘’βˆ’π‘–πœ”)

2

βˆ’ 2] + 𝐢2

= βˆ’1

8(π‘’π‘–πœ”βˆ’ π‘’βˆ’π‘–πœ”)2+ 𝐢2

= 1

2(π‘’π‘–πœ”βˆ’ π‘’βˆ’π‘–πœ”

2𝑖 )

2

+ 𝐢2

= 1

2sin2(πœ”) + 𝐢2 and thus:

∫

πœ‹

βˆ’πœ‹

cos(πœ”) sin(πœ”) π‘‘πœ” = 1

2sin2(πœ‹) βˆ’1

2sin2(βˆ’πœ‹) = 0

We can verify the analytical as well as numerical results using integrate in the sympy package:

(10)

In [6]: # Set initial printing init_printing()

Ο‰ = Symbol('Ο‰')

print('The analytical solution for integral of cos(Ο‰)sin(Ο‰) is:') integrate(cos(Ο‰) * sin(Ο‰), Ο‰)

The analytical solution for integral of cos(Ο‰)sin(Ο‰) is:

Out[6]: sin2(πœ”) 2

In [7]: print('The numerical solution for the integral of cos(Ο‰)sin(Ο‰) \ from -Ο€ to Ο€ is:')

integrate(cos(Ο‰) * sin(Ο‰), (Ο‰, -Ο€, Ο€))

The numerical solution for the integral of cos(Ο‰)sin(Ο‰) from -Ο€ to Ο€ is:

Out[7]: 0

4.6 Exercises

We invite the reader to verify analytically and with the sympy package the following two equalities:

∫

πœ‹

βˆ’πœ‹

cos(πœ”)2π‘‘πœ” =πœ‹ 2

∫

πœ‹

βˆ’πœ‹

sin(πœ”)2π‘‘πœ” =πœ‹ 2

References

[1] Paul A. Samuelson. Interactions between the multiplier analysis and the principle of accel- eration. Review of Economic Studies, 21(2):75–78, 1939.

References

Related documents

Therefore, if we had refused the offer, we faced a risk that the claim would proceed to trial and that the awards under the various heads would equate to

Point Defects A pixel that deviates by more than 9 mV above neighboring pixels under non-illuminated conditions.. --

Bandak’s study highlighted the important fact that the amount of force necessary to cause the injuries for a shaken baby diagnosis would cause serious injury to an infant’s

β€’ Providers must include the name of the individual installing the car seat on the CSHCN Services Program Prior Authorization and Authorization Request for Durable Medical

Kyakulumbye, Stephen; Pather, Shaun; and Jantjies, Mmaki (2019) "Towards design of citizen centric e- government projects in developing country context: the design-reality gap

Two-digit code services (telex and telephone) and fault codes The following tables list the two-digit access codes which are available via the Inmarsat network and are supported

If, before wearing down to 2/32nds of an inch of tread or bar depth remaining, and before the end of the fifth year of service (proof-of-purchase required) or before the end of

Cast Barun Sobti, Shahana Goswami, Pallavi Batra India, 119 mins, 2016, English, Hindi & Konkani with English subtitles, Cert: 18.. YOU ARE