Take the 2-minute tour ×

Here are two n-dimensional vectors: $V_1$ and $V_2$

$V_1 (v_1,v_2, \dots ,v_n)$

$V_2 (v_1,v_2, \dots ,v_n)$

It seems that $V_1*cos(\theta) + V_2*sin(\theta)$ is an ellipse in the n-D space. (Its center is the origin.)

Here is another point $P (p_1,p_2, \dots ,p_n)$

I want to find a point E on the ellipse that has the shortest euclidean distance from P.

My current idea is to first project the point onto the plane that is spanned by $V_1$ and $V_2$ and then try to solve the problem in 2-D space.

Maybe I can find $a$ and $b$ such that P = $a*V_1+ b*V_2$ and then solve the nearest-point problem in the $V_1$ and $V_2$ 2-D subspace. But it seems problematic to get the 2-D ellipse equation since $V_1$ and $V_2$ are not necessarily orthogonal.

Here's How to project a n-dimensional point onto a 2-D subspace?

What's the direction and length of the major and minor axes of the ellipse: $V_1*cos(\theta) + V_2*sin(\theta)$ ?

share|improve this question

1 Answer 1

If I understand the post correctly, $r: [0,2\pi] \rightarrow \mathbb{R}^n$ parametrizes an ellipse via the formula $r(\theta) = V_1 \cos(\theta)+V_2 \sin(\theta)$. Just think about the vector addition here.

  1. $\theta=0$ gives $r(0) = V_1$
  2. $\theta=\pi/2$ gives $r(\pi/2) = V_2$
  3. $\theta=\pi$ gives $r(0) = -V_1$
  4. $\theta=3\pi/2$ gives $r(0) = -V_2$

Intuitively I want to say these are the points which defined the semi-major or minor axes. The lengths of $V_1,V_2$ are nicely given by $||V_1|| = \sqrt{V_1 \cdot V_1}$ and $||V_2|| = \sqrt{V_2 \cdot V_2}$ so you can compare these lengths to pick a winner. Or if they're the same then you've got a circle. Well, I do assume $V_1,V_2$ are not co-linear.

To answer the closest point problem, write $f(\theta) = (P-r(\theta)) \cdot (P-r(\theta))$ and calculate: by the product rule for dot-products in $n$-dimensions,

$$ f'(\theta) = \frac{d}{d\theta}(P-r(\theta))\cdot(P-r(\theta))+(P-r(\theta)) \cdot \frac{d}{d\theta}(P-r(\theta)) $$

Of course $P$ does not depend on $\theta$ and the dot-product is commutative hence:

$$ f'(\theta) = 2(P-r(\theta)) \cdot \frac{dr}{d\theta} $$

Next, plug-in the given parametrization to find,

$$ f'(\theta) = 2(P-V_1 \cos(\theta)+V_2 \sin(\theta)) \cdot (-V_1 \sin(\theta)+V_2 \cos(\theta)) $$

Now, study $f'(\theta)=0$. Hopefully you can find a relation to select $\theta$ which puts you closest to the point $P$. I foresee some formula involving dot-products of the defining vectors etc... perhaps there is a nicer answer.

share|improve this answer

Your Answer


