Saturday, December 7, 2013

A Calculation involving Circles

This is a computation I did for a friend last month. We wanted to describe the set of points the ratio of whose distances from two other points remained fixed.

Let me say that better: I have two points in the plane, $S$ and $T$, and am given a positive fixed quantity $\alpha$. I want to describe the set of points $P$ for which

$$ \frac{\text{distance} (P,S)} {\text{distance}(P,T)} = \sqrt {\alpha}$$
The reason I put in a square-root is because I'm actually going to work with the square of this formula.

Notice that if $\alpha = 1$, then I just get a line. So I'm only going to consider the cases in which $\alpha \neq 1$.

I'll start by naming the coordinates of these points:
$$S= (a_1, b_1), T = (a_2, b_2), P= (x, y)$$

Then the ratio of distances reads as

$$\frac{(x-a_1)^2+(y-b_1)^2}{(x-a_2)^2+(y-b_2)^2} = \alpha$$

Now I'm going to do some algebra.

$$(x-a_1)^2+(y-b_1)^2 = \alpha((x-a_2)^2+(y-b_2)^2)$$

$$x^2-2a_1x+a_1^2 + y^2-2yb_1+b_1^2 = \alpha(x^2-2a_2x+a_2^2 + y^2-2yb_2+b_2^2)$$

$$x^2-2a_1x+a_1^2 + y^2-2yb_1+b_1^2 = \alpha x^2-2a_2\alpha x+\alpha a_2^2 + \alpha y^2-2y\alpha b_2+\alpha b_2^2$$

$$(1-\alpha)x^2 + (- 2a_1 + 2\alpha a_2 )x +(a_1^2-\alpha a_2^2) + (1-\alpha) y^2 + (- 2 b_1 + 2 \alpha b_2 )y + (b_1^2 - \alpha b_2^2) = 0$$

Now since $\alpha \neq 1$, I can divide by $(1-\alpha)$:

$$\left [x^2 + \frac{- 2a_1 + 2\alpha a_2 }{1-\alpha} x + \frac{a_1^2-\alpha a_2^2}{1-\alpha} \right ] + \left [ y^2 + \frac{- 2 b_1 + 2 \alpha b_2 }{1-\alpha}y + \frac{b_1^2 - \alpha b_2^2}{1-\alpha} \right ] = 0$$

Now I'm going to use a clever little transformation called "completing the square", which is basically a convenient rewriting of

$$X^2+2AX+B$$
as
$$ (X+A)^2+(B-A^2)$$

It's the same, you can check. I do this to both the $x$ component and the $y$ component (separately!), and get

$$\left [ \left (x + \frac{- a_1 + \alpha a_2 }{1-\alpha} \right )^2 + \left ( \frac{a_1^2-\alpha a_2^2}{1-\alpha} - \left ( \frac{-a_1 + \alpha a_2 }{1-\alpha} \right ) ^2 \right ) \right ]
+ \\
\left [ \left (y + \frac{- b_1 + \alpha b_2 }{1-\alpha} \right )^2 + \left ( \frac{b_1^2-\alpha b_2^2}{1-\alpha} - \left ( \frac{- b_1 + \alpha b_2 }{1-\alpha} \right ) ^2 \right ) \right ] = 0
$$

Now I move the constants (the parts not involving $x$ or $y$) to the right-hand-side of the $=$ sign. Watch those signs!

$$\left (x - \frac{a_1 - \alpha a_2}{1-\alpha} \right )^2
+ \\
\left (y - \frac{b_1 - \alpha b_2}{1-\alpha} \right )^2
=
\left ( \left ( \frac{- a_1 + \alpha a_2 }{1-\alpha} \right ) ^2 - \frac{a_1^2-\alpha a_2^2}{1-\alpha} \right ) + \left ( \left ( \frac{ - b_1 + \alpha b_2}{1-\alpha} \right ) ^2 - \frac{b_1^2-\alpha b_2^2}{1-\alpha} \right )
$$

And because $(-1)^2=-1$,

$$\left (x - \frac{a_1 - \alpha a_2}{1-\alpha} \right )^2
+ \\
\left (y - \frac{b_1 - \alpha b_2}{1-\alpha} \right )^2
=
\left ( \left ( \frac{a_1 - \alpha a_2}{1-\alpha} \right ) ^2 - \frac{a_1^2-\alpha a_2^2}{1-\alpha} \right ) + \left ( \left ( \frac{b_1 - \alpha b_2}{1-\alpha} \right ) ^2 - \frac{b_1^2-\alpha b_2^2}{1-\alpha} \right )
$$

END OF LONG CALCULATION.

What did this give us? Well, that final relation describes a circle of $(x,y)$ points, whose center is

$$\left ( \frac{a_1 - \alpha a_2}{1-\alpha}, \frac{b_1 - \alpha b_2}{1-\alpha} \right )$$

which we can write as
$$\frac{S-\alpha T}{1-\alpha}$$

The square of the radius of this circle is

$$ { \left ( \left ( \frac{a_1 - \alpha a_2}{1-\alpha} \right ) ^2 - \frac{a_1^2-\alpha a_2^2}{1-\alpha} \right ) + \left ( \left ( \frac{b_1 - \alpha b_2}{1-\alpha} \right ) ^2 - \frac{b_1^2-\alpha b_2^2}{1-\alpha} \right ) }
$$

$$=\frac{{(a_1-\alpha a_2)^2-(a_1^2 - \alpha a_2^2)(1-\alpha)+(b_1-\alpha b_2)^2-(b_1^2 - \alpha b_2^2)(1-\alpha)}}{(1-\alpha)^2}
$$

Let's simplify the numerator. We start by expanding it out:

$$(a_1^2-2\alpha a_1 a_2+\alpha^2a_2^2)-(a_1^2 - \alpha a_2^2 - a_1^2\alpha + \alpha^2 a_2^2) + (b_1^2-2\alpha b_1 b_2+\alpha^2b_2^2)-(b_1^2 - \alpha b_2^2 - b_1^2\alpha + \alpha^2 b_2^2)
$$
Lots of these terms cancel one another, and in fact we are left with
$$\alpha(a_1^2-2a_1a_2+a_2^2) + \alpha(b_1^2-2b_1b_2+b_2^2)
$$

$$=\alpha ((a_1-a_2)^2 + (b_1-b_2)^2)$$

So the radius of the circle is (the positive value of)

$$\frac{\sqrt{\alpha ((a_1-a_2)^2 + (b_1-b_2)^2)}}{1-\alpha}
$$

which is $\sqrt\alpha/(1-\alpha)$ times the distance between $R_1$ and $R_2$.

In summary

The set of points which have a fixed ratio of distances from two other fixed points is either

a. A line, if that ratio is 1
b. Another circle, whose center is $\frac{R_1-\alpha R_2}{1-\alpha}$ and radius is $\sqrt\alpha/|1-\alpha| |R_1 - R_2|$.