# Computing distances between hyperspheres and sides of a hypercube?

Suppose you are given the $n$ dimensional hypersphere:

$$\left(x_1 - \frac{1}{2}\right)^2 + \left(x_2 - \frac{1}{2}\right)^2 +\ldots+ \left(x_n - \frac{1}{2}\right)^2 = \frac{n}{4}$$

And the hyperplane:

$$a_1x_1 + a_2x_2 + a_3x_3+\ldots+a_nx_n = c$$

Such that they intersect to form an $n-1$ dimensional hypersphere.

How do you compute the average distance of the surface of this hypersphere from the hyperfaces of the cube:

$$0 \le x_1, x_2, x_3,\dots, x_n \le 1$$

Here hyper surface can be defined as any surface of dimension lower than the original cube itself.

For example

We can consider the circle formed by intersecting:

$$\left(x_1 - \frac{1}{2}\right)^2 + \left(x_2 - \frac{1}{2}\right)^2 + \left(x_3 - \frac{1}{2}\right)^2 = \frac{3}{4}$$

$$x + y + z = 1$$

and then we want to compute the average distance of the points of this sphere to the cube

$$0 \le x_1, x_2, x_3 \le 1$$

-
As stated now your problem is very confusing, maybe you could name all the sets you are dealing with, for instance A,B,… then say exactly which distance you want to evaluate, for instance the distance from the set A to the set B. –  Mercy Jul 16 '13 at 19:19
Your hypersphere is $(n-1)$-dimensional, and its intersection with some hyperplane is an $(n-2)$-dimensional sphere. –  Christian Blatter Jul 16 '13 at 19:54
@Mercy is there a particular area that is unclear? It seems clear to me, but then again I'd be horribly biased considering I came up with the question. –  frogeyedpeas Jul 17 '13 at 3:26
@frogeyedpeas this is unclear: "How do you compute the average distance of the surface of this hypersphere from the hyperfaces of the cube"... which hypersurface are you talking about since there are two of them? Is it the one of dimension $n-1$ or the one of dimension $n-2$? –  Mercy Jul 17 '13 at 7:27
Yes I'll make it clear –  frogeyedpeas Jul 17 '13 at 12:27