 # NavList:

## A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding

Message:αβγ
Message:abc
 Add Images & Files Posting Code: Name: Email:
Law of Cosines
From: Jeff Gottfred
Date: 1995 Dec 18, 17:11 -0700

```O.K., for those who haven't seen it, here is how to derive the classic
formula for Hc from plain ol' high-school plane trig...

First, we need to develop a formula for the law of cosines for spherical
triangles.

As a refresher, the law of cosines for plane triangles is this:

For triangle abc,

a^2 = b^2 + c^2 - 2bc * cos A

With this, you can solve for the length of any side or any angle of a
non-right triangle-- sure would be nice if we could find the same law
for spherical triangles...

Here's how:

O.K. first draw a triangle on a sphere, and then connect the points of
the triangle with the enter of the sphere. Cut out this wedge shaped
piece: (lousy diagram follows)

A
X-----------------------------------------------
\-._                               |\
\ `-._                           | \
\   `-._                       /  |
\     `-._                  /   |
\       `-._             /    |
\         `-._       c/     |b
\           `-._   /      |
\             `-._    /
\           /   `-._/
\     __/_____/--C`-._
B\--/     a          `-._
\                     `-._
\
\
\
\
\
\
\
\
\
\

X is the center of the sphere, and ABC is a spherical triangle on the
surface of the sphere consisting of the arcs a, b, & c.

(I would suggest that you grab a pencil and re-draw this diagram as we
go along... in fact, you probably should do the same thing with the
math..)

Next, we construct a plane triangle AYZ which is perpendicular to the
line XA.

A
X-----------------------------------------------
\-._                               |\ \
\ `-._                          || \ \
\   `-._                      ||  ||
\     `-._                  |   ||
\       `-._             |    | \
\         `-._      c /|    | |
\           `-._   / |    |b \
\             `-._ |  /    |
\           /   |-. /     \
\     __/_____|--C`-._   |
B\--/      a |       `-.|
\         |       ,' Z`-._
\       |     ,'
\     |   ,'
\   | ,'
\ |,'
Y\
\
\
\
\
\

O.K., AY, AZ, and YZ are supposed to be straight lines forming a plane
triangle AYZ that touches the sphere at point A, and sticks out through
the surface of the sphere. The salient bit is that this thing forms two
right triangles XAY and XAZ -- that is AY and AZ are perpendicular to
XA.

In this construction, the arc a is congruent with angle YXZ, and the
angle A is congruent with the angle YAZ. We can therefore write two
equations, one for a and one for A, using the law of cosines for plane
triangles XYZ and AYZ:

YZ^2 = XY^2 + XZ^2 - 2 * XY * XZ * cos a

and

YZ^2 = AY^2 + AZ^2 - 2 * AY * AZ * cos A

As these are both equations for YZ^2, we can write:

XY^2 + XZ^2 - 2 * XY * XZ * cos a = AY^2 + AZ^2 - 2 * AY * AZ * cos A

Subtracting an AY and an AX from bpth sides:

XY^2 - AY^2 + XZ^2 - AZ^2 - 2 * XY * XZ * cos a = - 2 * AY * AZ * cos A

Now, here is the clever bit: because we are dealing with right
triangles, we can write two new equations based on pythagoras:

XY^2 = AX^2 + AY^2

or AX^2 = XY^2 - AY^2

and

XZ^2 = AZ^2 + AX^2

or AX^2 = XZ^2 - AZ^2

Substituting these into the first equation we get:

AX^2 + AX^2 - 2 * XY * XZ * cos a = - 2 * AY * AZ * cos A

collecting AX^2's:

2 * AX^2 - 2 * XY * XZ * cos a = - 2 * AY * AZ * cos A

Subtract -2 AX^2 from both sides:

- 2 * XY * XZ * cos a = -2 * AX^2 - 2 * AY * AZ * cos A

Factoring by -2:

- 2 (XY * XZ * cos a) = -2 (AX^2) - 2 (AY * AZ * cos A)

Factoring cont...:

- 2 (XY * XZ * cos a) = -2 (AX^2 + AY * AZ * cos A)

Divide both sides by -2:

XY * XZ * cos a = AX^2 + AY * AZ * cos A

Subtract and AX^2 from both sides:

XY * XZ * cos a - AX^2 = AY * AZ * cos A

Now divide boths sides by AY * AZ:

XY * XZ * cos a - AX^2
---------------------- = cos A
AY * AZ

Expanding:

XY * XZ * cos a   AX * AX
--------------- - ------- = cos A
AY * AZ        AY * AZ

Now, looking at our construction again, we can see that the following is
true:
AY           AZ
tan c = --;  tan b = --
AX           AX

So, substituting, we can write:

XY * XZ * cos a         1
--------------- - ------------- = cos A
AY * AZ        tan c * tan b

Also, from plane trigonometry we know that

sin X
tan X = -----
cos X

So we can write:

XY * XZ * cos a   cos c * cos b
--------------- - ------------- = cos A
AY * AZ        sin c * sin b

Again, from plane trig, you can see that

AY              AZ
sin c = --; and sin b = --;
XY              XZ

so we can now write:

cos a       cos c * cos b
------------- - ------------- = cos A
sin c * sin b   sin c * sin b

Grouping:

cos a - cos c * cos b
--------------------- = cos A
sin c * sin b

There you have it! the law of cosines for spherical triangles!
If we just juggle it slightly then it looks like the textbook version:

cos a - cos b * cos c
cos A = ---------------------
sin b * sin c

O.K., so now let's use it to derive a formula for Hc:

The nautical triangle (draw it yourself!!) consists of the three sides
co-h (90 minus the height of the body above the horizon),
co-L (90 minus the AP latitude),
co-d (90 minus the declination of the body)
t    (The meridian angle of the body: GHA ~ AP Longitude)

Therefore, we can use the formula above to write:

cos (co-h) - cos (co-L) * cos (co-d)
cos t = ------------------------------------
sin (co-L) * sin (co-d)

Now, because sin (90-x) = cos x; and cos (90-x) = sin x; we can write:

sin Hc - sin L * sin d
cos t = ---------------------
cos L * cos d

Multiplying both sides by cos L * cos d:

cos t * cos L * cos d = sin Hc - sin L * sin d

Now, adding a sin L * sin d from both sides:

sin L * sin d + cos t * cos L * cos d = sin Hc

or, in other words:

Hc = sin^-1 [(sin L * sin d) + (cos L * cos d * cos t)]

Voila! the classic formula for Hc from first principles!!!

Cheers!

Jeff

------------------------------------------------------------------------
This mail list is managed by the majordomo program.
To unsubscribe from this list, send the following message
For help, send the following message to majordom{at}ronin.com: help
------------------------------------------------------------------------

``` Browse Files

Drop Files ### NavList ### What is NavList? ### Join NavList

 Name: (please, no nicknames or handles) Email:
 Do you want to receive all group messages by email? Yes No
You can also join by posting. Your first on-topic post automatically makes you a member. ### Posting Code

Enter the email address associated with your NavList messages. Your posting code will be emailed to you immediately.
 Email: ### Email Settings

 Posting Code: ### Custom Index

 Subject: Author: Start date: (yyyymm dd) End date: (yyyymm dd)