The pythagorean theorem works in the third dimension as well. In other words, the diagonal of a rectangular prism equals the square root of the sum of the squares of the sides.
Less wordy: d2 = x2 + y2 + z2

I said that this works in the third dimension, but it isn't limited to it. I have little doubt It works in the fourth, fifth, sixth, etc. dimensions, but I can't verify it, because it's hard for me to visualize even the fourth dimension! I'm sure the theorem can be proven, or probably has been proven, for all dimensions, but that is beyond my knowledge right now.

The diagonal of a rectangular prism is a line that connects any two corners which do not share a face. It goes through and across the inside of the prism, not along a side.