Associated Topics || Dr. Math Home || Search Dr. Math

### Find the Bearing

```Date: 01/17/2003 at 19:47:43
From: Richard
Subject: A formula to find the bearing of one point from another.

Is there a formula to find the bearing of one point from another on a
2D map (or graph) just using normal co-ordinate systems? (I want to
avoid talking about the great circle (it's 2D) and longitude and
latitude.)

```

```
Date: 01/17/2003 at 20:32:42
From: Doctor Rick
Subject: Re: A formula to find the bearing of one point from another.

Hi, Richard.

Do you mean a Cartesian x-y coordinate system, calibrated the same in
x and y directions (unlike latitude-longitude, in which a minute of
longitude is a different distance from a minute of latitude)? If so,
then the basic formula is pretty easy. The bearing from point (x1,y1)
to point (x2,y2), in degrees east of north, is

bearing = 90 - arctan((y2-y1)/(x2-x1))

This will always give an angle between 0 and 180 degrees (assuming
your arctan function returns degrees). You need to adjust it to take
account of the orientation of the line. I think this will do the job:

dx = x2-x1
dy = y2-y1
if dx > 0 then
bearing = 90 - arctan(dy/dx)
if dx < 0 then
bearing = 270 - arctan(dy/dx)
if dx = 0 then
if dy > 0 then bearing = 0
if dy < 0 then bearing = 180
if dy = 0 then point 1 = point 2 and there is no bearing

If you are programming and you have a function atan2(y,x), all this
is handled for you. Most likely atan2 returns an angle in radians, so
I'll put in the conversion to degrees:

bearing = 90 - (180/pi)*atan2(y2-y1, x2-x1)

Note: Sometimes (as in Excel) atan2 takes switched arguments:
atan2(x,y).

- Doctor Rick, The Math Forum
http://mathforum.org/dr.math/
```

```
Date: 01/18/2003 at 07:39:21
From: Richard
Subject: Thank you (A formula to find the bearing of one point from
another.)

Thanks very much for that!
```
Associated Topics:
College Coordinate Plane Geometry
College Higher-Dimensional Geometry

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search