Pythagoras in 3D – can I just add three squares?

I’m trying to get my head around how Pythagoras works in 3D, and I keep second-guessing myself. For a simple box, say 5 cm × 8 cm × 2 cm, I want the distance from one corner to the opposite corner through the inside. I did it in two steps: first the base diagonal is sqrt(5^2 + 8^2) = sqrt(89). Then I used that with the height: sqrt(89 + 2^2) = sqrt(93). That feels a bit weird though-like I’m taking a square root only to square it again. Is it actually okay to skip straight to sqrt(5^2 + 8^2 + 2^2)? Why does that work, or am I just getting lucky with the numbers?

I also tried the coordinates version. If I have A(1, 0, 2) and B(6, 4, 6), I used the distance formula: sqrt((6−1)^2 + (4−0)^2 + (6−2)^2). I think that’s right, but I’m struggling to see the actual right triangles in 3D that justify it. Like, where exactly are the right angles hiding? Is there a neat way to sketch the two-step triangles (first in a plane, then in 3D) so it doesn’t feel like magic? My mental picture goes a bit squinty here.

Follow-up: what if the path has to stick to the surfaces? For example, a string from one corner to the opposite corner but only allowed to run along the faces. I’ve seen people “unfold” the box and get something like sqrt((5 + 2)^2 + 8^2) depending on which faces you flatten. That gives a different number than the straight-through space diagonal. How do I know when I’m supposed to do the three-squares thing versus unfolding a net? And for points that aren’t opposite corners, is there a general rule for deciding whether I can use the add-three-squares trick, or do I need to project onto planes first? I’m probably overthinking this, but I’d love a sanity check!

3 Responses

  1. Yes-awesome question!-in a box the three directions are mutually perpendicular, so Pythagoras “stacks”: first combine two perpendicular legs to get a plane diagonal, then treat that as one leg with the third perpendicular leg, which algebraically is just sqrt(x^2 + y^2 + z^2) because you’re adding squared perpendicular components.

    Example: 5×8×2 gives d = sqrt(5^2 + 8^2 + 2^2) = sqrt(93) (same as sqrt((sqrt(5^2+8^2))^2 + 2^2)); for A(1,0,2) to B(6,4,6) you get sqrt(5^2+4^2+4^2) = sqrt(57); if you’re forced onto faces, unfold adjacent faces and use 2D Pythagoras (e.g., sqrt((5+2)^2+8^2)), which is a different, longer constrained path-use the three-squares formula only for the straight-line distance through space.

  2. Yup, you can absolutely jump straight to sqrt(5^2 + 8^2 + 2^2) for the space diagonal of the box. The two-step version is just Pythagoras twice in perpendicular directions: first across the floor to get sqrt(5^2 + 8^2), then up the wall with the 2. Since that floor-diagonal is in a horizontal plane and the 2 is vertical, they’re perpendicular, so (sqrt(5^2 + 8^2))^2 + 2^2 = 5^2 + 8^2 + 2^2. That’s why “taking a root only to square it” is harmless here. In coordinates, the distance formula sqrt((Δx)^2 + (Δy)^2 + (Δz)^2) is doing exactly the same thing: Δx, Δy, and Δz are the three mutually perpendicular “legs” meeting at a corner of an invisible little box stretching from A to B. You can picture the first right triangle living in, say, the x–y plane, and then a second right triangle formed by that base diagonal and the z-step-like stacking two crisp right triangles into a 3D sandwich. Honestly, you can even nudge the base triangle a bit and the add-three-squares still works out, because what matters is the sizes of the steps, not the angle they meet at.

    When the string has to stay on the surfaces, unfolding is the way to go: flatten the two faces the string crosses into one rectangle, and then draw a straight segment between the flattened corners. For opposite corners of a 5×8×2 box you’ll get candidates like sqrt((5+2)^2 + 8^2), sqrt((5+8)^2 + 2^2), or sqrt((8+2)^2 + 5^2); the shortest of those is the true “geodesic” on the surface, and it will be longer than the straight-through space diagonal. Different unfoldings can give different answers, but for a nice symmetric box I usually just add the two longer edges next to the starting corner to get the best one-those tend to line up the path more efficiently across the net. For points that aren’t opposite corners, if you’re allowed to travel through space you can still do the add-three-squares trick with their coordinate differences; if you’re stuck to the skin of the box, project onto whichever pair of faces you’ll cross and do a 2D Pythagoras there after unfolding.

    Want to play: for your 5×8×2 box, which unfolding gives the shortest surface path, and how does it compare numerically to the space diagonal sqrt(93)?

  3. Yes-inside a rectangular box you can go straight to sqrt(5^2+8^2+2^2) because the three edges are mutually perpendicular, so you’re just applying Pythagoras twice; in coordinates it’s the same sqrt((Δx)^2+(Δy)^2+(Δz)^2), with the right angles seen in the projections onto coordinate planes.
    If the path is constrained to the surfaces, unfold the touched faces and use a 2D diagonal like sqrt((5+2)^2+8^2), which is always at least as long as the space diagonal (and sometimes equal); I remember sketching nets on graph paper and discovering that “add three squares” only works when the components are exactly perpendicular.

Leave a Reply

Your email address will not be published. Required fields are marked *

Join Our Community

Ready to make maths more enjoyable, accessible, and fun? Join a friendly community where you can explore puzzles, ask questions, track your progress, and learn at your own pace.

By becoming a member, you unlock:

  • Access to all community puzzles
  • The Forum for asking and answering questions
  • Your personal dashboard with points & achievements
  • A supportive space built for every level of learner
  • New features and updates as the Hub grows