Examples for Practice Problem #5


Generating Pythagorean Triples. Given the following relationships, where p > q.

\[\begin{array}{c} \eqalign{ & {a^2} + {b^2} = {c^2} \cr & a = 2pq \cr & b = {p^2} – {q^2} \cr & c = {p^2} + {q^2} \cr} \end{array}\]


Letting p=2 and q=1, p > q.

\[\begin{array}{c} \eqalign{ & p = 2 \cr & q = 1 \cr & \cr & a = 2\left( 2 \right)\left( 1 \right) = 4 \cr & b = {\left( 2 \right)^2} – {\left( 1 \right)^2} = 3 \cr & c = {\left( 2 \right)^2} + {\left( 1 \right)^2} = 5 \cr & \cr & \left\{ {3,4,5} \right\} \cr & \cr & {3^2} + {4^2} = {5^2} \cr} \end{array}\]


Letting p=3 and q=2, p > q.

\[\begin{array}{c} \eqalign{ & p = 3 \cr & q = 2 \cr & \cr & a = 2\left( 3 \right)\left( 2 \right) = 12 \cr & b = {\left( 3 \right)^2} – {\left( 2 \right)^2} = 5 \cr & c = {\left( 3 \right)^2} + {\left( 2 \right)^2} = 13 \cr & \cr & \left\{ {5,12,13} \right\} \cr & \cr & {5^2} + {12^2} = {13^2} \cr} \end{array}\]