The problem asks to apply Pythagoras' theorem twice over in order to prove that the length $r$ of the 3 dimensional vector $r = (x,y,z)$ satisfies $r^2 = x^2+y^2+z^2$.
I thought I saw the concept of applying the theorem twice but when I looked at my answer it doesn't make intuitive sense to me. I simply took the length of the vector $r=(x,y)$ in the $x-y$ plane alone, which was $r=\sqrt{x^2+y^2}$. Then I imagined the $z$-axis intersecting the $x-y$ plane. The new $r$ vector in this region will have a $z$ component and an $xy$ component for its component lengths. Thus, $r=\sqrt{\sqrt{x^2+y^2}+z^2}$.
Where did I go wrong in my logic?
The problem is just that you did not square $\sqrt{x^2 +y^2}$ the second time.