Equidistant location from three locations?
January 15, 2010 12:19 PM   Subscribe

What is the easiest way to calculate a location that is equidistant from three locations? (In this case: Baltimore, Chicago, Detroit)

I tried several algebra formulas I found online and came up with Albany, NY, which obviously isn't correct. Clearly, my algebra is too hazy and my head is now swimming with terms like "centroid" and "circumcenter".

In case anyone wonders: this isn't for a class and I'm not trying to avoid doing the work myself, I'm just stuck.
posted by sharkfu to Education (17 answers total) 3 users marked this as a favorite
It looks like you can do this pretty easily at the Geographic Midpoint Calculator.
posted by shakespeherian at 12:24 PM on January 15, 2010 [2 favorites]

Isn't this just your typical finding the centre of a circle using three points problem? This might help:

posted by reformedjerk at 12:25 PM on January 15, 2010

And, incidentally, it looks like your midpoint is near Cleveland.
posted by shakespeherian at 12:26 PM on January 15, 2010

shakespeherian, your link shows the middle of the triangle formed by all the input locations. For the three example cities, it gives somewhere in northern Ohio, which is right next to Detroit.
posted by mkb at 12:28 PM on January 15, 2010

Oh, you're right. Nevermind then.
posted by shakespeherian at 12:30 PM on January 15, 2010

Isn't this just your typical finding the centre of a circle using three points problem?

Well, the fact that the points are on the surface of a(n approximate) sphere rather than a plane changes the math a little, but given that they're all in the eastern US, not to a huge degree.

But yes, if you pretend the eastern US is flat, you just need to find the center of the circle that passes through the three points of Baltimore, Chicago, and Detroit. This is called the "circumcenter," the center of the "circumcircle."
posted by letourneau at 12:32 PM on January 15, 2010

First, assume that the Earth is flat. You're looking at this on a map, not a globe.

Three points determine a curve. You can find the center of that curve (which is, by definition, the exact same distance from each of the three points) with the following method:
-Draw a triangle with your three points as the vertices
-Find the perpendicular bisector of each side of the triangle.
-Draw any two of the bisector lines out so that they intersect. That's the center of your curve.

You can get three points doing it this way. Doing it on a globe is a little more difficult because you're dealing not with straight lines but with great circles.
posted by backseatpilot at 12:32 PM on January 15, 2010 [1 favorite]

shakespeherian's link calculates the geometric midpoint, or centroid. sharkfu is looking for the circumcenter. They're not the same.

This PDF gives some notes on a similar problem used in the context of a Jules Verne novel(!) The actual math is given in the appendix. Since you're going to convert back to spherical coordinates at the end, it doesn't matter what you use for R, it will cancel out in the end.
posted by DevilsAdvocate at 1:35 PM on January 15, 2010

Yeah, I misread the question. Bully for me.
posted by shakespeherian at 1:38 PM on January 15, 2010

Chiming in here to say that depending on why you are asking the question might dictate how you define the middle.

If you want the "average" location (maybe if there are three friends that all want to meet "in the middle") that is one thing (found by just averaging the coordinates).
Chicago: 41.9°' North, 87.7°' West
Baltimore: 39.3° North, 76.6° West
Detroit: 42.3° North 83.0° West

"Middle": 41.2° North 82.4° West (not too far from Cleveland, OH)

If you want to find the spot equidistant (maybe if you were a serial killer, and wanted to situated your kills as to form a pattern in the country) then you would do as many have described above (result: pretty damn close to Manchester, Kentucky).

So, I guess my answer is "it depends"
posted by milqman at 1:42 PM on January 15, 2010

To solve it as a flat surface, there are three distance formulas, three unknowns:

z^2 = (x-39.18)^2+(y-(-76.67))^2
z^2 = (x-41.90)^2+(y-(-87.65))^2
z^2 = (x-42.42)^2+(y-(-83.02))^2

Give that to Wolfram Alpha:

x~~32.2267, y~~-84.2194, z~~-10.2636

This is in the middle of Georgia. I'm kind of fuzzy on whether you can actually do this kind of math with lat/long though.
posted by smackfu at 1:43 PM on January 15, 2010

smackfu, I think you just found another spot on the circle. In fact, there should be an infinite number of solutions around that circle. I think the way you have the problem set up, you are actually looking for the X, Y coordinate where Z equals 0.

posted by milqman at 1:55 PM on January 15, 2010

I think smackfu is mostly right, but you need to adjust for the fact that a degree latitude represents more distance than a degree longitude if you're not on the equator. On the average latitude of the three cities, the factor is about 0.755; solving the same system with this factor added in marks this as the spot, which is somewhere in Tennessee. If you plan walking routes (ha!) to each of the three cities it somewhat works out.
posted by thijsk at 2:28 PM on January 15, 2010

(link to my Octave code.)
posted by thijsk at 2:41 PM on January 15, 2010

milqman raises a good point: if you're looking for, say, a roughly central location for people from the three cities to meet, the circumcenter isn't necessarily a good choice; for an obtuse triangle, the circumcenter actually lies outside the triangle formed by the three points. Extreme example: in a plane, the circumcenter of the points (0,0), (10, 0) and (20,2) is (5,51). It's √2626 ≈ 51.24 units from each of the three points, but this is much farther from any of the three points than the centroid is.

That said, if you really do want the circumcenter, we can take advantage of the fact that the three points are on the surface of a sphere (roughly; the earth is close enough to a sphere that it shouldn't make much difference). Consider the plane in three-space defined by your three points; the intersection of that plane with the surface of the earth is a circle, which is necessarily the circumcircle for those three points. The circumcenter in three-space is simply the point at which a line passing through the center of the earth and perpendicular to that plane intersects that plane, and the circumcenter on the earth's surface is the point at which that same line intersects the earth's surface.

So all we have to do is find a vector perpendicular to the plane defined by the three points of interest, which is fairly easy to do. First, convert the polar coordinates to rectangular coordinates:
Baltimore: 39.30, -76.63 = (.17894, -.75287, .63338)
Chicago: 41.83, -87.62 = (.03094, -.74448, .66692)
Detroit: 42.33, -83.05 = (.08946, -.73385, .67340)
(where the units for the rectangular coordinates are earth radii)

Now, if B, C, and D are in clockwise order, than (B-C)x(D-C) gives a vector perpendicular to the plane and pointing away from the earth's center.

B-C = (.14800, -.00839, -.03354)
D-C = (.05852, .01063, .00648)

(B-C)x(D-C) = (.00030, -.00292, .00206)

Now simply convert back to polar coordinates:
Lat. = sin⁻¹[z/√(x²+y²+z²)] = 35.10
Long. = sin⁻¹[y/√(x²+y²)] = -84.10

Which is in far southwestern North Carolina, very near the point where North Carolina, Tennessee, and Georgia meet. (On the linked map, the green arrow is that point; the red "A" marker is just Google's display of a nearby point of interest, which I can't figure out how to turn off.) It's about 504 miles as the crow flies from Baltimore, Chicago, and Detroit. (The opposite point on the earth's surface, at 35.10°S 95.90°E, in the Indian Ocean about 1200 miles west of Perth, is also equidistant, albeit much farther, from the three cities.)
posted by DevilsAdvocate at 5:48 PM on January 15, 2010

I was going to say Fort Wayne.
posted by gjc at 5:53 PM on January 15, 2010

oh wait, are you looking for a point on the Earth's surface?
posted by Locobot at 11:19 PM on January 15, 2010 [2 favorites]

« Older Nothing can stop us -- it's Tuftonia Day!   |   PHP=pretty hard, probably Newer »
This thread is closed to new comments.