Diophantine equations problem/exercise 3 Find all the pythagorean tripples (x,y,z) with x=40. Well I started with the known formulas for the pythagorean tripples but got me nowhere. Or I was not able continue the thought process required. I do not have a lot of experience on Diophantine equations so I'm asking for a little bit detail help.Thank you.

The formula
$$
2mn, m^2 - n^2, m^2 + n^2
$$
where $m, n$ are relatively prime and of diferent parity,
and $m > n > 0$,
generates all primitive triples.
Thus, to get a triple including $x = 40$, we must solve for when
$2mn \; \mid 40$ or $m^2 - n^2 \; \mid \; 40$.

Case 1: $\boldsymbol{2mn \; \mid 40}$, i.e. $mn \; \mid \; 20$.
Since $m,n$ are relatively prime and not both odd and $m > n$, there are not too many cases
to consider.
$$
\begin{array}{|c|c|c|c|c|c|}
\hline
m & n & 2mn & m^2 - n^2 & m^2 + n^2 & \text{Triple} \\
\hline
20 & 1 & 40 & 399 & 401 & (40, 399, 401) \\
10 & 1 & 20 &  99 & 101 & (40, 198, 202) \\
5  & 2 & 20 &  21 &  29 & (40,  42,  58) \\
5  & 4 & 40 &   9 &  41 & (40,   9,  41) \\
4  & 1 &  8 &  15 &  17 & (40,  75,  85) \\
2  & 1 &  4 &   3 &   5 & (40,  30,  50) \\
\hline
\end{array}
$$

Case 2: $\boldsymbol{m^2 - n^2 \; \mid \; 40}$
Here we factor $(m+n)(m-n) \; | \; 40$.
But since $m+n$ and $m-n$ are odd (since $m,n$ are different parity),
we must have $(m+n)(m-n) \; | \; 5$.
Thus there is just once case, $m = 3$ and $n = 2$.
\begin{array}{|c|c|c|c|c|c|c|c|}
\hline
m+n & m-n & m & n & 2mn & m^2 - n^2 & m^2 + n^2 & \text{Triple} \\
\hline
5 & 1 & 3 & 2 & 12 & 5 & 13 & (96, 40, 104) \\
\hline
\end{array}

In summary, all the triples are
$$
\begin{array}{|c|c|c|}
\hline
x & y & z \\
\hline
40 &   9 &  41 \\
40 &  30 &  50 \\
40 &  42 &  58 \\
40 &  75 &  85 \\
40 &  96 & 104 \\
40 & 198 & 202 \\
40 & 399 & 401 \\
\hline
\end{array}
$$
A quick search on the internet finds a couple 
of sites
which show we didn't miss any.
