Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two concentric circles $C_1$ and $C_2$ with radii $r_1,r_2$ such that $r_1< r_2$and a set of finite points $P=\left \{ p_1,p_2...p_n \right \}$ and $Q=\left \{ q_1,q_2...q_n \right \}$ are identified on circles $C_1,C_2$ respectively.

Now I would like to rotate the circle $C_1$ such that the sum of squares of the Euclidean-distances $\sum_i^nd(p_i,q_i)^2$ is minimized, where $d(.)$ indicates the Euclidean-distance.

Note that both $p_i$ and $q_i$ are 2-d coordinates in real space. What is the angle of optimal rotation, in either a clockwise or anti-clockwise direction that minimizes these sums of Euclidean distances?

I was looking at it as $P$ being hit by a rotation matrix and was finding the gradient w.r.t $\theta$ in the rotation matrix.

share|cite|improve this question
up vote 4 down vote accepted

Let $p_i=(r_1\cos\phi_i,r_1\sin\phi_i)$ and $q_i=(r_2\cos\theta_i,r_2\sin\theta_i)$. Then rotating by $\psi$ leads to

$$ \begin{align} \sum_{i=1}^nd(p_i,q_i')^2 &= \sum_{i=1}^n\left((r_1\cos(\phi_i+\psi)-r_2\cos\theta_i)^2+(r_1\sin(\phi_i+\psi)-r_2\sin\theta_i)^2\right) \\ &= n(r_1^2+r_2^2)-2r_1r_2\sum_{i=1}^n\cos(\phi_i-\theta_i+\psi) \\ &= n(r_1^2+r_2^2)-2r_1r_2\Re\sum_{i=1}^n\mathrm e^{\phi_i-\theta_i+\psi} \\ &= n(r_1^2+r_2^2)-2r_1r_2\Re\left(\mathrm e^\psi\sum_{i=1}^n\mathrm e^{\phi_i-\theta_i}\right) \;. \end{align} $$

This is minimal for

$$\psi=\arg\left(\sum_{i=1}^n\mathrm e^{\theta_i-\phi_i}\right)\;,$$

and the minimal value is

$$ n(r_1^2+r_2^2)-2r_1r_2\left|\sum_{i=1}^n\mathrm e^{\theta_i-\phi_i}\right| \;. $$

share|cite|improve this answer
Wonderful. I like the way you used the polar coordinates and the Euler representations. You may wanna look at this as well,… as it may interest you! – halms May 1 '13 at 21:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.