Lesson goal: The famous sine and cosine identity

Previous: Plot a sine wave | Home | Next: Test the sin/cos identity graphically

In the last lesson, you saw the computer display values for sin and cos. The results are always some long decimal number between -1 and 1. Strange huh? Here's a neat trigonometric identity you may have seen before. If you square the result of a sin and add it to the square of a cos, you'll always get the same number. Do you know what this number is? Try out this code and see. (Hint: This is an example of the famous identity $\sin(x)^2+\cos(x)^2=1$.

Now you try. Write some code to compute the $\sin^2(some-number)+\cos^2(some-number)$. See what you always get.

Type your code here:

See your results here:

Show a friend, family member, or teacher what you've done!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.