Vincenty's formulae
It has been suggested that this article be merged with Geographical distance#Ellipsoidalsurface formulae to Ellipsoidal geodesic. (Discuss) Proposed since July 2013.

Vincenty's formulae are two related iterative methods used in geodesy to calculate the distance between two points on the surface of a spheroid, developed by Thaddeus Vincenty (1975a) They are based on the assumption that the figure of the Earth is an oblate spheroid, and hence are more accurate than methods that assume a spherical Earth, such as greatcircle distance.
The first (direct) method computes the location of a point that is a given distance and azimuth (direction) from another point. The second (inverse) method computes the geographical distance and azimuth between two given points. They have been widely used in geodesy because they are accurate to within 0.5 mm (0.020″) on the Earth ellipsoid.
Contents
Background
Vincenty's goal was to express existing algorithms for geodesics on an ellipsoid in a form that minimized the program length (see the first sentence of his paper). His unpublished report (1975b) mentions the use of a Wang 720 desk calculator, which had only a few kilobytes of memory. To obtain good accuracy for long lines, the solution uses the classical solution of Legendre (1806), Bessel (1825), and Helmert (1880) based on the auxiliary sphere. (Vincenty relied on formulation of this method given by Rainsford, 1955.) Legendre showed that an ellipsoidal geodesic can be exactly mapped to a great circle on the auxiliary sphere by mapping the geographic latitude to reduced latitude and setting the azimuth of the great circle equal to that of the geodesic. The longitude on the ellipsoid and the distance along the geodesic are then given in terms of the longitude on the sphere and the arc length along the great circle by simple integrals. Bessel and Helmert gave rapidly converging series for these integrals, which allow the geodesic to be computed with arbitrary accuracy.
In order to minimize the program size, Vincenty took these series, reexpanded them using the first term of each series as the small parameter, and truncated them to order ƒ^{3}. This resulted in compact expressions for the longitude and distance integrals. The expressions were put in Horner (or nested) form, since this allows polynomials to be evaluated using only a single temporary register. Finally, simple iterative techniques were used to solve the implicit equations in the direct and inverse methods; even though these are slow (and in the case of the inverse method it sometimes does not converge), they result in the least increase in code size.
Notation
Define the following notation:
a  length of semimajor axis of the ellipsoid (radius at equator);  (6378137.0 metres in WGS84) 
ƒ  flattening of the ellipsoid;  (1/298.257223563 in WGS84) 
b = (1  ƒ) a  length of semiminor axis of the ellipsoid (radius at the poles);  (6356752.314245 meters in WGS84) 
Φ_{1}, Φ_{2}  latitude of the points;  
U_{1} = arctan[(1 − ƒ) tan Φ_{1}], U_{2} = arctan[(1 − ƒ) tan Φ_{2}] 
reduced latitude (latitude on the auxiliary sphere)  
L = L_{2}  L_{1}  difference in longitude of two points;  
λ_{1}, λ_{2}  longitude of the points on the auxiliary sphere;  
α_{1}, α_{2}  forward azimuths at the points;  
α  azimuth at the equator;  
s  ellipsoidal distance between the two points;  
σ  arc length between points on the auxiliary sphere 
Inverse problem
Given the coordinates of the two points (Φ_{1}, L_{1}) and (Φ_{2}, L_{2}), the inverse problem finds the azimuths α_{1}, α_{2} and the ellipsoidal distance s.
Calculate U_{1}, U_{2} and L, and set initial value of λ = L. Then iteratively evaluate the following equations until λ converges:

 ^{[1]}^{[2]}

 ^{[3]}

 ^{[4]}
When λ has converged to the desired degree of accuracy (10^{−12} corresponds to approximately 0.06mm), evaluate the following:
 ^{[2]}
 ^{[2]}
Between two nearly antipodal points, the iterative formula may fail to converge; this will occur when the first guess at λ as computed by the equation above is greater than π in absolute value.
Direct Problem
Given an initial point (Φ_{1}, L_{1}) and initial azimuth, α_{1}, and a distance, s, along the geodesic the problem is to find the end point (Φ_{2}, L_{2}) and azimuth, α_{2}.
Start by calculating the following:
 ^{[2]}
Then, using an initial value , iterate the following equations until there is no significant change in σ:
Once σ is obtained to sufficient accuracy evaluate:
 ^{[2]}
 ^{[2]}
 ^{[2]}
If the initial point is at the North or South pole, then the first equation is indeterminate. If the initial azimuth is due East or West, then the second equation is indeterminate. If a double valued atan2 type function is used, then these values are usually handled correctly.
Vincenty's modification
In his letter to Survey Review in 1976, Vincenty suggested replacing his series expressions for A and B with simpler formulas using Helmert's expansion parameter k_{1}:
where
Nearly antipodal points
As noted above, the iterative solution to the inverse problem fails to converge or converges slowly for nearly antipodal points. An example of slow convergence is (Φ_{1}, L_{1}) = (0°, 0°) and (Φ_{2}, L_{2}) = (0.5°, 179.5°) for the WGS84 ellipsoid. This requires about 130 iterations to give a result accurate to 1 mm. Depending on how the inverse method is implemented, the algorithm might return the correct result (19936288.579 m), an incorrect result, or an error indicator. An example of an incorrect result is provided by the NGS online utility, which returns a distance that is about 5 km too long. Vincenty suggested a method of accelerating the convergence in such cases (Rapp, 1973).
An example of a failure of the inverse method to converge is (Φ_{1}, L_{1}) = (0°, 0°) and (Φ_{2}, L_{2}) = (0.5°, 179.7°) for the WGS84 ellipsoid. In an unpublished report, Vincenty (1975b) gave an alternative iterative scheme to handle such cases. This converges to the correct result 19944127.421 m after about 60 iterations; however, in other cases many thousands of iterations are required.
Newton's method has been successfully used to give rapid convergence for all pairs of input points (Karney, 2013).
See also
 Geographical distance
 Greatcircle distance
 Meridian arc
 Geodesics on an ellipsoid
 Thaddeus Vincenty
 Geodesy
Notes
 ↑ σ isn't evaluated directly from sin σ or cos σ to preserve numerical accuracy near the poles and equator
 ↑ ^{2.0} ^{2.1} ^{2.2} ^{2.3} ^{2.4} ^{2.5} ^{2.6} The arctan quantity should be evaluated using a two argument atan2 type function.
 ↑ If sin σ = 0 the value of sin α is indeterminate. It represents an end point equal to, or diametrically opposite the start point.
 ↑ The start and end point are on the equator. In this case, C = 0 so the value of is not used. The limiting value is .
References
 Bessel, F. W. (2010). "The calculation of longitude and latitude from geodesic measurements (1825)". Astron. Nachr. 331 (8): 852–861. arXiv:0908.1824. doi:10.1002/asna.201011352. English translation of Astron. Nachr. 4, 241–254 (1825).<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 Helmert, F. R. (1964). Mathematical and Physical Theories of Higher Geodesy, Part 1 (1880). St. Louis: Aeronautical Chart and Information Center. Retrieved 20110730. English translation of Die Mathematischen und Physikalischen Theorieen der Höheren Geodäsie, Vol. 1 (Teubner, Leipzig, 1880).<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 Karney, C. F. F. (2013). "Algorithms for geodesics". Journal of Geodesy. 87 (1): 43–42. arXiv:1109.4448. Bibcode:2013JGeod..87...43K. doi:10.1007/s001900120578z (open access). Addenda.CS1 maint: ref=harv (link)<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 Legendre, A. M. (1806). "Analyse des triangles tracės sur la surface d'un sphėroïde". Mém. de l'Inst. Nat. de France (1st sem.): 130–161. Retrieved 20110730.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 Rainsford, H. F. (1955). "Long geodesics on the ellipsoid". Bulletin géodésique. 37: 12–22. Bibcode:1955BGeod..29...12R. doi:10.1007/BF02527187.CS1 maint: ref=harv (link)<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 Rapp, R. H. (March 1993). Geometric Geodesy, Part II (Technical report). Ohio State University. Retrieved 20110801.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 Vincenty, T. (April 1975a). "Direct and Inverse Solutions of Geodesics on the Ellipsoid with application of nested equations" (PDF). Survey Review. XXIII (misprinted as XXII) (176): 88–93. doi:10.1179/sre.1975.23.176.88. Retrieved 20090711.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 Vincenty, T. (April 1976). "Correspondence". Survey Review. XXIII (180): 294.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 Vincenty, T. (August 1975b). Geodetic inverse solution between antipodal points (Technical report). DMAAC Geodetic Survey Squadron. doi:10.5281/zenodo.32999.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
 Geocentric Datum of Australia (GDA) Reference Manual (PDF). Intergovernmental committee on survey and mapping (ICSM). February 2006. ISBN 0957995105. Retrieved 20090711.<templatestyles src="Module:Citation/CS1/styles.css"></templatestyles>
External links
 Online calculators from Geoscience Australia:
 Vincenty Direct (destination point)
 Vincenty Inverse (distance between points)
 Calculators from the U.S. National Geodetic Survey:
 Online and downloadable PCexecutable calculation utilities, including forward (direct) and inverse problems, in both two and three dimensions (accessed 20110801).
 Online calculators with JavaScript source code by Chris Veness (Creative Commons Attribution license):
 Vincenty Direct (destination point)
 Vincenty Inverse (distance between points)
 GeographicLib provides a utility GeodSolve (with MIT/X11 licensed source code) for solving direct and inverse geodesic problems. Compared to Vincenty, this is about 1000 times more accurate (error = 15 nm) and the inverse solution is complete. Here is an online version of GeodSolve.