The distance formula look like for two 4-dimensional points, call them (x1,y1,z1,w1)\displaystyle {\left({x}_{{1}},{y}_{{1}},{z}_{{1}},{w}_{{1}}\right)} and (x2,y2,z2,w2)\displaystyle {\left({x}_{{2}},{y}_{{2}},{z}_{{2}},{w}_{{2}}\right)}, would look like
D=(x2x1)2+(y2y1)2+(z2z1)2+(w2w1)2\displaystyle {D}=\sqrt{{{\left({x}_{{2}}-{x}_{{1}}\right)}^{{2}}+{\left({y}_{{2}}-{y}_{{1}}\right)}^{{2}}+{\left({z}_{{2}}-{z}_{{1}}\right)}^{{2}}+{\left({w}_{{2}}-{w}_{{1}}\right)}^{{2}}}}.