Previous Section  < Day Day Up >  Next Section

Trigonometric Identities

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 x2+y2=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:

sina = y/1 = y and cosa = x/1 = x

so y = sina

and x = cosa

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 = sina and x = cosa, 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

cos2a + sin2a = 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

sina = opp/hyp and cosa = adj/hyp

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

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) = –sina

cos(–a) = cosa

tan(–a) = –tana


Example 3.12: Verifying One of the Negative Angle Identities

Using a = 30°, verify that sin(–a) = –sina.

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(a1 + a2) = sina1cosa2 + cosa1sina2

sin(a1 – a2) = sina1cosa2 – cosa1sina2


Example 3.13: sin(90°+a)

Simplify sin(90°+a).

Solution
  1. Apply the new sum identity for sine:

    sin(a1 + a2) = sina1cosa2 + cosa1sina2

    sin(90° + a) = sin90°cosa + cos90°sina

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

    sin(90° + a) = (1)cosa + (0)sina

    sin(90° + a) = cosa

Example 3.14: sin(180°–a)

Simplify sin(180°–a).

Solution
  1. Apply the new difference identity for sine:

    sin(a1 – a2) = sina1cosa2 – cosa1sina2

    sin(180° – a) = sin180°cosa – cos180°sina

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

    sin(180° – a) = (0)cosa – (–1)sina

    sin(180° – a) = sina

The cosine has very similar sum and difference identities.

Sum and Difference Identities for Cosine

cos(a1 + a2) = cosa1cosa2 – sina1sina2

cos(a1 – a2) = cosa1cosa2 + sina1sina2


Example 3.15: cos(180°+a)

Simplify cos(180°+a).

Solution
  1. Apply the new sum identity for cosine:

    cos(a1 + a2) = cosa1cosa2 – sina1sina2

    cos(180° + a) = cos180°cosa – sin180°sina

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

    cos(180°+a) = (–1)cosa – (0)sina

    cos(180°+a) = –cosa

Example 3.16: cos(90°–a)

Simplify cos(90°–a).

Solution
  1. Apply the new difference identity for cosine:

    cos(a1 – a2) = cosa1cosa2 + sina1sina2

    cos(90° – a) = cos90°cosa + sin90°sina

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

    cos(90° – a) = (0)cosa + (1)sina

    cos(180° + a) = sina

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(2a) using the sum identity.

5.

Find cos(2a).

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°)?


    Previous Section  < Day Day Up >  Next Section