I’m trying to sanity-check a cable run across a rectangular room and my brain keeps doing a little cartwheel. The room is 5 m by 4 m with a 3 m ceiling. I want the straight-line distance from one floor corner to the opposite ceiling corner (like diagonally through the space).
My instinct was to do it in two steps: first get the floor diagonal: sqrt(5^2 + 4^2) = sqrt(41). Then combine that with the height using Pythagoras again: sqrt((floor diagonal)^2 + 3^2). This is where I start second-guessing myself. Is that legal? Or am I double-squaring or something silly?
My partially-correct attempt: I did sqrt(41) ≈ 6.4, then I did sqrt(6.4^2 + 3^2). That seems to give the same as sqrt(5^2 + 4^2 + 3^2), but I don’t fully understand why that’s okay. What exactly are the perpendicular sides in that second triangle? Are we guaranteed that the floor diagonal is perpendicular to the vertical, or am I accidentally making a triangle that isn’t really right-angled?
Follow-up: if I started from the midpoint of one wall on the floor (say halfway along the 5 m wall) to the opposite top corner instead of corner-to-corner, does the same “add the squares” idea still apply directly, or do I need to break it differently? I keep worrying I’m mixing triangles that don’t share a right angle. Help untangle my math spaghetti, please!
















3 Responses
Totally legal – in a rectangular room the length, width, and height are mutually perpendicular, and the vertical is perpendicular to the entire floor plane, which means it’s perpendicular to every line in that plane, including the floor diagonal. So your two-step Pythagoras stacks perfectly: first get the floor diagonal sqrt(5^2 + 4^2) = sqrt(41) ≈ 6.4 m, then treat that as one leg with the height 3 m as the other leg, giving sqrt((sqrt(41))^2 + 3^2) = sqrt(41 + 9) = sqrt(50) ≈ 7.07 m. You’re not double-squaring; you’re just adding the squares of three perpendicular components, which is exactly the 3D distance formula: sqrt(5^2 + 4^2 + 3^2). A nice way to picture it: imagine walking straight across the floor to the far corner, then taking an elevator straight up – the wire that goes directly through the air doesn’t care whether you “imagine” the walk first and the elevator second; its length depends only on the three perpendicular offsets. For your follow-up, the same idea applies: in 3D, distance between two points is sqrt((Δx)^2 + (Δy)^2 + (Δz)^2). If you start at the midpoint of the 5 m wall on the floor, say (2.5, 0, 0), and go to the opposite top corner (5, 4, 3), the offsets are (2.5, 4, 3), so the distance is sqrt(2.5^2 + 4^2 + 3^2) = sqrt(31.25) ≈ 5.59 m. Different start/end points just change the Δx, Δy, Δz, but the “add the squares of the perpendicular components” rule is the same.
Your two-step cartwheel is totally legal gymnastics! Think of the room as a 3D right-angled “box,” so the straight corner-to-corner line is the hypotenuse of a 3D right triangle. That’s why the one-shot formula works: distance = sqrt(5^2 + 4^2 + 3^2) = sqrt(50) ≈ 7.07 m. Your two-step way matches because (sqrt(41))^2 = 41, so sqrt((floor diagonal)^2 + 3^2) = sqrt(41 + 9) = sqrt(50). And yes, the vertical direction is perpendicular to the whole floor plane, so it’s perpendicular to any segment that lies entirely on the floor, including the floor diagonal. I sometimes think of it as: the floor diagonal is “mostly horizontal,” and the vertical is “purely vertical,” so they’re at right angles-though, strictly speaking, the diagonal is only exactly perpendicular to the vertical at its midpoint (which is the bit that the triangle “uses”). For a friendly refresher, here’s a neat write-up on the 3D distance formula: https://www.khanacademy.org/math/geometry/hs-geo-analytic-geo/hs-geo-distance-formula/a/distance-formula-in-3d
For your follow-up, starting from the midpoint of the 5 m wall on the floor to the opposite top corner, you can still “add the squares” of the perpendicular offsets: that horizontal step is 2.5 m (half of 5), the other horizontal is 4 m, and the vertical is 3 m. So the distance is sqrt(2.5^2 + 4^2 + 3^2) = sqrt(6.25 + 16 + 9) = sqrt(31.25) ≈ 5.59 m. If you try to do it in two steps using some slanted segment that isn’t aligned with the floor first, you might accidentally lose the right angle in the second triangle-Pythagoras gets grumpy about that-so sticking to axis-aligned differences (or a floor-then-up plan) is the safe recipe here.
Hope this helps!
You’re on the right track, and I’ve absolutely done that “wait, am I double-squaring?” spiral too. The two-step thing is legit: the floor diagonal √(5^2 + 4^2) = √41 is a segment lying in the floor plane, and the vertical height 3 m is perpendicular to the entire floor plane, so it’s perpendicular to that diagonal as well-so the second triangle really is right-angled. That means the space diagonal is √(41 + 3^2) = √50 ≈ 7.07 m (I always think “about 7.1,” then remember √50 is 5√2, whoops). I sometimes picture the second triangle as “leaning” and worry it isn’t a perfect right angle, but the plane cut that contains the floor diagonal and that vertical direction is a nice flat rectangle, so it works out. For your follow-up, the same add-the-squares idea applies as long as the components are along perpendicular directions: from the midpoint of the 5 m wall on the floor (say at 2.5 m along that wall) to the opposite top corner, your displacement components are 2.5 across the length, 4 across the width, and 3 up, so the straight-line distance is √(2.5^2 + 4^2 + 3^2) = √31.25 ≈ 5.59 m. I briefly wondered if you need to recompute a new “floor diagonal” first, but that just re-wraps the same sum of squares: √((√(2.5^2 + 4^2))^2 + 3^2) gets you back to √(2.5^2 + 4^2 + 3^2). If you like a reference, Khan Academy has a short bit on the 3D distance formula: https://www.khanacademy.org/math/geometry/hs-geo-analytic-geometry/hs-geo-dist-formula/v/distance-formula-in-3d. By the way, for your actual cable: are you planning a free-air straight run, or will it hug walls/ceiling (which would change it to a piecewise path and a longer length)?