Skip to main content
Home
plus.maths.org

Secondary menu

  • My list
  • About Plus
  • Sponsors
  • Subscribe
  • Contact Us
  • Log in
  • Main navigation

  • Home
  • Articles
  • Collections
  • Podcasts
  • Maths in a minute
  • Puzzles
  • Videos
  • Topics and tags
  • For

    • cat icon
      Curiosity
    • newspaper icon
      Media
    • graduation icon
      Education
    • briefcase icon
      Policy

      Popular topics and tags

      Shapes

      • Geometry
      • Vectors and matrices
      • Topology
      • Networks and graph theory
      • Fractals

      Numbers

      • Number theory
      • Arithmetic
      • Prime numbers
      • Fermat's last theorem
      • Cryptography

      Computing and information

      • Quantum computing
      • Complexity
      • Information theory
      • Artificial intelligence and machine learning
      • Algorithm

      Data and probability

      • Statistics
      • Probability and uncertainty
      • Randomness

      Abstract structures

      • Symmetry
      • Algebra and group theory
      • Vectors and matrices

      Physics

      • Fluid dynamics
      • Quantum physics
      • General relativity, gravity and black holes
      • Entropy and thermodynamics
      • String theory and quantum gravity

      Arts, humanities and sport

      • History and philosophy of mathematics
      • Art and Music
      • Language
      • Sport

      Logic, proof and strategy

      • Logic
      • Proof
      • Game theory

      Calculus and analysis

      • Differential equations
      • Calculus

      Towards applications

      • Mathematical modelling
      • Dynamical systems and Chaos

      Applications

      • Medicine and health
      • Epidemiology
      • Biology
      • Economics and finance
      • Engineering and architecture
      • Weather forecasting
      • Climate change

      Understanding of mathematics

      • Public understanding of mathematics
      • Education

      Get your maths quickly

      • Maths in a minute

      Main menu

    • Home
    • Articles
    • Collections
    • Podcasts
    • Maths in a minute
    • Puzzles
    • Videos
    • Topics and tags
    • Audiences

      • cat icon
        Curiosity
      • newspaper icon
        Media
      • graduation icon
        Education
      • briefcase icon
        Policy

      Secondary menu

    • My list
    • About Plus
    • Sponsors
    • Subscribe
    • Contact Us
    • Log in
    • Lost but lovely: The haversine

      4 July, 2014

      Sine, cosine, and tangent — we do love our trigonometric functions! So imagine our bliss when we recently came across a function we had never even heard of before. It's called the haversine and it's defined in terms of the sine function:

      haversin(θ)=sin2⁡(θ/2).
      Great circle distance

      The dotted yellow line is an arc of a great circle. It gives the shortest distance between the two yellow points. Image courtesy USGS.

      The term "haversine" apparently comes from "half versed sine". To see why this function is useful, put yourself in the shoes of an intrepid traveller setting out on a sea voyage from Liverpool to New York. The first thing you'd want to know is how far you will have to travel. Ignoring islands, rocks, currents and other inconvenient factors, let's say that you will travel along the shortest path between the two cities. We know that the shortest path between two points is along a straight line, but that fact doesn't help you here. The straight line that connects Liverpool and New York cuts right through the Earth and you are not about to dig a tunnel.

      You need the shortest path on the surface of the Earth, which is roughly spherical. On a sphere the shortest path between two points is along an arc of a great circle: that's a circle drawn on the surface of the sphere which is centred on the same point as the sphere and has the same radius. Any two points lie on a unique great circle, which they divide up into two arcs. The shortest path between the points is along the shorter of these two arcs.

      So how do you calculate this great circle distance between two points P and Q on the Earth? First, recall that the locations of the two points are given by their latitudes, for which we will write ϕP and ϕQ, and their longitudes, which we will denote by λP and λQ. Write R for the radius of the Earth, which is roughly 6,371 km. The great circle distance d between P and Q comes from the formula sin2⁡(d2R)=sin2⁡(ϕ2−ϕ12)+cos⁡ϕ1cos⁡ϕ2sin2⁡(λ2−λ12), (where the angles are measured in radians). Solving for d gives d=2Rsin−1⁡(sin2⁡(ϕ2−ϕ12)+cos⁡ϕ1cos⁡ϕ2sin2⁡(λ2−λ12)). You'll admit that this isn't the simplest of formulae. If you were are a seafarer hundreds of years ago, armed only with sine and cosine tables to help you, working out the distance d would prove pretty cumbersome. There's a square root to take, as well as the inverse of the sine function .... argh! But now let's replace any expressions of the form sin2⁡(θ/2) by the haversine function. Expression (1) above becomes haversin(dR)=haversin(ϕ2−ϕ1)+cos⁡ϕ1cos⁡ϕ2haversin(λ2−λ1). The distance d is now d=Rhaversin−1(haversin(ϕ2−ϕ1)+cos⁡ϕ1cos⁡ϕ2haversin(λ2−λ1)). Working out the great circle distance between two points is so important in navigation that people in the old days produced tables giving the values of the haversine function and also of the inverse of the haversine function. This made seafarers' lives a lot easier. Working out the distance d only involved looking up two cosine values and two haversine values, adding and multiplying them in the correct way, looking up the inverse of the haversine function and multiplying by R— done! The reason why the haversine function has come out of fashion is that with the help of calculators and computers it's easy enough to work out the distance d straight from formula (2). That's why you don't find a haversine button on your average calculator. Let's give it a go. Liverpool has latitude 53.4∘ and longitude −3∘, and New York has latitude 40.71∘ and longitude −74∘. These are measured in degrees. Converting them into radians (multiplying by π/180) gives ϕL=0.932∘ and λL=−0.052∘ for Liverpool, and ϕNY=0.71∘ and λNY=−1.291∘ for New York (rounded to three decimal places) Plugging these into expression (2), with the radius of the Earth R=6371, gives a great circle distance of around 5313 km. Quite a way to go!
      Read more about...
      trigonometry
      navigation
      • Log in or register to post comments

      Örjan Sandström

      19 November 2016

      Permalink

      Actually haversine in navigation is still evolving.
      Hanno Ix and Greg Rudzinski reworked an old method of celestial navigation (Doniol) to get a very compact system with few sources of error, it utilizes ONLY haversines to solve the pzx triangle for both computed height
      -almost same as great circle distance for stars if you disregard atmospheric refraction, oblatenes of earth and other real world inconveniences-

      and azimuth to the projectionbject altitude With only addition, subtraction and one division.
      This acievement does not sound like much, but for a lightly seasick sleepdeprived person in the cramped and frequently badly iluminated confines of a small craft it reduces error sources...

      • Log in or register to post comments

      Read more about...

      trigonometry
      navigation
      University of Cambridge logo

      Plus is part of the family of activities in the Millennium Mathematics Project.
      Copyright © 1997 - 2025. University of Cambridge. All rights reserved.

      Terms