# What is a method for determining the radius of a sphere from distances between points of right triangles on it?

Suppose there are two right triangles formed by points {U, V, W1} and {U, V, W2} on the surface of a sphere. The distances between these points form the sides of the triangles, a, b1, c1 and a, b2, c2, where U-V is a, V-W# is b#, and U-W# is c#. The angles C1 & C2 are opposite from sides c1 & c2, and both are 90 degrees.

We seek to determine a precise value for R, the radius of the sphere upon whose surface these triangles exist.

Based on the spherical law of cosines, we can make the following assumptions in the form of equations:

(1) cos(c1/R) = cos(a/R) * cos(b1/R)

(2) cos(c2/R) = cos(a/R) * cos(b2/R)

(Since cosine is a transcendental function, we cannot extract out R by itself from these equations.)

Now, if we know the values for c1, a, and b1, then due to the periodic nature of cosine, there are many possible valid values for R that will satisfy the equation. I.e. if c1 = 4140, a = 3069, and b = 2765, then R can be 2.05 and the equation will be true.

However, since we know that c1, a, and b1 are sections of the great circle whose radius is R, then we know that R can never be less than c1. Still though, if we restrict R to being greater than c1, we still get many possible correct values for R: 228,974,671.337 works; 1,553,282,877.94 also works... and many others.

However, since we must find an R that will work for both (1) and (2), is there any relationship (ratio) between c2 and c1, and between b2 and b1, that would allow us to eliminate all but one valid value for R? If so, what is it?

If not, if we add yet a third right triangle with a new point W3, would this new triangle allow us now to divine a single possible value for R?

(I am trying to devise a way to map things inside a video game that has no coordinate system or means of measuring angles other than right angles available to the player, but does give waypoint distances. Sadly my math isn't strong enough to figure this out.)

Note: I have reworded the question from its original form, which had been related to the determination of coordinates. I realized after further research that determination of the radius is a prerequisite to determining coordinates. Once you know the radius, then the coordinates become relatively simple to determine, so I rewrote the question in terms of radius.

• Distance between points $U$ and $V$ seems to be the length of the shortest path between $U$ and $V$. However what is the shortest path in your case, the path restricted to the surface on the sphere or the direct path through 3D? – mvw May 8 '17 at 5:10
• Restricted to the surface. For most intents and purposes this is a 2D problem, I don't even know if it matters that we're on the surface of a sphere. We're mapping a fairly localized area (like mapping the state of Texas) but sometimes planet sizes can be kinda small so curvature might play a role. – CommaToast May 8 '17 at 5:32
• Restricting "distances" surface distances, having the differences such as D1A-D1B etc.. then the equations are fairly easy in either the plane or sphere. The problem is that in this case, some configurations of O, A, B, C and D1 give multiple solutions. I have solved this before but if you really want P1 to be random in space I doubt if you can avoid multiple solutions for a set of 4 numbers; but I am not sure, since you stated that you actually know the absolute distances to P1. P.S. there are exact solutions on the surface for some configurations. I can give more details. – rrogers May 8 '17 at 17:21
• @rrogers Thank you. I have added to the original question a restriction that the distance from O to P1 will always be less than one eighth of the circumference of the great circle of the sphere whose surface P1 is a point on. Hopefully that would be a configuration for which there are exact solutions. I look forwards to your answer sir. – CommaToast May 8 '17 at 21:56
• You know the radius of your sphere, right? – Lubin May 9 '17 at 3:16

I find this a very interesting and amusing problem. I believe that it should be possible to find the radius from the linear measure of the three sides of a single right spherical triangle; let me justify that belief.

Since I’m going to talk about only one right spherical triangle, I’ll call the legs $a$ and $b$, the hypotenuse $c$. My insight, such as it is, comes from considering the case of an isosceles right triangle, $a=b$. Then for very small triangles, $c$ is very nearly $\sqrt2a$, but definitely less. (If we had equality, the surface would be flat, i.e. Euclidean, with “infinite radius”.) On the other if $c=a$, we’d be dealing with an octant right triangle, all angles $\pi/2$, and $a=\frac\pi2R$, $R=2a/\pi$. Finally, if $c$ is very small in comparison to $a=b$, the legs would be nearly $\pi R$, $R\approx a/\pi$. Thus it seems “obvious” that as $c/a$ decreases from $\sqrt2$ to $0$, the radius will also decrease from infinite down to $a/\pi$. And this seems sure to be a monotone relationship, thus with a unique solution.

Now let’s look at your problem. Given your three measurements $a$, $b$, and $c$, you want to adjust $R$ so that the angles $\alpha=a/R$, $\beta=b/R$, and $\gamma=c/R$ satisfy the spherical Pythagorean Theorem $\cos\gamma=\cos\alpha\cos\beta$. To do a numerical problem it seemed to me most sensible to introduce a variable $t=1/R$, and find a root of the basic function $$f(t)=\cos(at)\cos(bt)-\cos(ct)\,.$$ I decided to use $a=0.6$, $b=0.8$, and for $c$ I chose something smaller than $1.0$, namely $c=0.95$, and I thought I’d do a Newton-Raphson approximation. I’m sure you can get this sort of thing automated, but I did it almost by hand, with my HP15-c. Of course I used $f'(t)=-a\sin(at)\cos(bt)-b\sin(bt)\cos(at)+c\sin(ct)$. I started with the guess $t=1$, and the fifth iteration gave me nine decimal digits of accuracy, with $t=1.085162010$, and thus $R=.921521387\,$.

I would be greatly surprised if one could get a solution in closed form by messing with some combination of inverse trigonometric functions, so the method of successive approximation is probably as good as you can get. Once it was programmed, it wouldn’t be at all demanding on the computation abilities of any computer.

• Lubin: "the case of an isosceles right triangle, $a=b$. Then for very small triangles, $c$ is nearly $2–\sqrt{a}$, but definitely less. (If we had equality, the surface would be flat, i.e. Euclidean, with “infinite radius”.)" -- That's alright for the OP stipulation that the given surface is spherical. But on a surface with negative Gaussian curvature $K$ the hypothenuse of an isosceles right triangle could be as large as (almost) approaching $2~a$. The relation is monotonous throughout; but I don't know how to solve for $K$ explicitly. – user12262 May 20 '17 at 5:56
• I’m sorry, @user12262, but you have misquoted me. I said “nearly $\sqrt2a$”, maybe for clarity I should have put $a\sqrt2$. Of course OP is solely interested in spheres, for his game. For hyperbolic geometry, what you say is right, when the legs are both equal to $a$, the necessary inequalities are $a\sqrt2<c<2a$, compared to the inequalities $0<c<\sqrt2a$ for the spherical case. – Lubin May 20 '17 at 17:53
• Lubin: "I'm sorry, user12262, but you have misquoted me." -- My mistake, I am sorry! (It seems that by cutting/pasting your "$\sqrt{2} a$" into my editor the order of symbols got scrambled, the minus sign inserted; and since I wasn't expecting any of this, I didn't pay enough attention and ended up with the misquote. Very sorry, again.) "Of course OP is solely interested in spheres, for his game." -- Sure. Still: The function $$\frac{1}{\sqrt{K}} \, \text{ArcCos}[ \, (\text{Cos}[ \, \sqrt{K} \, ])^2 \, ]$$ seem monotonous without having to distinguish the case $K < 0$ from case $K \ge 0$. – user12262 May 21 '17 at 7:10

Let's say you have a triangle $\triangle ABC$ on the surface of a sphere $S$; notice this means the sides $AB$, $BC$ and $AC$ of the triangle are arcs on $S$.

Choose any vertex on the triangle, say $A$. The sides $AB$ and $AC$ determine two non-parallel vectors that are tangent to $S$ at $A$; in other words, they define the plane $T_AS$ tangent to $S$ at $A$. From the plane, we may extract the vector $\mathbf{n}_A$ normal to $S$ at $A$. We hence have a line $l_A(t)=A+t\cdot n_A$ upon which lies the center $O$ of $S$.

If we repeat this construction for some other vertex, say $B$, we will obtain yet another line $l_B$ upon which lies the center of $S$. At this point we need only find their intersection to fully determine $O$, and the radius can then be recovered from the length of $OA$.

• I'm afraid I don't quite follow. What does little t stand for? Also, when you say "at this point we need only find their intersection", the only intersection point I can think of for lb and la, is O. If you would give an example perhaps with a diagram, I think it might help. – CommaToast May 17 '17 at 18:00
• $t$ is parameter in the parametrization of the line; see for instance this link. The intersection point for $l_B$ and $l_A$ is precisely the center $O$ of the sphere. Does this help? – Fimpellizieri May 17 '17 at 18:06
• If I see it correctly for this to work you need "access " to the 3rd dimension (without this no normal vector) what if that access is not possible? – Willemien Aug 31 '17 at 18:53
• What do you mean by 'access'? Isn't the sphere lying on 3D space? – Fimpellizieri Aug 31 '17 at 21:17