Chapter 6 - Technology Extension II

Generating Pythagorean Triples

The keystrokes shown apply to a TI-84 Plus model. Please consult our internet site or your manual for other models.

The Pythagorean Theorem a2 + b2 = c2 is one of the oldest and most proved theorems in mathematics, and its applications are likewise numerous. Many of the trigonometric concepts introduced in Chapter 1 employed what is called a Pythagorean Triple, or a collection of three integers that satisfy the theorem. The smallest and most easily recognized is (3, 4, 5) where 32 + 42 = 52, but there are infinitely many of them. However, only around 30 triplets exist with a hypotenuse of less than 100.

This program is designed to generate Pythagorean Triples for use in your studies, using any two “seed numbers” which are relatively prime (have no common divisor other than 1). For this first technology extension, all programming lines are given and discussed, to introduce you to a calculator’s ability to run programs. As the Introduction to Programming indicates, most programs rely on only a handful of simple constructs, and the basic ideas can be learned in a short period of time. The programs written should be logical, sequential, inter-active (fun) and adhere to the Basic Principles for Good Programming seen in Appendix VI. As your skills progress, sometimes a line of programming code will be given and you will be asked to discuss the output. Other times the result of a line of

programming code will be given, and you will be asked to supply the code.

PROGRAM:PYTHTRIP

:ClrHomeClears the home screen prior to initiating program

:Disp “_ THIS PRGM WILL”Displays one blank space and THIS PRGM WILL

:Disp “_ GENERATE THREE”Displays one blank space and GENERATE THREE

:Disp “_ _ NUMBERS THAT”Displays two blank spaces and NUMBERS THAT

:Disp “_ _ SATISFY THE”Displays two blank spaces and SATISFY THE

:Disp “PYTHAGOREAN THM”Displays PYTHAGOREAN THM

:Pause:ClrHomePauses (waits for user to press ) then clears screen

:Disp “_ _ _ _ THE PRGM”Displays four blank spaces and THE PRGM

:Disp “_ _ REQUIRES TWO”Displays two blank spaces and REQUIRES TWO

:Disp “_ _ SEED NUMBERS”Displays two blank spaces and SEED NUMBERS

:Disp “_ _ _ _ _ A AND B”Displays five blank spaces and A AND B

:Disp “”Displays a blank line (for formatting purposes)

:Prompt A, BPrompts user to enter two seed numbers A and B

:ClrHomeClears the screen

:abs(A2 – B2)  Pcalculates the absolute value of A2 – B2 and stores result in P

:2AB  Qcalculates 2 · A · B and stores the result in location Q

:(A2 + B2)  Rcalculates the absolute value of A2 + B2 and stores result in r

:Disp “_ _ FOR THE SEED”Displays two blank spaces and FOR THE SEED

:Disp “_ _ NUMBERS YOU”Displays two blank spaces and NUMBERS YOU

:Disp “INPUT, THE THREE”Displays INPUT, THE THREE

:Disp “_ _ _ VALUES ARE”Displays three blank spaces and VALUES ARE

:Pause:ClrHomePauses (waits for user to press ) then clears screen

:Disp “”:Disp “”Displays two blank lines (for formatting purposes)

:Disp P, Q, RDisplays the stored values of P, Q and R (the Triple)

Exercise 1:Determine the output for the following pairs:

A = 1 and B = 2A = 1 and B = 3A = 1 and B = 4A = 1 and B = 5

What pattern do you notice in the outputs?

Exercise 2:Determine the output for the following pairs:

A = 2 and B = 3A = 2 and B = 4A = 2 and B = 5A = 2 and B = 6

What pattern do you notice in the outputs? Why do A = 2, B = 4 and A = 2, B = 6 produce Pythagorean Triples with a common factor, while A = 2, B = 3 and A = 2, B = 5 do not? Check your response by producing additional triples.

Exercise 3:Determine the output for the following pairs:

A = 3 and B = 4A = 3 and B = 8A = 3 and B = 5A = 3 and B = 7

What pattern do you notice in the outputs? Why do A = 3, B = 5 and A = 3, B = 7 produce Pythagorean Triples with a common factor, while A = 3, B = 4 and A = 3, B = 8 do not? Check your response by producing additional triples.

Exercise 4:What are we assuming about A and B when we use this program? Hint: Try A = 3 and B = -7.