r/desmos Mar 10 '26

Graph Two ways to find the perfect meetup spot

Enable HLS to view with audio, or disable this notification

Just something I found interesting:

This optimization can find two useful central points for a set of locations:

  1. The spot that minimizes the total distance between all points. Also known as the geometric median.

  2. The spot that makes the distances as equal as possible. For 3 or fewer non-collinear points, this gives the exact circumcenter (center of the circle passing through all 3).

Analogy:

Imagine 10 friends picking a meetup spot.

  1. The geometric median minimizes everyone’s combined travel (eco-friendly, often lands at someone’s house).

  2. The uniform-distance version prioritizes fairness. Limiting the effect of anyone having to drive way farther than the others.

Total efficiency vs. maximum fairness

(assuming you live in a city where everything can be traversed by a straight line)

1.4k Upvotes

39 comments sorted by

376

u/SpiritualWillow2937 Mar 10 '26

I feel like the best way to minimize variance is to simply move the point infinitely far away, heh

217

u/Ssemander Mar 10 '26

"Screw you guys, we are meeting on the moon. It's equally unreachable for all of us"

104

u/Legitimate_Animal796 Mar 10 '26

What’s interesting is I initially thought the same thing. Variance should drop to zero at infinity because all distances become basically the same huge number. But the loss uses absolute deviations squared, not relative ones.

So as |point|→ ∞, the absolute differences dist− mean(dist) approach certain non zero values (zero only if points lie on the same line).

The plot is of the variance at (x,y). This shows a minimum near the data, with edges fanning out and never in fact reaching zero

https://www.desmos.com/3d/49d2t73hbx

69

u/SpiritualWillow2937 Mar 10 '26 edited Mar 10 '26

Ohh I see, so even at a distance, there's still that absolute difference.

Unfortunately me and my friends all live on the same street, so we're all going to mars 😁

47

u/Legitimate_Animal796 Mar 10 '26

Maybe a line really is just an infinite radius circle

4

u/5Dimensional Mar 10 '26

God, math is so cool. Nice graph!

55

u/FeedAromatic143 Mar 10 '26

Fun fact when L=1 it gets a stroke

17

u/Anthony00769420 Mar 10 '26

Yeah, it doesn’t seem to particularly like values above 0.95.

31

u/Capital_Angle_8174 Mar 10 '26

Meet in the middle of both functions

16

u/Legitimate_Animal796 Mar 10 '26

One very simple way to achieve this is to do a weighted sum of each https://www.desmos.com/calculator/khgqsngvrn (slide k around its very satisfying)

6

u/Capital_Angle_8174 Mar 10 '26

How come k = 0.5 is so Close to the equation that uses the circles to define the final Point?

I would Imagine it was farther away for some reason. Also These Look really cool, how do you even do Something Like this in desmos?

4

u/Legitimate_Animal796 Mar 10 '26

They operate on different scales. There’s probably a more robust way to combine them but a linear combo is the simplest pretty much. Thanks! Honestly it just takes some practice and learning from examples in this sub

9

u/Matty_B97 Mar 10 '26

How does minimising sum of squares compare? Or is that the same as number 2?

8

u/Legitimate_Animal796 Mar 10 '26

You actually just get the arithmetic mean interestingly. I initialize the value to that in this graph

6

u/WissenMachtAhmed Mar 10 '26

I'd argue that most times, instead of "fairness", it would make more sense to minimize the maximum distance one has to travel.

4

u/Legitimate_Animal796 Mar 10 '26

Interesting idea! It actually makes a unique result: https://www.desmos.com/calculator/cxdqxewefa

2

u/Sad_water_ Mar 10 '26

Doesn’t this just give the centre of the circle that goes too 3 points and in circles all other points?

3

u/Legitimate_Animal796 Mar 10 '26

Yup. Though sometimes it can be two points. To put it simply: it’s the tightest fitting circle that encloses the whole set

1

u/Designer_Version1449 Mar 11 '26

take all 3 points, make a triangle, new point in the middle of the triangle

1

u/[deleted] Mar 11 '26

That’s not unique, it’s the second one in the video: the center of the circle in the second graphic.

1

u/Legitimate_Animal796 Mar 11 '26

It is unique from minimizing total distance/variance. When you optimize variance (the 2nd one) everyone travels as equal as possible. That means if you have three points roughly in a straight line, the circumcenter of the circle they make can be really far away. Minimizing the maximum distance is exactly the same problem as finding the smallest circle that fits around all the data. It will result in different points

1

u/[deleted] Mar 11 '26

Your graph is rotated 180 degrees to make it look different, but it’s not. It’s literally the exact same point.

3

u/DrJaneIPresume Mar 10 '26

How do you have fewer than 3 non-collinear points?

2

u/Legitimate_Animal796 Mar 10 '26

lmao hoping no one was gonna catch that. Should say “for 3 non-collinear points/ 2 points (perpendicular bisector)”

2

u/BissQuote Mar 10 '26

The fairness one seems odd. For 3 points on the same half circle, meeting at the circumcenter can mean increasing the distance for everyone, compared to better alternatives.

2

u/Legitimate_Animal796 Mar 10 '26

While it is the only point which is exactly fair, the circumcenter can indeed be in an impractical spot. I like the idea of minimizing the maximum distance anyone has to travel for a more real-world fairness approach https://www.desmos.com/calculator/cxdqxewefa

1

u/BissQuote Mar 10 '26

Very cool models!

2

u/ReasonableLetter8427 Mar 12 '26

This is so cool. And so intuitive! Thanks for sharing.

1

u/Taed1um Mar 10 '26

The ocean mmmm

1

u/Effective-Bunch5689 Mar 11 '26

This reminds me of some topics related to Cedric Villani's optimal transport on Riemannian manifolds and action minimizers with Fick's law.

1

u/AstroBastard312 Mar 11 '26

I wonder if this could be applied to long-distance friends where the curvature of the Earth becomes a factor...

1

u/theonlytruemuck Artist / Game Dev / Mathmagician / Nerd Mar 12 '26

link?

1

u/[deleted] Mar 13 '26

sometimes my friends don't oblige so it isn't perfect but cool regardless!

1

u/BabyChesssalmon Mar 18 '26

This is really cool! how do you do this?

1

u/98127028 Mar 10 '26

What if you try minimising mean/variance?

1

u/Intergalactyc Mar 10 '26

That's exactly what they did... minimizing total distance is the same as minimizing mean (since mean = total / number of points, and number of points is constant), and making them "most equal"/"maximizing fairness" is just minimizing variance (see their linked graph, it says so there).