So we’re all familiar with the famous Pythagorean Theorem for a right angled 2D triangles, which can be written as $x^2 + y^2 = r^2$ ($x$ is the base, $y$ is the height, $r$ is the hypotenuse).
There exists another formula for 3D triangles that can be written as $x^2 + y^2 + z^2 =r^2$.
Given the pattern here in dimensions, does there exist a 4D Pythagorean theorem, $x_1^2 + x_2^2 + x_3^2 + x_4^2 = r^2$? Is there a general Pythagorean theorem than applies for n dimensions, $x_1^2 +x_2^2 +x_3^2 + x_4^2 +…+x_n^2 =r^2$?
If so, how can we prove it if we can’t use any geometry?
And if not, for which dimensions does this Pythagorean pattern hold true?