Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I have this nifty function:

latitudeDifference = endLatitude - startLatitude
longitudeDifference = endLongitude - startLongitude
RADIUS = 6367 (This is the radius of the earth)

angle = $\sin^2\left(\dfrac{latitudeDifference}{2}\right) + cos(startLatitude) * cos(endLatitude) * \sin^2\left(\dfrac{longitudeDifference}{2}\right) $

unitDistance = 2 * arctan$\left(\dfrac{\sqrt(angle)}{\sqrt(1.0f - angle)}\right) $

distance = RADIUS * unitDistance;

that helps me to figure out the distance between two points, given a startCoordinate and an endCoordinate. However, I am trying to utilize this function in order to calculate the latitude and longitude offsets given a distance (basically inverting the function for endLatitude and endLongitude), but when I found the functions, I couldn't escape i in many use cases, which says to me that the calculation must be invalid.

Is it possible to inverse this function to find a latitude or longitude offset for which is 'distance' away from the starting point?

Basically, if I have a coordinate (latitude : 50.0, longitude : 100.0) and I want to know the offset for both latitude and longitude (two separate equations) given a certain distance (50KM in this case), is it possible to reverse this function in order to give me a latitude offset (50KM away from (50.0, 100.0) using only latitude) and a longitude offset (50KM away from (50.0, 100.0) using only longitude)?

In even simpler terms, I have distance, but I want endLatitude and endLongitude by calculating them separately and assuming their counterpart is 0.


I want to find the distance in latitude and longitude. Essentially, I want to know the offset of latitude that is 50km away from the starting point and the longitude offset that is 50km from the starting point in terms of latitude.longitude (degrees and/or radians).

Maybe this image will help:

I want to find point A and point B in terms of Latitude and Longitude (Radians)

share|cite|improve this question
I don't understand what your asking – Ethan Dec 14 '12 at 22:34
Typically, the radius would only set one of the two variables (latitude or longitude). – Fabian Dec 14 '12 at 22:37
@Ethan I've tried to make it a bit more understandable. – RileyE Dec 14 '12 at 22:44
Whats a latitude and longitude radius? – Ethan Dec 14 '12 at 22:50
@Ethan I'm not sure where you're getting the latitude and longitude radius from. The only RADIUS is the radius of the earth, which is part of determining the distance between the two points. – RileyE Dec 14 '12 at 22:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.