If the earth is treated as a sphere, the formula is 6371 km * cos-1(cos(Long1-Long2)cos(Lat1)cos(Lat2)+sin(Lat1)sin(Lat2))Here, Long1 and Lat1 are the coordinates of one point, and Long2 and Lat2 are the coordinates of the other. 6371 km is the radius of the Earth (which you could convert to miles to get an answer in miles for your distance). You'll notice we're taking sines and cosines of latitude and longitude: this is because they're really angles! Longitude measures a point's angle in the equator's plane, and latitude measures its angle away from that horizontal. If you've seen spherical coordinates before, this should be familiar. The formula assumes you're dealing with angles in radians. If you want to use degrees, you'll have to multiply the final answer by pi/180. Here's how to get this formula. First, note that it's very easy to get a distance between two points on a sphere if you know the angle of the arc between them: just multiply it by the radius. So we're going to concentrate on finding this angle. We're going to use the fact that the dot product of two vectors is equal to the product of their lengths, times the cosine of the angle between them. At the same time, we can compute a dot product coordinate by coordinate. Let the vectors a and b be the vectors from the center of the earth to each of our points. Using spherical coordinates, we can write them down explicitly: a = (r cos(Long1)cos(Lat1), r sin(Long1)cos(Lat1), r sin(Lat1)) b = (r cos(Long2)cos(Lat2), r sin(Long2)cos(Lat2), r sin(Lat2)) We take their dot product and get r^2 (cos(Long1)cos(Long2)cos(Lat1)cos(Lat2) + sin(Long1)sin(Long2)cos(Lat1)cos(Lat2) + sin(Lat1)sin(Lat2)) By the other formula for dot product, this is r^2 times the cosine of the angle between them. So cancel the r^2, and take the inverse cosine. You'll get the formula above (if you simplify some terms). In fact the earth is not a sphere. It is generally an "oblate spheroid", meaning that it is somewhat flattened at the poles. But the true shape of the Earth is actually irregular, and it is therefore impossible to determine by formula the exact distance between two points. Various approximations of the shape of the earth, called reference ellipsoids, are used in other, more complex formulas that come closer to the actual distance. The spherical solution given here is pretty close for many purposes though.
Chat with our AI personalities
yes
Yes, by using the distance formula.
Distance from (0, 0) to (5, 12) using distance formula is 13
By using the distance formula between two coordinated points
Points: (6, -2) and (6, 2)Using the distance formula: 4