Distance between a point and low-dimensional sphere

74 Views Asked by At

Is there a way to analytically calculate the distance between an arbitrary point $\mathbf{x}\in\mathbb{R}^n$ and a low-dimensional sphere embedded in $\mathbb{R}^n$, say one aligned with the axis ? For example, calculate the distance between $\mathbf{x}\in\mathbb{R}^n$ and $S_1 = \{\mathbf{y}\in\mathbb{R}^n: y_1^2+y^2_2 = 1, y_3=0 \}$ or, more generally, $\mathbf{x}\in\mathbb{R}^n$ and $S_k = \{\mathbf{y}\in\mathbb{R}^n: y_1^2+y^2_2 +\cdots + y_{k+1}^2= 1, y_{k+2}=0,...,y_n=0 \}$ ?

1

There are 1 best solutions below

0
On BEST ANSWER

The problem boils down to full dimensional sphere if you write down the distance explicitly. Indeed, let $x = (x_1,...,x_n) \in \mathbb{R}^n$ be fixed, and let $S_k$ be defined as in the question. Then, for any $y = (y_1,...,y_{k+1}, 0,..., 0) \in S_k$ one has $$ \tag{1} || x - y ||^2 = (x_1 - y_1)^2 +...+(x_{k+1} - y_{k+1})^2 + x_{k+2}^2 +...+x_n^2. $$ To get the distance of $x$ from $S_k$ we minimize over $y$ in $(1)$, but notice that the minimizer $y_* = (y_1,...,y_{k+1}) $ computes the distance of $X: = (x_1,...,x_{k+1})$ to the unit sphere in $\mathbb{R}^{k+1}$. Hence $y_*$ is simply the intersection of the ray through $0\in \mathbb{R}^{k+1}$ and $X$ and the unit sphere of $\mathbb{R}^{k+1}$. Thus $$ y_* = \frac{X}{||X||} = \frac{1}{(x_1^2 + ...+ x_{k+1}^2)^{1/2}} (x_1,...,x_{k+1}). $$ Getting back to $(1)$ we see that $$ \mathbb{dist}(x, S_k)^2 = \left|\left| \frac{X}{||X||} - X \right|\right|^2 + x_{k+2}^2 + ...+ x_n^2, $$ where $||\cdot||$ stands for the norm of $\mathbb{R}^{k+1}$ and $X$ is the vector of first $k+1$ coordinates of $x$.