# Distance between planet and vessel - Trig problem

## Main Question or Discussion Point

Hello. Up until this point I have been solving this numerically, by propagating the state vectors and checking for a collision, however that is inefficient, so I would like an analytic solution.

Given lengths r, and d, as well as angle t, is there a way to find length s?

## Answers and Replies

Can you elaborate? I was looking at the law of cosines prior to posting this thread, but I couldn't find a solution. I thought you need at least two angles? I only have one.

Mentallic
Homework Helper
The sine rule requires 1 side and 2 angles, the cosine rule requires 2 sides an 1 angle.

$$c^2=a^2+b^2-2ab.cosC$$

a, b, c are the side lengths of the triangle and C is an angle. The angle C is opposite the side c.

Now all you need to do is substitute C=t, c=r, and it's your choice whether a=d and b=s or the other way round. It doesn't matter. Now just manipulate the formula to have s=f(r,d,t).

Mark44
Mentor
The Law of Cosines requires two sides and the included angle, if I'm recalling this correctly. The Law of Sines can be used for one side and two angles or two sides and one angle.

You can use the Law of Sines to get the angle between r and s, after which you can get the third angle. Since the angle between r and s appears in your drawing to be oblique, you'll need to take that into account when you solve for it, using the identity sin(pi/2 + x) = sin(pi/2 - x).

After you have all three angles you can use the Law of Cosines or the Law of Sines to find the unknown side.

The sine rule requires 1 side and 2 angles, the cosine rule requires 2 sides an 1 angle.

$$c^2=a^2+b^2-2ab.cosC$$

a, b, c are the side lengths of the triangle and C is an angle. The angle C is opposite the side c.

Now all you need to do is substitute C=t, c=r, and it's your choice whether a=d and b=s or the other way round. It doesn't matter. Now just manipulate the formula to have s=f(r,d,t).
Cool, that is the first thing I tried, however I was not able to isolate a:

$$b^2-c^2 = a^2 - 2ac cos t$$
$$b^2-c^2 = a(a-2c cos t)$$

And I have no idea where to proceed from here.

Cool, that is the first thing I tried, however I was not able to isolate a:

$$b^2-c^2 = a^2 - 2ac cos t$$
$$b^2-c^2 = a(a-2c cos t)$$

And I have no idea where to proceed from here.
In my opinion, you could treat the expression as a quadratic with variable "a", and then solve the quadratic using the quadratic formula or completing the square or whatever. That should work I think (and hope :p).

Mark44
Mentor
Cool, that is the first thing I tried, however I was not able to isolate a:

$$b^2-c^2 = a^2 - 2ac cos t$$
$$b^2-c^2 = a(a-2c cos t)$$

And I have no idea where to proceed from here.
As already noted, to use the Law of Cosines, you need two sides and the included angle. That's not what you have in this problem.

In my opinion, you could treat the expression as a quadratic with variable "a", and then solve the quadratic using the quadratic formula or completing the square or whatever. That should work I think (and hope :p).

Redbelly98
Staff Emeritus
Homework Helper
Yup, the quadratic formula will give you the two possible values of a (or s in the original figure). Then you'd have to know whether the angle between r and s is acute or obtuse, as Mark44 suggested earlier, in order to figure out which value of a (i.e. s) is the correct one.

Mentallic
Homework Helper
This seems like a physical collision kind of problem. That is, the line s cannot cut through the circle and connect to r where it touches the circle the second time. This means that the angle between s and r cannot be less than 90o since at 90o the vector s is tangential to the circle so of course by the angle sum of triangles, the other two angles are acute.

Mark, if you can show a way to use your method of going through the sine formula and then the cosine etc. which is easier than plugging straight into the cosine formula and solving that quadratic in s, I'd like to see it

Redbelly98
Staff Emeritus
Homework Helper
This seems like a physical collision kind of problem. That is, the line s cannot cut through the circle and connect to r where it touches the circle the second time.
Ah, good point.
Mark, if you can show a way to use your method of going through the sine formula and then the cosine etc. which is easier than plugging straight into the cosine formula and solving that quadratic in s, I'd like to see it
Note sure exactly how Mark was thinking, but one could follow this procedure:
1. Use the law of sines to find the angle opposite side d (must be ≥90°).
2. Use ∑angles=180° to find the angle opposite s.
3. Use the law of sines to find s.​
This may be less cumbersome than solving the quadratic obtained from the law of cosines.

Mark44
Mentor
Ah, good point.

Note sure exactly how Mark was thinking, but one could follow this procedure:
1. Use the law of sines to find the angle opposite side d (must be ≥90°).
2. Use ∑angles=180° to find the angle opposite s.
3. Use the law of sines to find s.​
This may be less cumbersome than solving the quadratic obtained from the law of cosines.
This is pretty much what I laid out in an earlier post. In step 3 you can use either the Law of Sines or the Law of Cosines, with the latter being applicable because you now know all three angles, one of which is the included angle between the two given sides.

Mentallic
Homework Helper
Ahh ok using the sine rule after would be easier because I tried following your method and using the cosine rule, but there was just way too much trigonometric manipulating to deal with.