Theodore S. Norvell, 2014

Start with any triangle. Call the lengths of the sides *a*, *b*, and *c*.
Here I happened to pick the longest side as *c*, but any side can be *c*.

Now construct two triangles similar to the *a*, *b*, *c* triangle with corresponding sides of
lengths
*a'*, *b'*, and *a* for the first and *a''*, *b''*, and *b*
for the second.

Arrange (by rotation, reflection, and translation) the three triangles to make two sides of a rectangle that is *c* by *a'* + *b''*.

Claim: The area of the rectangle is *a*^{2} + *b*^{2}.

As the green triangle is similar to the blue one, *a*/*c* = *a'*/*a*,
and so *a*^{2} = *a'c*.

As the red triangle is similar to the blue one, *b*/*c* = *b''*/*b*,
and so *b*^{2} = *b''c*.

Adding these two equations, we get *a*^{2} + *b*^{2} = *a'c* + *b''c*,
and, after factoring out *c*,
we have *a*^{2} + *b*^{2} = (*a' + b''*)*c*.

In the special case that angle γ is 90°, the red and the green triangles can be arranged (i.e. rotated,translated,
and reflected), so that their union makes a triangle congruent to the blue triangle
So, in this case, *a' + b''* = *c*,
and so *a*^{2} + *b*^{2} = *c*^{2}.

To see that the red and the green triangles can be arranged so their union is congruent to the blue triangle,
first we note that *a''* = *b'*.
This is true regardless of whether γ is right.
Proof: By similar triangles *b*/*a* = *b'*/*a'*
and *a''*/*b* = *a'*/*a*.
From the first, we get *b'* = *a'b*/*a*.
From the second, *a''* = *a'b*/*a*. And so *b'* = *a''*.

Thus we can arrange the green and red triangles so that the sides of
length *b'* and *a''* coincide, and such that the two right angles are together.
We now have a triangle with sides of length *a* and *b*, and angles α and β,
same as the blue triangle. Hence this triangle is congruent to the original (blue)
triangle.

It turns out that this had been discovered by Thābit ibn Qurra (836-901). See proof #18 at Cut the Knot and the Wikipedia.

The dissection of a right triangle to make two similar triangles was described by Bhāskara II in the twelfth century C.E. in his Bijaganita.

Edsger Dijkstra generalized Bhāskara's construction to an arbitrary triangle, and used it to show that
signum( *a*^{2} + *b*^{2} - *c*^{2} )
= signum( α + β - γ ), where the signum function yields +1 for a positive number, 0 for 0 and -1
for a negative number.
Dijkstra's construction
produces two triangles from the original with the same proportions as those in the construction
above.