# Two objects moving at a constant velocity. Find direction so they collide.

1. Oct 4, 2009

### FUR10N

1. The problem statement, all variables and given/known data
There is one particle traveling at a constant velocity. Its velocity vector and initial position are known.
A second particle needs to collide with the first particle. We know the initial position of this particle, and the speed (magnitude of velocity).
Find the direction that the second particle needs to head in the hit the first particle.
We can assume the second particle is moving much faster than the first particle, so there will never be a case where the second particle cannot reach the first particle.

Example: Object A is moving in a straight line and we are trying to "shoot" another object at A so that they collide (like leading a moving enemy in a firefight).

2. Relevant equations
Let $$p_{1}$$ be a particle with a constant velocity
$$v_{1}$$ is the vector for the initial velocity of that particle.
Position: $$p_{1} = p_{1_{0}} + v_{1}*t$$
We know everything there is to know about $$p_{1}$$ (it's initial position and its velocity vector)

Let $$p_{2}$$ be another particle with a constant velocity
$$v_{2}$$ is the vector for the initial velocity of that particle.
Position: $$p_{2} = p_{2_{0}} + v_{2}*t$$
We know the initial position of this particle as well as the magnitude of its velocity. So given its speed and the other objects velocity: what would the direction need to be so that they collide.

3. The attempt at a solution
When the collision happens $$p_{1} = p_{2}$$; so $$p_{1_{0}} + v_{1}*t = p_{2_{0}} + v_{2}*t$$

We do not know $$t$$ or $$v_{2}$$ but we do know $$\sqrt{v_{2_{x}}^{2} + v_{2_{y}}^{2}}$$

I tried splitting up the position equation into an equation for x and a separate equation for y.

After that I solved for $$v_{2_{x}}$$ and $$v_{2_{y}}$$ and then plugged it into the equation for the magnitude.

I simplified it but it was really complex and I couldn't solve for $$t$$.
I'm not sure what to try next.

p.s. This is an informal question; it's possible that the problem is unsolvable. Also, I can draw a picture and scan it in if necessary.

2. Oct 4, 2009

### Delphi51

It strikes me that you are supposed to continue using the vectors rather than splitting them up into x and y. I think an answer with those vectors in it is called for. I played with it a bit. First off, their positions are equal when they collide, so with t the time of collision you have
P1 = P2
P10 + V1*t = P20 + v2*t (1)
I then solved (1) for t to get an expression for the time of collision. (2)
I also solved it for the thing we want, v2. (3)
I subbed (2) into (3) to eliminate the time. Unfortunately the expression for v2 now has another v2 on the right and side so a bit more work is needed to actually solve it for v2.

3. Oct 4, 2009

### FUR10N

I was playing around with equation (2), the one you got by solving the position equation for t; and I saw that t = some vector divided by another vector. So there is not really anything we can do with that right?

Also, when you substitute (2) into (3), both of the those equation were derived from the same equation so after simplifying you are left with v2 = v2.

If this is solvable, I know that the magnitude of v2 will have to be used somewhere. If we don't use that information then there will be infinitely many solutions (the speed that p2 is projected at will determine the direction it needs to go).

The problem now is that every time I've tried to incorporate the magnitude I'm left with an insanely complex unsolvable equation.
One attempt:
k = |v2|; we know what k is.
Solved |v2| for v2x
Got: $$v2x = \sqrt{k^{2} + v2y^{2}}$$
I then substituted that into some of the other equations and that's when I got stuck.

Edit: I also get the feeling that somewhere in all of this I will need to use Calculus. I just don't know what and where. Any ideas?

Last edited: Oct 4, 2009
4. Oct 4, 2009

### Delphi51

Wow, I must have been sleepy last night and you are very alert this morning! I'm now convinced that we have to go with the x and y components all right. I like your k and am also using h = magnitude of V1.
So v2 = (k*cos B, k*sinB), v1 = (h*cos A, h*sin A)
We are trying to find B.
I wrote out that the two x coords are equal at collision time t:
P10x + h*cos(A)*t = P20x + k*cos(B)*t [1]
and the same for the two y coords. [2]
Eliminated t between these two equations and got a really long mess. Collected all the cos B and sin B terms together and the mess simplified quite a bit by introducing known constants
c = P10x - P20x and d = P20y - P10y
That left kc*sin(B) + kd*cos(B) = hc*sin(A) - hd*cos(A). [6]
So we can easily calculate c*sin(B) + d*cos(B) from the given information. But how to find B?
It seems to be crying out for some trig identity and I immediately thought of sin(a+b) = cos(a)*sin(b) + sin(a)*cos(b) but on second thought we can't let c = cos(a) because c may well be much larger than 1. It may not have a "nice" solution, but certainly one could find the angle B by graphing c*sin(B) + d*cos(B) as a function of B and searching numerically for the value of B that makes it equal the correct value.

I never doubted that there was a solution. After all, a hunter can compute the solution in a second.

5. Oct 4, 2009

### FUR10N

I think I understand it all now.
So, I came up with some simple numbers just to see:

P1 = (0,4)
V1 = <1,0>

P2 = (3,0)
|V2| = 2

c = -3
d = -4
k = 2
h = 1
B = ?
A = 0

After solving your final equation I ended up with
-3sinB + -4cosB = (-3sin0 + 4cos0)/2
simplified to: -3sinB + -4cosB = 2
I solved this equation with a TI-89 and got B = 150.448 degrees

Using that value for B I graphed the positions of everything, and it was correct! (they collide at ~2sec at ~p(2,4))

I still need to do a little more work to the equations before I'm completely finished (I'm hoping to automate the process). Anyway, thank you so much for your help, I think I'm in the clear now.
Also, this problem ended up being way more complex than I imagined it could ever be.

6. Oct 4, 2009

### Delphi51

Indeed a terrific problem! If you find an elegant solution for that final trig equation, please let me know.

7. Oct 4, 2009

### FUR10N

Will do. I've been in the library drinking coffee working on this for the past 6 hours though, so I'm gonna get some sleep. Once I get a presentable result I'll post it.

8. Oct 5, 2009

### FUR10N

$$B=-90*(asin((cos(a)*d + sin(a)*c)*h/(\sqrt{c^2+d^2}*k))*pi/90-atan(c/d)*pi/90+(sign(d)-2*(2*i+1))*pi)/(pi)$$

where sign(d) = the sign of d
and i = any positive integer

p.s. there is also a negative version of this equation, just multiply the right side by -1

After solving that I get 690 degrees.
690 - 360 = 330
330 is 180 degrees off from the real answers, which leaves be to believe that I missed a sign or something somewhere through all of this.

Anyway, that's basically it. And yes, that has got to be the most hideous thing I have ever seen before.

When I get back to my dorm I'm going to scan the written out version of the equation and post it (it looks slightly nicer); the thing I posted up there is basically incomprehensible for all intents and purposes.

Edit: it's highly likely that I made a typo in the above equation

9. Oct 5, 2009

### Delphi51

Wow! I am very interested in knowing how you did that.

10. Oct 5, 2009

### FUR10N

The TI-89 has a ridiculously crazy-awesome Algebra System built in.
All I did was use the "solve()" function on the equation you had posted.
It took about 5 seconds to calculate and gave me that monstrous equation.
As for how to accomplish that by hand: I have absolutely no idea.

On another note, I'm working on programming this equation into a simulator I'm writing.
I'm calculating the angle B on the fly based on varying systems, and it's working correctly for the most part! I've just got to work out a few more bugs.

11. Oct 5, 2009

### Delphi51

Most interesting!
I do programming so I could easily write something to solve for the angle. But having a computer come up with the formula boggles my mind.

12. Oct 5, 2009