A general equation for Pythagorean triples of rational numbers This question was asked by a friend of mine and I have no idea how to proceed. I am looking for a general solution for the equation $p^2+q^2=r^2$ where $p,q,r$ are rational numbers.
PS: I am not looking for such trivial solutions which can be constructed by Pythagorean triples, e.g., $\frac{6^2}{15^2}+\frac{8^2}{15^2}=\frac{2^2}{3^2}$
 A: There are no other rational solutions than those based on the Pythagorian triples.
If $$p^2 +q^2 =r^2,$$ or $$\left(\frac{P'}{P''}\right)^2+\left(\frac{Q'}{Q''}\right)^2=\left(\frac{R'}{R''}\right)^2,$$ multiplying by the common denominator gives an equation in integers $$\left(P'Q''R''\right)^2+\left(P''Q'R''\right)^2=\left(P''Q''R'\right)^2.$$
A: Theorem. If $p, q > 0$ are (rational) integers such that 
$$x := p^{2} - q^{2},$$
$$y := 2pq,$$
$$z := p^{2} + q^{2},$$
$$p+q \equiv 1\ \ (mod\ \ 2),$$
$$p > q,$$
$$(p, q) = 1,$$
then the triple 
$(x, y, z)$
is a solution of the Diophantine equation
$x^{2} + y^{2} = z^{2}.$
In other words, the triples $(x, y, z)$ so generated are primitive (in the sense that $(x, y, z) = 1$) solutions of the equation $x^{2} + y^{2} = z^{2}$.
Indeed, one can find this theorem or its equivalents in many elementary number theory texts. For instance, the famous number theory book of Hardy and Wright. 
A: In General formula generic for Pythagorean triples looks a little different.
$$x^2+y^2=az^2$$
If the number can be represented as a sum of squares.  $a=t^2+k^2$
The solution has the form:
$$x=-tp^2+2kps+ts^2$$
$$y=kp^2+2tps-ks^2$$
$$z=p^2+s^2$$
All numbers can be any character.
