Given two pythagorean triples, generate another I don't know if this has been asked before, but I could not find any existing answer.
I noticed that for any pair of primitive pythagorean triples (not necessarily distinct), let's say:
a² + b² = c²
d² + e² = f²

Then there is at least another primitive triple where:
g² + h² = (cf)²

And there are 2 if the starting triples are distinct.
So, for example:
(3,4,5) and (5,12,13) -> (16, 63, 65) and (33, 56, 65)
(5,12,13) and (8,15,17) -> (21, 220, 221) and (140, 171, 221)
(3,4,5) (5,12,13) (8,15,17) -> (817,744,1105) (943,576,1105) (1073,264,1105) (1104,47,1105)
(3,4,5) and (3,4,5) -> (7,24,25)

I think there is an explanation for that, a property of pythagorean triples, or in general of diophantine equations.
Is it true in every case? Is there a way to calculate the two legs of the resulting triple(s)?
 A: Obviously $$c^2f^2=a^2d^2+a^2e^2+b^2d^2+b^2e^2.$$
Then by educated guess
$$a^2d^2+b^2d^2+a^2e^2+b^2e^2=a^2d^2\color{green}{+2adbe}+b^2e^2+b^2d^2\color{green}{-2bdae}+a^2e^2$$ and this is the sum of two squares. You can swap the signs.
A: You can always find new triplets this way, although they are not necessarily primitive. This is just the Brahmagupta–Fibonacci identity in action.
For example, for $(5,12,13)$ and $(8,15,17)$, the identity states that:
$$(5\cdot8 - 12\cdot15)^2 + (5 \cdot 15 + 12 \cdot 8)^2 = (-140)^2 + (171)^2$$
$$= (5\cdot8 + 12\cdot15)^2 + (5 \cdot 15 - 12 \cdot 8)^2 = (220)^2 + (-21)^2$$
$$= (5^2 + 12^2) (8^2 + 15^2) = 13^2 \cdot 17^2 = 221^2$$
When the starting triplets are the same, then $a=d, b=e$. Using the given identity, $(ad - be)^2 + (ae + bd)^2 = (a^2-b^2)^2 + (ab + ba)^2 = a^4+b^4-2a^2b^2+4a^2b^2$ $ = a^4 + b^4 + 2a^2b^2 = (a^2+b^2)^2 = (a^2+b^2)(d^2+e^2)$.
The other possibility is $(ad + be)^2 + (ae - bd)^2 = (a^2 + b^2)^2 + (ab - ba)^2 = (a^2 + b^2)^2$, where one of the numbers of the new triplet is $0$. This explains why there is only one non-trivial triplet in this case.
Here is a counterexample that they are not always primitive. With $(13,84,85)$ and $(16,63,65)$, $ad+be, ae-bd$ gives $(5500,525,5525)$ which are all divisible by $25$. A further conjecture could be made on if $c,f$ are both divisible by $k$, then whether the lowest common divisor would be $k^2$.
A: Given any pair of triples
\begin{align*}
A_1^2+B_1^2=C_1^2\\
A_2^2+B_2^2=C_2^2
\end{align*}
There are $\space 2^{n-1}\space$ other triples:
$\space A_3^2+B_3^2=(C_1\times C_2)^2=C_3^2\space$
where
$\space n\space$ is the number of distinct prime factors
$\space f\equiv 1 \pmod 4\space$ of
$\space C_3\space.\quad$
To find these, we begin with Euclid's formula
$\space A=m^2-k^2\quad B=2mk\quad C=m^2+k^2.\quad $
We solve the $\space C$-function for $\space k\space$ and test a defined range of $\space m$-values to see which yield integers.
$$C=m^2+k^2\implies k=\sqrt{C-m^2}\\
  \qquad\text{for}\qquad \bigg\lfloor\frac{ 1+\sqrt{2C-1}}{2}\bigg\rfloor \le m \le \big\lfloor\sqrt{C-1}\big\rfloor$$
The lower limit ensures $m>k$ and the upper limit ensures $k\in\mathbb{N}$.
Take the example
\begin{align*}
15^2+8^2=17^2\\
21^2+20^2=29^2
\end{align*}
$$C=17\cdot29=493\implies \\
\bigg\lfloor\frac{ 1+\sqrt{986-1}}{2}\bigg\rfloor=16
 \le m \le 
\big\lfloor\sqrt{493-1}\big\rfloor=22\quad \\
\text{and we find} \quad
 m\in\{18,22\}\implies k\in\{13,3\}\\$$
$$F(18,13)=(155,468,493)\qquad F(22,3)=(475,132,493)\quad $$
