Trigonometric Identities

 < Day Day Up > 

Now that we've defined the six trigonometric functions, several trig identities (or rules) allow you to algebraically manipulate equations that have the trig functions embedded in them. You never know when these identities might prove useful. Remember that when you're programming, every operation takes additional processing time, so always try to reduce formulas to their simplest terms. Of course, this might involve one or more of these identities.

The first identity is the unit circle , which is the circle centered at the origin with a radius of 1. The equation for the unit circle is x 2 + y 2 =1. For any point on the unit circle, you can create a right triangle with one angle in standard position, as shown in Figure 3.15.

Figure 3.15. The unit circle.

graphics/03fig15.gif

Notice that the hypotenuse is the radius, which has a length of 1 unit. Now you can apply the definitions of sine and cosine:

sin a = y /1 = y and cos a = x /1 = x

so y = sin a

and x = cos a

This is true for any point on the unit circle.

NOTE

This is a great trick for remembering the sine and cosine of multiples of 90. At 90, 180, 270, and 360, the unit circle intersects the axes, so it's very easy to pick off the x and y coordinates, which give you sine and cosine. For example, at 90, the unit circle has coordinates (0,1). Therefore, sin90=1 and cos90=0.


Now that you know y = sin a and x = cos a , you can substitute sine and cosine into the equation of the unit circle for x and y . This gives you your first trig identity.

Unit Circle Identity

cos 2 a + sin 2 a = 1


There's also a very interesting relationship among tangent, sine, and cosine. If you look back at the definitions of the first three trigonometric functions, you'll see that

sin a = opp/hyp and cos a = adj/hyp

This means that, graphics/03inl07.gif which is the definition of tan a .

This leads to the next two identities.

Tangent and Cotangent

graphics/03equ10.gif



There are also a couple interesting negative angle identities. Try plugging a couple angles into your calculator to verify that they're true.

Negative Angles

sin( a ) = sin a

cos( a ) = cos a

tan( a ) = tan a


Example 3.12: Verifying One of the Negative Angle Identities

Using a = 30, verify that sin( a ) = sin a .

Solution
  1. Find sin(30) using a calculator. You should find that sin(30) = 0.5.

  2. Find sin(30) using a calculator. You should find that sin(30) = 0.5, so sin(30) = 0.5.

    In this case, the identity holds true.

Next let's look at the sum and difference identities for sine.

Sum and Difference Identities for Sine

sin( a 1 + a 2 ) = sin a 1 cos a 2 + cos a 1 sin a 2

sin( a 1 a 2 ) = sin a 1 cos a 2 cos a 1 sin a 2


Example 3.13: sin(90+ a )

Simplify sin(90+ a ).

Solution
  1. Apply the new sum identity for sine:

    sin( a 1 + a 2 ) = sin a 1 cos a 2 + cos a 1 sin a 2

    sin(90 + a ) = sin90cos a + cos90sin a

  2. Reduce it by taking the sine and cosine of 90:

    sin(90 + a ) = (1)cos a + (0)sin a

    sin(90 + a ) = cos a

Example 3.14: sin(180 a )

Simplify sin(180 a ).

Solution
  1. Apply the new difference identity for sine:

    sin( a 1 a 2 ) = sin a 1 cos a 2 cos a 1 sin a 2

    sin(180 a ) = sin180cos a cos180sin a

  2. Reduce it by taking the sine and cosine of 180:

    sin(180 a ) = (0)cos a (1)sin a

    sin(180 a ) = sin a

The cosine has very similar sum and difference identities.

Sum and Difference Identities for Cosine

cos( a 1 + a 2 ) = cos a 1 cos a 2 sin a 1 sin a 2

cos( a 1 a 2 ) = cos a 1 cos a 2 + sin a 1 sin a 2


Example 3.15: cos(180+ a )

Simplify cos(180+ a ).

Solution
  1. Apply the new sum identity for cosine:

    cos( a 1 + a 2 ) = cos a 1 cos a 2 sin a 1 sin a 2

    cos(180 + a ) = cos180cos a sin180sin a

  2. Reduce it by taking the sine and cosine of 180:

    cos(180+ a ) = (1)cos a (0)sin a

    cos(180+ a ) = cos a

Example 3.16: cos(90 a )

Simplify cos(90 a ).

Solution
  1. Apply the new difference identity for cosine:

    cos( a 1 a 2 ) = cos a 1 cos a 2 + sin a 1 sin a 2

    cos(90 a ) = cos90cos a + sin90sin a

  2. Reduce it by taking the sine and cosine of 90:

    cos(90 a ) = (0)cos a + (1)sin a

    cos(180 + a ) = sin a

This section contains quite a few trig identities, from the unit circle identity all the way through the sum and difference identities. As a programmer, you should know that the trigonometric functions are fairly expensive (they take more processing power than a simple multiply or add function), so your goal should always be to minimize the number of trig functions called in your code. The next section looks at the syntax for actually using these functions in C++.

Self-Assessment

1.

Using the unit circle, find sin(180) and cos(180).

2.

Using the values you found in question 1, verify that the unit circle identity is true for 180.

3.

Find tan(30) without using the tangent function on your calculator.

4.

Find sin(2 a ) using the sum identity.

5.

Find cos(2 a ).

6.

If you had to use a lookup table for sine values and you could store only values up through sin(90), how might you find sin(120)?


 < Day Day Up > 


Beginning Math and Physics for Game Programmers
Beginning Math and Physics for Game Programmers
ISBN: 0735713901
EAN: 2147483647
Year: 2004
Pages: 143
Authors: Wendy Stahler

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net