Solutions for Euclid's formula concerning a prime leg In completing questions regarding primitive pythagorean triples and solving for the values $u, v$ in Euclid's formula, $$u^2-v^2, 2uv, u^2+v^2$$ I noticed that when the first of the triple, i.e. $u^2-v^2$, is prime, the solution of $u$ and $v$ is seemingly trivial.
For example, take the prime 89, divide by 2, resulting in $44$ remainder 1. Now you have a "bigger half" of $45$ and a "smaller half" of $44$. Simply input these values as $u$ and $v$ (where $u > v$). Voila, you have a pythagorean triple. I've only tested this so many times on different primes, even seeing it work on composites.
What I don't understand is the (potentially very obvious and very simple explanation) as to why this works. I'm not sure what to google, or at least my attempts have failed spectacularly, but I'm assuming this is a known property (?). Or at least it's just completely false and I got lucky in some tests.
Thanks all the same for any explanations.
 A: Addendum added to respond to the comment question of anticontradictory.

Take any odd number, prime or composite, of form $(2n + 1).$
Set $u = n+1, v = n.$
Then

*

*$u^2 - v^2 = 2n+1.$


*$2uv = 2n^2 + 2n.$


*$u^2 + v^2 = 2n^2 + 2n + 1.$
Then
$$(u^2 - v^2)^2 + (2uv)^2$$
$$= (4n^2 + 4n + 1) + (4n^4 + 8n^3 + 4n^2)$$
$$= (4n^4 + 8n^3 + 8n^2 + 4n + 1)$$
$$= (2n^2 + 2n + 1)^2 = (u^2 + v^2)^2.$$

Addendum
Responding to the comment question of anticontradictory

I noticed that when the first of the triple, i.e. $u^2-v^2$, is prime, the solution of $u$ and $v$ is seemingly trivial.


I'm confused as to why you have squared the two terms and added them. It then following I don't understand your conclusion. What is the significance of $(u2+v2)^2$?

Your posting indicated (in effect) that when $(u^2 - v^2)$ was (an odd) prime, that you could then construct a right triangle, with each side having an integer length, and (in effect) with the sides given by
$$(u^2 - v^2), (2uv), (u^2 + v^2).$$
In particular, you indicated that a trivial solution for $u,v$ was given by
$$u = (n+1), ~v = (n), ~: ~~\text{the prime equals}~~ (2n+1).$$
The whole point of my answer, up to the Addendum, was to demonstrate that while your assertion is accurate, the fact that $(2n+1)$ is prime is totally irrelevant.
The method that I chose to demonstrate this was to assume that $(2n+1)$ was any odd number.  I then demonstrated that the trivial solution of
$$u = (n+1), ~v = (n)$$
still applied.  In order to demonstrate this, I explicitly calculated the three side lengths of the triangle in terms of $n$.
Then, I algebraically demonstrated that the sum of the squares of the two legs did in fact equal the square of the longer side.  This algebraic demonstration verified  that the three sides did in fact represent a right triangle, with integer sides.
This is why I expressed  $~(u^2 - v^2)~$ and $~(2uv)~$ in terms of $~n$, 
squared them, and then showed that the sum equaled 
$(u^2 + v^2)^2 ~$ (also expressed in terms of $~n$).
A: 
… even seeing it work on composites.

I assume that all (or atleast most) of the composite numbers you’ve experimented with have been odd numbers. I will come to that in a while.
We know that a prime number has only two divisors, 1 and itself. This means that if we have two distinct positive factors multiplying to give a prime $p$ then IT MUST SO HAPPEN that one of the factors is $1$ and the other is $p$.
Let us have $u^2-v^2=p$ where $p$ is an odd prime (The case $p=2$ can be dealt separately). Then, $$(u-v)(u+v)=p$$ so that one of the factors is equal to $1$. But $u-v$ is smaller than $u+v$ so we have $$u-v=1,$$$$u+v=p$$ which on solving gives us $\ \displaystyle u=\frac{p+1}{2}, \ v=\frac{p-1}{2}$. As you can notice, these are very close to $\dfrac p2$.
Now to why I made my initial comment: If you notice, then composite numbers, say $s$, can also be written as $s\cdot1$ and the previous calculation redone. But then, $s\pm1$ would have to be divisible by $2$ for the two numbers to be integers; this implies that $s$ must be odd to get integer solutions with the method you’ve described.
A: Think difference of two squares:
$45^2-44^2=(45+44)(45-44)=89\cdot 1=89$, giving you your leg of $89$. Same idea would work for getting any odd leg, prime or not.
A: Suppose $a^2+b^2=c^2$ where $a$ is an odd prime (no Pythagorean triple can have $2$ among the terms). Then
$$
a^2=(c-b)(c+b)
$$
Since $a$ is prime, we have very few possibilities, namely

*

*$c-b=1$ and $c+b=a^2$, or

*$c-b=a$ and $c+b=a$.

In the second case we have $2c=2a$, so $c=a$ and $b=0$: not a Pythagorean triple case.
In the first case $c=b+1$ and so $a^2=2b+1$. Take any odd integer $a$ and write $a^2=2b+1$; then we obtain a Pythagorean triple with $c=b+1$, because
$$
a^2+b^2=b^2+2b+1=(b+1)^2=c^2
$$
so this isn't a very special case: whether $a$ is prime or not is irrelevant.
Is there something special when $a$ is an odd prime? We need to know about the representation of primitive Pythagorean triples, namely that there are $u,v$ such that $a=u^2-v^2$, $b=2uv$ and $c=u^2+v^2$.
If $a$ is prime then from $a=(u-v)(u+v)$ we derive $u-v=1$ and so $a=2v+1$. Hence $b=2v(v+1)=2v^2+2v$ and so
$$
a^2=4v^2+4v+1=2b+1
$$
No, nothing really special, if not for the fact that
$$
u=\frac{a+1}{2},\qquad v=\frac{a-1}{2}
$$
so we can write
$$
b=\frac{a^2-1}{2},\quad c=\frac{a^2+1}{2}
$$
OK, let's try with any odd integer $a$:
$$
a^2+\Bigl(\frac{a^2-1}{2}\Bigr)^2=\frac{4a^2+a^4-2a^2+1}{4}=\frac{(a^2+1)^2}{4}=\Bigl(\frac{a^2+1}{2}\Bigr)^2
$$
No, nothing really special again.
