3-dimensional pipe bending
Pipe A is to be joined to pipe B. They run at right angles to each other but in different planes. A 135° coupling will be used on pipe B, so the problem is to bend pipe A to meet it at the correct angle.
Imagine a rectangular box linking the pipes so that the pipes are in line with edges of the box, and the coupling section between the pipes joins opposite corners of the box:
We know how far apart the pipes are (dimensions y and z) but dimension x is unknown.
Now imagine the plane through the box from the edge which lines up with pipe B to the opposite edge. This plane cuts the sides of the box into triangles. We know the dimensions y and z of the triangle so by theorem know the hypotenuse is sqrt(y^2+z^2).
The plane intersects the box to make a rectangle (shown in red) and since the 135° coupling to pipe B lies in this plane it cuts the red rectangle to make an  triangle, so the sides marked (with two red ticks) are equal. Therefore the length of the hypotenuse (above) is equal to dimension x.
Lastly imagine the plane through the box from the edge which lines up with pipe A, to the opposite edge. This plane cuts the sides of the box into triangles with sides x and z from which we can calculate the hypotenuse, and makes the rectangle shown in red with sides y and sqrt(x^2 + z^2). Substituting for x gives
sqrt(y^2 + z^2 + z^2)
= sqrt(y^2 + 2*z^2).
Folding or cutting a piece of paper or card to dimensions in the ratio of these two values gives a template for bending pipe A.
Here's one we made earlier...