# Generating Pythagorean Triples using a Formula

You can generate a Pythagorean Triple using a formula. The proof of why the following formula works all the time is beyond the scope of this lesson. For our purposes, let us call this the “Pythagorean Triple Formula”.

Just a bit of caution, this formula can generate either a Primitive Pythagorean Triple or Imprimitive Pythagorean Triple. Remember that the former is a Pythagorean Triple where the Greatest Common Factor is equal to $1$, while the latter has a GCF of greater than $1$.

## The Pythagorean Triple Formula

A few observations about the formula:

• The variables $m$ and $n$ are any positive integers. However, positive integer $m$ is greater than positive integer $n$, that is, $m > n$.
• We both use the values of $m$ and $n$ to calculate the lengths of the sides of right triangle ABC which are composed of the two legs $a$ and $b$, and the longest side also known as the hypotenuse, represented by letter $c$.
• The value or length of side $a$ is calculated by finding the difference of the squares of $m$ and $n$. We can express it in the form of the equation as $a = {m^2} - {n^2}$.
• The length of side $b$ is calculated by doubling the product of $m$ and $n$. In the equation form, we have $b = 2mn$.
• Finally, the length of side $c$ is computed by getting the sum of the squares of $m$ and $n$. This can simply be written in the equation as $c = {n^2} + {m^2}$.

## Examples of Generating Pythagorean Triples

Example 1: Generate a Pythagorean Triple using the two integers $1$ and $2$.

First, observe that it is possible to generate a Pythagorean Triple with integers $1$ and $2$ because both are positive integers and one is larger than the other. We will let $m$ be equal to $2$ while $n$ be equal to $1$ because $m$ should be greater than $n$ based on the conditions above.

Since we now know what the values of m and n, it’s time to substitute those values into the formulas of $a$, $b$, and $c$ to obtain the sides of the right triangle.

• Solving for $a$:
• Solving for $b$:
• Solving for $c$:

Let’s check if our values for $a=3$, $b=4$, and $c=5$ satisfy the Pythagorean Triple Equation which is ${a^2} + {b^2} = {c^2}$

Yes it does! Therefore, (3,4,5) is a Pythagorean Triple.

Example 2: Use the integers 3 and 5 to generate a Pythagorean Triple. Is the generated triple a Primitive or Imprimitive Pythagorean Triple?

The problem above requires us to do two things. First, generate a Pythagorean Triple using the integers $3$ and $5$. Second, we need to figure out if the generated triple is Primitive or Imprimitive.

Check out my lesson on how to tell if a Pythagorean Triple is Primitive or Imprimitive.

First part:

Since $5$ is greater than $3$, we have $m=5$ and $n=3$. Solving for $a$, $b$, and $c$, we have:

$a = {m^2} - {n^2}$
$a = {(5)^2} - {(3)^2}$
$a = 25 - 9$
$a = 16$

$b = 2mn$
$b = 2\left( 5 \right)\left( 3 \right)$
$b = 30$

$c = {n^2} + {m^2}$
$c = {\left( 3 \right)^2} + {\left( 5 \right)^2}$
$c = 9 + 25$
$c = 34$

Upon checking with the required formula, we verify that indeed (16, 30, 34) is a Pythagorean Triple.

Second part:

Now, we want to know if our generated Pythagorean Triple is primitive or imprimitive.

Remember that a Pythagorean Triple is primitive if all three integers have a common factor of ONLY 1.

Otherwise, it is not primitive (imprimitive) since it has a common factor OTHER THAN 1.

By quick inspection, the Pythagorean Triple, (16, 30, 34), contains all even numbers. That means it has a factor other than $1$ because all integers are divisible by $2$. In other words, the triplet in question has more than $1$ common factors. Therefore, (16, 30, 34) is an Imprimitive Pythagorean Triple.

Example 3: What is the Pythagorean Triple generated by the integers 3 and 10 ? Is the generated triplet primitive or non-primitive?

Since $10 > 3$ then $m = 10$ and $n = 3$ because integer $m$ must be larger than integer $n$ .

At this point, you should already familiar with the formula. Let’s solve for $a$, $b$, and $c$ then.

• Computing for $a$ :
• Solving for $b$ :
• Calculating for $c$ :

Verifying the values of $a$, $b$, and $c$ with the Pythagorean Triple equation which is

$$\left( {a,b,c} \right)$$ $${a^2} + {b^2} = {c^2}$$

we have,

$$\left( {91,60,109} \right)$$ $${91^2} + {60^2} = {109^2}$$ $${91^2} + {60^2} = {109^2}$$ $${8,281} + {3,600} = {11,881}$$ $${11,881} = {11,881}$$

Yes! It checks. It means that $\left( {91,60,109} \right)$ is indeed a Pythagorean Triple.

By quick inspection, we can tell that the integers 90, 60, and 109 have a Greatest Common Divisor of 1 which makes it a Primitive Pythagorean Triple.