A rectangular box has dimensions 12 by 16 by 21. Find the length of the diagonal connecting a pair of opposite corners.
Drawing a rough sketch of the problem would help a lot. You would find the diagonal, which is in 3-D, can form the hypotenuse of a right triangle with the base being the diagonal of one side of the box and the height simply being the height of the box. Hence, MathStud28's Pythagoras in 3D.
An illustration found randomly searching (so ignore the numbers):
Bold blue line can be found by Pythagoras using the bottom side. The 3D diagonal can be found using the bold blue line and the height as mentioned earlier.
At your level it is probably best to do it in two steps.
First, let's assume the base of the box is 12 by 16. Using basic Pythagoras, we know that the diagonal of the base is:
Now, the height of this box must be 21. To find the distance from one corner of the base to the diagonal corner on the top, we simply use the distance formula again: