$\require{AMSsymbols}$You probably recall the Pythagorean Theorem from geometry, that revealed the relationship between the lengths of the sides ($a$ and $b$) and that of the hypotenuse ($c$) of a right triangle was $a^2+b^2=c^2$. Sometimes, these triplets were "nice", in the sense that all three values were integers. Such triplets are called Pythagorean triples. (3,4,5) is probably the most easily recognized, but there are others. For example, (5,12,13) and (28,45,53) both satisfy this relationship.
An interesting question we might ask is "How do we generate pythagorean triples"?
If we know one pythagorean triple, there of course is a trivial way to produce more -- multiply every number by the same constant. In this way we can turn (3,4,5) into (6,8,10), (9,12,15), or (12,16,20), and so on...
Indeed, if $a^2 + b^2 = c^2$, we can quickly verify, in general that $$(ad)^2 + (bd)^2 = (a^2 + b^2) d^2 = c^2d^2 = (cd)^2$$ But this process does not yield all pythagorean triples. For example, (28,45,53) can't be constructed in this way, as no two numbers in this triplet share any common positive divisors (other than 1). Pythagorean triplets with this property that the greatest common divisor of any two of the numbers is 1 are called primitive Pythagorean triplets.
Here is a list of some of these primitive triplets:
Focusing our attention on how to generate these primitive triplets, we might notice a couple of properties they all seem to have in common. First, $a$ and $b$ are never both even (which should be obvious as otherwise, $gcd(a,b) \neq 1$), but they also never seem to be both odd. This last observation can be proven quickly, however.
Proof: Let us argue indirectly. Assume that $a$ and $b$ were both odd.
Then we can find integers $k_1$ and $k_2$ so that $a=2k_1+1$ and $b=2k_2+1$. Further, $c^2$ (and hence $c$) must be even, since it is the sum of the squares of two odd numbers. So we can find some integer $k_3$ so that $c=2k_3$. But then $$\begin{array}{lrl} & a^2 + b^2 & = c^2\\ \Rightarrow & (2k_1+1)^2 + (2k_2+1)^2 & = (2k_3)^2\\ \Rightarrow & 4k_1^2 + 4k_1 + 1 + 4k_2^2 + 4k_2 + 1 & = 4k_3^2\\ \Rightarrow & 4(k_1^2 + k_1 + k_2^2 + k_2) + 2 & = 4(k_3^2) \end{array}$$ This, of course, is a contradiction as the left side leaves a remainder of 2 upon division by 4, while the right side is a multiple of 4 (with remainder 0). Thus $a$ and $b$ can not both be odd. $\blacksquare$
Without loss of generality, then, we can require $a$ to be odd and $b$ to be even.
This affords us the ability to glean other interesting things from our list of triplets as well -- especially when we consider that $a^2+b^2=c^2$ implies
$$a^2=c^2-b^2=(c+b)(c-b)$$Looking at the values of $(c+b)$ and $(c-b)$ shown below for even the small set of triplets offered above, one might conjecture that they must always be perfect squares that share no common positive factors other than 1.
(By the way, as a matter of vocabulary, when two numbers share no common positive factors other than 1, we say these numbers are relatively prime to one another.)
Note, proving that $(c+b)$ and $(c-b)$ are relatively prime reveals they must each be a perfect square almost immediately when one considers their product must be a perfect square (i.e., $a^2$).
We may argue indirectly. Suppose there was some $d \neq 1$ with $d \mid (c+b)$ and $d \mid (c-b)$. Then $d$ must divide the sum and/or difference of $(c+b)$ and $(c-b)$. Hence, $d \mid 2c$ and $d \mid 2b$. Recall, if $(a,b,c)$ is a primitive Pythagorean triple, $b$ and $c$ share no factors. Thus, $d \mid 2$. This means either $d=1$ or $d=2$. But the latter case is impossible, as we must also have $d \mid (c+b)(c-b) = a^2$, with $a^2$ being an odd number (as $a$ was chosen to be odd). Hence, $d=1$, but this contradicts our earlier assumption! So $(c+b)$ and $(c-b)$ are indeed relatively prime, which as we said before requires they both be perfect squares.
So we can find integers $s$ and $t$ that are relatively prime where $$(c+b)=s^2 \hspace{10pt} \textrm{ and } \hspace{10pt} (c-b)=t^2$$ Note, it must be the case that $s\gt t$. Adding these two equations and solving for $c$ then yields $$c=\frac{s^2+t^2}{2}$$ Similarly, subtracting these equations and solving for $b$, we have $$b=\frac{s^2-t^2}{2}$$ Of course, we also know that $a^2=(c+b)(c-b)=s^2 t^2$, so $$a=st$$ Notice, since $a$ is odd, both $s$ and $t$ must be odd.
Amazingly, these conditions are sufficient to generate a primitive Pythagorean triple! Suppose we pick any 2 odd, relatively prime values for $s$ and $t$, where $s\gt t$. Then if $$a=st, \hspace{15pt} b=\frac{s^2-t^2}{2}, \hspace{5pt} \textrm{ and } \hspace{5pt} c=\frac{s^2+t^2}{2}$$ we have $$\begin{array}{ll} a^2 + b^2 &= s^2 t^2 + \left( \dfrac{s^2-t^2}{2} \right)^2\\\\ &= \dfrac{4s^2t^2 + s^4 - 2s^2t^2 +t^4}{4}\\\\ &= \dfrac{s^4 + 2s^2t^2 +t^4}{4}\\\\ &= \left( \dfrac{s^2+t^2}{2} \right)^2\\\\ &= c^2\\\\ \end{array}$$ As such, we have found a necessary and sufficient condition for the form of any and every primitive Pythagorean triple that exists! (Pretty cool, isn't it!)