Trigonometry by Michael Corral - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

3

= π 3

reflection −3 θ = − π around the x-axis in QIV. Adding multiples of 2 π to these gives us:

3

π

3 θ = ±

+ 2 πk

for k = 0, ±1, ±2, ...

3

So dividing everything by 3 we get the general solution for θ:

π

2 π

θ = ±

+

k

for k = 0, ±1, ±2, ...

9

3

Example 6.7

Solve the equation sin 2 θ = sin θ.

Solution: Here we use the double-angle formula for sine:

sin 2 θ = sin θ

2 sin θ cos θ = sin θ

sin θ (2 cos θ − 1) = 0

1

sin θ = 0 or cos θ = 2

π

θ = 0 , π or θ = ± 3

π

θ = πk and

±

+ 2 πk

for k = 0, ±1, ±2, ...

3

132

Chapter 6 • Additional Topics

§6.1

Example 6.8

Solve the equation 2 sin θ − 3 cos θ = 1.

Solution: We will use the technique which we discussed in Chapter 5 for finding the

13

3

amplitude of a combination of sine and cosine functions. Take the coefficients 2 and

3 of sin θ and −cos θ, respectively, in the above equation and make them the legs

φ

of a right triangle, as in Figure 6.1.1. Let φ be the angle shown in the right triangle.

2

The leg with length 3 > 0 means that the angle φ is above the x-axis, and the leg with

length 2 > 0 means that φ is to the right of the y-axis. Hence, φ must be in QI. The

Figure 6.1.1

hypotenuse has length

13 by the Pythagorean Theorem, and hence cos φ = 2 and

13

sin θ = 3 . We can use this to transform the equation to solve as follows:

13

2 sin θ − 3 cos θ = 1

13

2

sin θ − 3 cos θ = 1

13

13

13 (cos φ sin θ − sin φ cos θ) = 1

13 sin ( θ φ) = 1 (by the sine subtraction formula)

sin ( θ φ) = 113

θ φ = 0.281 or θ φ = π − 0.281 = 2.861

θ = φ + 0.281 or θ = φ + 2.861

Now, since cos φ = 2 and φ is in QI, the most general solution for φ is φ = 0.983+2 πk for k = 0, ±1, 13

±2, ... . So since we needed to add multiples of 2 π to the solutions 0.281 and 2.861 anyway, the most

general solution for θ is:

θ = 0.983 + 0.281 + 2 πk and 0.983 + 2.861 + 2 πk

θ = 1.264 + 2 πk and 3.844 + 2 πk

for k = 0, ±1, ±2, ...

Note: In Example 6.8 if the equation had been 2 sin θ + 3 cos θ = 1 then we still would

have used a right triangle with legs of lengths 2 and 3, but we would have used the sine

addition formula instead of the subtraction formula.

Exercises

For Exercises 1-12, solve the given equation (in radians).

1. tan θ + 1 = 0

2. 2 cos θ + 1 = 0

3. sin 5 θ + 1 = 0

4. 2 cos2 θ − sin2 θ = 1

5. 2 sin2 θ − cos 2 θ = 0

6. 2 cos2 θ + 3 sin θ = 0

7. cos2 θ + 2 sin θ = −1

8. tan θ + cot θ = 2

9. sin θ = cos θ

10. 2 sin θ − 3 cos θ = 0

11. cos2 3 θ − 5 cos 3 θ + 4 = 0 12. 3 sin θ − 4 cos θ = 1

Numerical Methods in Trigonometry • Section 6.2

133

6.2 Numerical Methods in Trigonometry

We were able to solve the trigonometric equations in the previous section fairly easily, which

in general is not the case. For example, consider the equation

cos x = x .

(6.1)

There is a solution, as shown in Figure 6.2.1 below. The graphs of y = cos x and y = x intersect somewhere between x = 0 and x = 1, which means that there is an x in the interval

[0, 1] such that cos x = x.

4

cos( x)

x

3

2

1

y

0

-1

-2

-3

-4

-3

-2

-1

0

1

2

3

x

Figure 6.2.1

y = cos x and y = x

Unfortunately there is no trigonometric identity or simple method which will help us here.

Instead, we have to resort to numerical methods, which provide ways of getting successively

better approximations to the actual solution(s) to within any desired degree of accuracy.

There is a large field of mathematics devoted to this subject called numerical analysis. Many

of the methods require calculus, but luckily there is a method which we can use that requires

just basic algebra. It is called the secant method, and it finds roots of a given function f ( x),

i.e. values of x such that f ( x) = 0. A derivation of the secant method is beyond the scope of

this book,1 but we can state the algorithm it uses to solve f ( x) = 0:

1For an explanation of why the secant method works, see pp. 338-344 in A. RALSTON AND P. RABINOWITZ, A

First Course in Numerical Analysis, 2nd ed., New York: McGraw-Hill Book Co., 1978.

134

Chapter 6 • Additional Topics

§6.2

1. Pick initial points x 0 and x 1 such that x 0 < x 1 and f ( x 0) f ( x 1) < 0 (i.e. the solution is somewhere between x 0 and x 1).

2. For n ≥ 2, define the number xn by

( xn

x

−1 − xn−2) f ( xn−1)

n = xn−1 −

(6.2)

f ( xn−1) − f ( xn−2)

as long as | xn−1 − xn−2| > ǫerror, where ǫerror > 0 is the maximum amount of error desired

(usually a very small number).

3. The numbers x 0, x 1, x 2, x 3, ... will approach the solution x as we go through more iterations, getting as close as desired.

We will now show how to use this algorithm to solve the equation cos x = x. The solution

to that equation is the root of the function f ( x) = cos x x. And we saw that the solution is

somewhere in the interval [0, 1]. So pick x 0 = 0 and x 1 = 1. Then f (0) = 1 and f (1) = −0.4597,

so that f ( x 0) f ( x 1) < 0 (we are using radians, of course). Then by definition,

( x 1 − x 0) f ( x 1)

x 2 = x 1 − f ( x 1) − f ( x 0)

(1 − 0) f (1)

= 1 − f (1) − f (0)

(1 − 0)(−0.4597)

= 1 −

−0.4597 − 1

= 0.6851 ,

( x 2 − x 1) f ( x 2)

x 3 = x 2 − f ( x 2) − f ( x 1)

(0.6851 − 1) f (0.6851)

= 0.6851 −

f (0.6851) − f (1)

(0.6851 − 1)(0.0893)

= 0.6851 − 0.0893 − (−0.4597)

= 0.7363 ,

and so on. Using a calculator is not very efficient and will lead to rounding errors. A bet-

ter way to implement the algorithm is with a computer. Listing 6.1 below shows the code

(secant.java) for solving cos x = x with the secant method, using the Java programming lan-

guage:

Numerical Methods in Trigonometry • Section 6.2

135

Listing 6.1

Program listing for secant.java

1

import java.math.*;

2

public class secant {

3

public static void main (String[] args) {

4

double x0 =

Double.parseDouble(args[0]);

5

double x1 =

Double.parseDouble(args[1]);

6

double x = 0;

7

double error = 1.0E-50;

8

for (int i=2; i <= 10; i++) {

9

if (Double.compare(Math.abs(x0 - x1),error) > 0) {

10

x = x1 - (x1 - x0)*f(x1)/(f(x1) - f(x0));

11

x0 = x1;

12

x1 = x;

13

System.out.println("x" + i + " = " + x);

14

} else {

15

break;

16

}

17

}

18

MathContext mc = new MathContext(50);

19

BigDecimal answer = new BigDecimal(x,mc);

20

System.out.println("x = " + answer);

21

}

22

//Define the function f(x)

23

public static double f (double x) {

24

return Math.cos(x) - x;

25

}

26

}

Lines 4-5 read in x 0 and x 1 as input parameters to the program.

Line 6 initializes the variable that will eventually hold the solution.

Line 7 sets the maximum error ǫerror to be 1.0 × 10−50. That is, our final answer will be

within that (tiny!) amount of the real solution.

Line 8 starts a loop of 9 iterations of the algorithm, i.e. it will create the successive ap-

proximations x 2, x 3, ..., x 10 to the real solution, though in Line 9 we check to see if the two

previous approximations differ by less than the maximum error. If they do, we stop (since

this means we have an acceptable solution), otherwise we continue.

Line 10 is the main step in the algorithm, creating xn from xn−1 and xn−2.

Lines 11-12 set the new values of xn−2 and xn−1, respectively.

Lines 18-20 set the number of decimal places to show in the final answer to 50 (the default

is 16) and then print the answer.

Lines 23-24 give the definition of the function f ( x) = cos x x.

136

Chapter 6 • Additional Topics

§6.2

Below is the result of compiling and running the program using x 0 = 0 and x 1 = 1:

javac secant.java

java secant 0 1

x2 = 0.6850733573260451

x3 = 0.736298997613654

x4 = 0.7391193619116293

x5 = 0.7390851121274639

x6 = 0.7390851332150012

x7 = 0.7390851332151607

x8 = 0.7390851332151607

x = 0.73908513321516067229310920083662495017051696777344

Notice that the program only got up to x 8, not x 10. The reason is that the difference

between x 8 and x 7 was small enough (less than ǫerror = 1.0 × 10−50) to stop at x 8 and call

that our solution. The last line shows that solution to 50 decimal places.

Does that number look familiar? It should, since it is the answer to Exercise 11 in Section

4.1. That is, when taking repeated cosines starting with any number (in radians), you even-

tually start getting the above number repeatedly after enough iterations. This turns out not

to be a coincidence. Figure 6.2.2 gives an idea of why.

1

0.8

y = cos( x)

0.6

y

0.4

y = x

0.2

0

π

-1

0

1

π

2

2

x

Figure 6.2.2

Attractive fixed point for cos x

Since x = 0.73908513321516... is the solution of cos x = x, you would get cos (cos x) =

cos x = x, so cos (cos (cos x)) = cos x = x, and so on. This number x is called an attractive fixed Numerical Methods in Trigonometry • Section 6.2

137

point of the function cos x. No matter where you start, you end up getting “drawn” to it.

Figure 6.2.2 shows what happens when starting at x = 0: taking the cosine of 0 takes you to

1, and then successive cosines (indicated by the intersections of the vertical lines with the

cosine curve) eventually “spiral” in a rectangular fashion to the fixed point (i.e. the solution),

which is the intersection of y = cos x and y = x.

Recall in Example 5.10 in Section 5.2 that we claimed that the maximum and minimum of

the function y = cos 6 x + sin 4 x were ±1.90596111871578, respectively. We can show this by

using the open-source program Octave.2 Octave uses a successive quadratic programming

method to find the minimum of a function f ( x). Finding the maximum of f ( x) is the same as

finding the minimum of − f ( x) then multiplying by −1 (why?). Below we show the commands

to run at the Octave command prompt (octave:n>) to find the minimum of f ( x) = cos 6 x +

sin 4 x. The command sqp(3,’f’) says to use x = 3 as a first approximation of the number x

where f ( x) is a minimum.

octave:1> format long

octave:2> function y = f(x)

> y = cos(6*x) + sin(4*x)

> endfunction

octave:3> sqp(3,’f’)

y = -1.90596111871578

ans = 2.65792064609274

The output says that the minimum occurs when x = 2.65792064609274 and that the min-

imum is −1.90596111871578. To find the maximum of f ( x), we find the minimum of − f ( x)

and then take its negative. The command sqp(2,’f’) says to use x = 2 as a first approxima-

tion of the number x where f ( x) is a maximum.

octave:4> function y = f(x)

> y = -cos(6*x) - sin(4*x)

> endfunction

octave:5> sqp(2,’f’)

y = -1.90596111871578

ans = 2.05446832062993

The output says that the maximum occurs when x = 2.05446832062993 and that the max-

imum is −(−1.90596111871578) = 1.90596111871578.

Recall from Section 2.4 that Heron’s formula is adequate for “typical” triangles, but will

often have a problem when used in a calculator with, say, a triangle with two sides whose

sum is barely larger than the third side. However, you can get around this problem by

using computer software capable of handling numbers with a high degree of precision. Most

2Freely available at http://www.gnu.org/software/octave

138

Chapter 6 • Additional Topics

§6.2

modern computer programming languages have this capability. For example, in the Python

programming language3 (chosen here for simplicity) the decimal module can be used to set

any level of precision.4 Below we show how to get accuracy up to 50 decimal places using

Heron’s formula for the triangle in Example 2.16 from Section 2.4, by using the python

interactive command shell:

>>> from decimal import *

>>> getcontext().prec = 50

>>> a = Decimal("1000000")

>>> b = Decimal("999999.9999979")

>>> c = Decimal("0.0000029")

>>> s = (a+b+c)/2

>>> K = s*(s-a)*(s-b)*(s-c)

>>> print Decimal(K).sqrt()

0.99999999999894999999999894874999999889618749999829

(Note: The triple arrow >>> is just a command prompt, not part of the code.)

Notice in this case that we do get the correct answer; the high level of precision eliminates

the rounding errors shown by many calculators when using Heron’s formula.

Another software option is Sage5, a powerful and free open-source mathematics package

based on Python. It can be run on your own computer, but it can also be run through a web

interface: go to http://sagenb.org to create a free account, then once you register and sign

in, click the New Worksheet link to start entering commands. For example, to find the

solution to cos x = x in the interval [0,1], enter these commands in the worksheet textfield:

x = var(’x’)

find_root(cos(x) == x, 0,1)

Click the evaluate link to display the answer: 0.7390851332151559

Exercises

1. One obvious solution to the equation 2 sin x = x is x = 0. Write a program to find the other

solution(s), accurate to at least within 1.0 × 10−20. You can use any programming language,

though you may find it easier to just modify the code in Listing 6.1 (only one line needs to be

changed!). It may help to use Gnuplot to get an idea of where the graphs of y = 2 sin x and y = x

intersect.

2. Repeat Exercise 1 for the equation sin x = x 2.

3. Use Octave or some other program to find the maximum and minimum of y = cos 5 x − sin 3 x.

3Available for free at http://www.python.org

4Other languages have similar capability, e.g. the BigDecimal class in Java.

5Visit the homepage at http://www.sagemath.org for more details.

Complex Numbers • Section 6.3

139

6.3 Complex Numbers

There is no real number x such that x 2 = −1. However, it turns out to be useful6 to invent

such a number, called the imaginary unit and denoted by the letter i. Thus, i 2 = −1, and

hence i = −1. If a and b are real numbers, then a number of the form a + bi is called a

complex number, and if b = 0 then it is called an imaginary number (and p