[Math] Weighted Average Distance between 3 or more points

averageeuclidean-geometrygeometry

I'm trying to find out the average point between 3 or more points, given each distance that the end point is away from each of the other points.

With 2 points it's easy, I believe the formula should be:

$x_p =\dfrac{(x_1 * d_2) + (x_2 * d_1)}{d_1 + d_2}$,
$y_p =\dfrac{(y_1 * d_2) + (y_2 * d_1)}{d_1 + d_2}$

With 3 points and 3 distances I tried to follow that same logic and take it a step further by using:

$x_p =\dfrac{(x_1 * d_2 * d_3) + (x_2 * d_1 * d_3) + (x_3 * d_1 * d_2)}{d_1 + d_2 + d_3}$

$y_p =\dfrac{(y_1 * d_2 * d_3) + (y_2 * d_1 * d_3) + (y_3 * d_1 * d_2)}{d_1 + d_2 + d_3}$

However this doesn't end up giving me the same answer. Instead it gives me a point that ends up being nowhere near the center of the 3 initial points. Is there a way to take the weighted average between 3 points to find the end point? Any help would be great, thank you!

Best Answer

In the case of two points, the weights would be $w_1 = \dfrac{\frac{1}{d_1}}{\frac{1}{d_1}+\frac{1}{d_2}} = \frac{d_2}{d_1+d_2}$ and $w_2 = \frac{d_1}{d_1+d_2}$

This you got it correctly.

Now for the case of three points

$w_1 = \dfrac{\frac{1}{d_1}}{\frac{1}{d_1}+\frac{1}{d_2}+\frac{1}{d_2}} = \frac{d_2d_3}{d_1d_2+d_1d_3+d_2d_3}$ and $w_2 = \frac{d_1d_3}{d_1d_2+d_1d_3+d_2d_3}$$w_3 = \frac{d_1d_2}{d_1d_2+d_1d_3+d_2d_3}$

Your problem is you are dividing by $(d_1+d_2+d_3)$

If you try this it will work.

Good luckk

Satish