# How to find the weighted midpoint between n-points?

I was hoping if someone could guide me to the right algorithm to find the weighted midpoint of n-points. The photo attached below perfectly describes my problem. Let's just say we have three points with weights associated with them: $$(x,y) = (3,5),(2,6),(7,2)$$. The weights are $$w_1 = 2, w_2 = 4, w_3 = 8$$. How would I use the weights of these points to find the proper midpoint? I.e, if the weight is higher for one point than the other point, the midpoint would be closer to the point with the higher weight.

If you want the centriod, it's just $$(\bar{X}, \bar{Y})$$. If you want weighted means, you can multiply each value by its weight before summing and then divide by the sum of the weights to compute the weighted mean. If it's more convenient for you, copy each datum weight times and then average. Here's a simple example, coded in R:

d = data.frame(x=c(3,2,7), y=c(5,6,2))
d = d[rep(1:3, times=c(2,4,8)),]
print(d, row.names=FALSE)
# x y
# 3 5
# 3 5
# 2 6
# 2 6
# 2 6
# 2 6
# 7 2
# 7 2
# 7 2
# 7 2
# 7 2
# 7 2
# 7 2
# 7 2
colMeans(d)
#        x        y
# 5.000000 3.571429
plot(d)
points(5, 3.57, pch=16, col="red")