[math-fun] generalized Pythagorean theorem