This week's book giveaway is in the Agile forum. We're giving away four copies of The Software Craftsman and have Sandro Mancuso on-line! See this thread for details.

The angles of an equilateral triangle drawn on the surface of a sphere vary depending on the length of the sides relative to the size of the sphere. e.g. If the triangle sides are much less than the radius of the sphere (1 meter on the surface of the Earth) then the angles are very nearly 60 deg.

Granted the sides of the triangle aren't really straight since they have to curve in 3D to follow the surface. Let's say the sides of the triangles are "straight" in that they each lie along the intersection of the sphere and a plane that includes the center of the sphere.

1. What are the minimum and maximum angles for an equilateral triangle drawn on a sphere?

2. How long are the sides of such a triangle if the angles are 90 deg?

3. What is the general formula relating the side length and the angle?

I'm sure, without having tried, that it would be easy to google for the answers. But let's see if you can derive the answers yourself. I'm going to.

example - start at the South pole. Head due north (which , really, is any direction, but let's assume along the prime meridian. When you get to the equator, turn East.

At the same time, someone else head due North 90 degrees away. the also walk to the equator, and turn West. clearly they will meet somewhere along there.

all three angles were 90 degrees.

Granted the sides of the triangle aren't really straight since they have to curve in 3D to follow the surface.

Now, that all depends on your definition of 'straight', doesn't it? they may not be straight according to a standard 3D (x,y,z) coordinate system, but I would say that within the rules of a non-euclidean geometry, they are absolutely straight.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors

1. Hm, depends a bit how we define the domain. One could say the angle between sides ranges from 60° to 300°. Though really, once it reaches 180°, we don't have a "triangle", but a circle - a great circle, like the equator. And for angles > 180° and <= 300°, it makes more sense to most people to measure the angle on the other side instead.

2. What Fred said.

3. If x is the angle subtended by each side and y is the interior angle of each corner of the "triangle", then I get

cos(y) = cos(x) / (1 + cos(x))

Which seems to work for key sample values:

It's undefined for larger x, which seems appropriate.