Finding Launch Angle for Two Projectile Collision I'm trying to figure out the general equation for calculating the launch angle of one projectile required when trying to find a collision between that projectile and another. For the equation I've worked out so far, everything is constant/user-defined. I'm also assuming both projectiles are launched at time 0. d_T is the displacement of the target and d_P is the displacement of the projectile.

My initial vectored equations for the motion of the two particles. The user simply specifies the two velocity components for the target, and then the two projectile components are broken from the magnitude into two using sin and cos.

$$d_T= &lt;V_{Tx}t + d_{T0x}, V_{Ty}t + d_{T0y} - \frac{1}{2}gt^2&gt;$$

$$d_P=&lt;V_{P}t\cos(\theta) + d_{P0x}, V_{P}t\sin(\theta) + d_{P0y} - \frac{1}{2}gt^2&gt;$$

Setting the each component equal to the other's respective component:

$$V_{Tx}t + d_{T0x} = V_{P}t\cos(\theta) + d_{P0x}$$
$$V_{Ty}t + d_{T0y} = V_{P}t\sin(\theta) + d_{P0y}$$

Algebra:
$$t(V_{Tx}-V_{P}\cos(\theta)) = d_{P0x} - d_{T0x}$$
$$t(V_{Ty}-V_{P}\sin(\theta)) = d_{P0y} - d_{T0y}$$
$$\frac{d_{P0x}-d_{T0x}}{V_{Tx}-V_{P}\cos(\theta)}=\frac{d_{P0y} - d_{T0y}}{V_{Ty}-V_{P}\sin(\theta)}$$

Now this is where my question comes into play. Is there a way to further manipulate the expression to solve for theta? I tried playing around with it a bit to get
$$\frac{V_{Ty}-V_{P}\sin(\theta)}{V_{Tx}-V_{P}\cos(\theta)}=\frac{d_{P0y} - d_{T0y}}{d_{P0x}-d_{T0x}}$$

where I hoped I could get a sin/cos to get a tan, but no such luck cause of the pesky target velocity. Is there a possible way to algebraically/otherwise way to solve this or do I need to completely reapproach the problem?

Thanks!
Here is how I would solve this.

Let's assume that the target is launched from $(x_0, y_0)$, $x_0 \ge 0$, towards negative $x$ coordinates, at time $t = -t_0$, $t_0 \ge 0$. The muzzle velocity is $v_0$, angle $\theta_0$, and gravity $g$. Wind resistance and coriolis forces are not accounted for. The trajectory of the target projectile is
$$\begin{cases}x_T(t) = x_0 - (t + t_0) v_0 \cos\theta_0\\
y_T(t) = y_0 + t v_0 \sin\theta_0 - (t + t_0)^2 g/2\end{cases}$$

The target projectile reaches ground when $y_T(t) = 0$. (Because the trajectory is a parabola, the $t$ we are interested from is the larger one, if there are two real roots. If there are no real roots, then the target projectile is launched from below the ground level, without the projectile ever reaching ground level.)
Solving $y_T(t_{Z}) = 0$ for $t_{Z}$ yields
$$t_Z = \sin(\theta_0) \frac{v_0}{g} + \frac{\sqrt{\sin(\theta_0)^2 v_0^2 + 2 g y_0}}{g} - t_0$$
Later, when we solve for the time when the intercept is to occur, we need to compare against $t_Z$, to make sure the intercept occurs before the target projectile reaches the ground.

The intercepting projectile is launched from origin $(0,0)$ at time $t=0$ towards positive $x$ coordinates, with muzzle velocity $v_1$, and launch angle $\theta_1$. The trajectory of this intercepting projectile is
$$\begin{cases}x_I(t) = t v_1 \cos\theta_1\\
y_I(t) = t v_1 \sin\theta_1 - t^2 g/2\end{cases}$$
It is easier to do the following calculations if we use $c = \cos\theta_1$ and $\sin\theta_1 = \sqrt{1-c^2}$. The trajectory is then
$$\begin{cases}x_I(t) = t v_1 c\\
y_I(t) = t v_1 \sqrt{1-c^2} - t^2 g/2\end{cases}$$

For the intercept to occur at time $t$, the projectiles' $x$ coordinates must match: $$x_T(t) - x_I(t) = 0$$
Solving for $c$ we get
$$c(t) = \frac{x_0 - (t_0 + t)\cos\theta_0 v_0}{t v_1}$$
The launch is only possible when $-1 \le c(t) \le 1$. Solving for $t$ we get
$$\begin{align} c(t_{min}) =&amp; 1 &amp;\iff&amp; t_{min} = \frac{x_0 - t_0 v_0 \cos\theta_0}{v_0 \cos\theta_0 + v_1}\\
c(t_{max}) =&amp; -1 &amp;\iff&amp; t_{max} = \frac{x_0 - t_0 v_0 \cos\theta_0}{v_0 \cos\theta_0 - v_1}\end{align}$$

Using the cosine of launch angle $c(t)$ to intercept the target projectile at time $t$, the projectiles' $y$ coordinates must be equal at $t$ for them to collide:
$$y_T(t) = x_T(t), c = c(t)$$
This can be solved for $t$; it is just a quadratic equation in a funny form, with lots of terms. Move all terms to the left side, and the square root to the right side, square both sides, and move the right side back to left, and you end up with a quadratic equation in $t$. There are quite a few terms in it, though.

The two roots are of form
$$t = \frac{q \pm \sqrt{s}}{d}$$
where
$$d = 2 (g^2 t_0^2 - 2 v_T g t_0 \sin\theta_0 + v_0^2 - v_1^2)$$
$$q = v_0 (3 g t_0^2 - 2 y_0) \sin\theta_0 + 2 v_0 x_0 \cos\theta_0 - t_0(g^2 t_0^2 - 2 g y_0 + 2 v_0)$$
$$s = t_0^2 (g^2 t_0^2 v_1^2 - 4 g^2 x_0^2 - 4 g v_1^2 y_0 + 4 v_1^2 v_0^2)
    + 4 v_1^2 x_0^2 + 4 v_1^2 y_0^2 - 4 v_0^2 x_0^2
    + 4 t_0 v_0 x_0 (g^2 t_0^2 + 2 g y_0 - 2 v_1^2) \cos\theta_0
    - v_0^2 (g t_0^2 2 x_0 + 2 y_0)(g t_0^2 - 2 x_0 + 2 y_0) (\cos\theta_0)^2
    - 4 v_0^2 x_0 (g t_0^2 + 2 y_0)(\cos\theta_0)\sin\theta_0
    - 4 v_0 t_0 (g t_0^2 v_1^2 - 2 g x_0^2 - 2 v_1^2 y_0)\sin\theta_0$$

If $\max(0, t_{min}) &lt; t &lt; \min(t_Z, t_{max})$, then $t$ is a valid time for the collision to occur. If both $t$ are valid, you can pick one -- the earlier one is the obvious choice. (This can occur when the intercepting launcher is positioned correctly to hit the target projectile both when it is ascending, and when it is descending, I believe.)

The intercepting launcher angle is then trivially solved from $c(t)$, i.e.
$$\theta_1 = \arccos\left( \frac{x_0 - (t_0 + t)\cos\theta_0 v_0}{t v_1} \right)$$

Remember, interception launch always happens at time $t = 0$; the $t$ above is the time of the collision.



All this math is dull without example code.

Consider this simple awk script, example.awk:

#!/usr/bin/awk -f
function x_T(t)   { return x_0 - (t + t_0) * v_0 * cos_T }
function y_T(t)   { return y_0 + (t + t_0) * v_0 * sin_T - 0.5 * g * (t + t_0) * (t + t_0) }
function x_I(t,c) { return t * v_I * c }
function y_I(t,c) { return t * v_I * sqrt(1 - c*c) - 0.5 * g * t * t }

BEGIN {
    N = 200         # 200 points along the trajectory

    g = 9.81        # Standard gravity, 9.81 m/s^2

    # Target launcher
    x_0 = 1000.0    # 1000 m away
    y_0 = 30.0      # Higher elevation
    a_0 = 30.0      # 30 degree launch angle
    v_0 = 100.0     # 100 m/s muzzle velocity
    t_0 = 5.0       # Fired five seconds ago

    # Intercepting launcher
    v_I = 120.0     # 120 m/s muzzle velocity

    cos_T = cos(a_0 * 3.14159265358979323846 / 180.0)
    sin_T = sin(a_0 * 3.14159265358979323846 / 180.0)

    # In case the target never reaches ground level...
    if (sin_T*sin_T*v_0*v_0 + 2*g*y_0 &lt; 0.0) {
        printf "Target never reaches ground level.\n" &gt; "/dev/stderr"
        exit(0)
    }

    # Time when target projectile hits y(0) (final time)
    t_Z = sin_T * v_0 / g + sqrt(sin_T*sin_T*v_0*v_0 + 2*g*y_0) / g - t_0;
    if (t_Z &lt; 0.0) {
        printf "Target projectile reaches destination %.3f seconds before intercept launch.\n", -t_Z &gt; "/dev/stderr"
        exit(0)
    }

    # Minimum and maximum launch times (with valid launch angle)
    t_min = (x_0 - cos_T*t_0*v_0) / (cos_T * v_0 + v_I)
    t_max = (x_0 - cos_T*t_0*v_0) / (cos_T * v_0)
    if (t_min &lt; 0)   t_min = 0
    if (t_max &gt; t_Z) t_max = t_Z
    if (t_min &gt; t_max) {
        printf "No launch window for interception.\n" &gt; "/dev/stderr"
        exit(0)
    }

    # Coefficients for launch time solutions
    s = t_0*t_0*(g*g*t_0*t_0*v_I*v_I - 4*g*g*x_0*x_0 - 4*g*v_I*v_I*y_0+4*v_I*v_I*v_0*v_0)+4*v_I*v_I*x_0*x_0+4*v_I*v_I*y_0*y_0-4*v_0*v_0*x_0*x_0 + cos_T *4*t_0*v_0*x_0*(g*g*t_0*t_0+2*g*y_0-2*v_I*v_I) - cos_T*cos_T*v_0*v_0*(g*t_0*t_0+2*x_0+2*y_0)*(g*t_0*t_0-2*x_0+2*y_0) - cos_T*sin_T*4*v_0*v_0*x_0*(g*t_0*t_0+2*y_0) - sin_T*4*v_0*t_0*(g*t_0*t_0*v_I*v_I-2*g*x_0*x_0-2*v_I*v_I*y_0);
    d = 2*(g*g*t_0*t_0 - 2*v_0*sin_T*g*t_0 - v_I*v_I + v_0*v_0)
    c = sin_T*v_0*(3*g*t_0*t_0 - 2*y_0) + 2*cos_T*v_0*x_0 - t_0*(g*g*t_0*t_0 - 2*g*y_0 + 2*v_0*v_0)
    if (s &gt;= 0.0 &amp;&amp; d != 0.0) {
        t1 = (c + sqrt(s)) / d
        t2 = (c - sqrt(s)) / d
    } else {
        printf "Interception is not possible.\n" &gt; "/dev/stderr"
        exit(0)
    }

    # Interception time
    if (t1 &gt;= t_min &amp;&amp; t1 &lt;= t_max &amp;&amp; t2 &gt;= t_min &amp;&amp; t2 &lt;= t_max) {
        if (t1 &lt; t2) t_I = t1
        else         t_I = t2
    } else
    if (t1 &gt;= t_min &amp;&amp; t1 &lt;= t_max)
        t_I = t1
    else
    if (t2 &gt;= t_min &amp;&amp; t2 &lt;= t_max)
        t_I = t2
    else {
        printf "Interception will fail.\n" &gt; "/dev/stderr"
        exit(0)
    }

    # Cosine of the launch angle
    c = (x_0 - cos_T * v_0 * (t_0 + t_I)) / (t_I * v_I);
    if (c &lt;= 0.0 || c &gt;= 1.0) {
        printf "Incorrect launch angle.\n" &gt; "/dev/stderr"
        exit(0)
    }

    # Launch angle. awk has no arccos()...
    a = 180.0/3.14159265358979323846 * atan2(sqrt(1-c*c), c)
    printf "Intercept in %.3f seconds using %.1f degree launch angle.\n", t_I, a &gt; "/dev/stderr"

    # Output the trajectories using N samples.
    t = -t_0
    for (i = 0; i &lt;= N; i++) {
        tprev = t
        t = -t_0 + (t_Z + t_0) * i / N

        # Interceptor launch?
        if (tprev &lt; 0 &amp;&amp; t &gt;= 0) {
            printf "%.6f", 0
            printf " %.6f %.6f", x_T(0), y_T(0)
            printf " %.6f %.6f", 0, 0
            printf "\n"
        }

        # Intercept?
        if (tprev &lt; t_I &amp;&amp; t &gt;= t_I) {
            printf "%.6f", t_I
            printf " %.6f %.6f", x_T(t_I), y_T(t_I)
            printf " %.6f %.6f", x_I(t_I, c), y_I(t_I, c)
            printf " %.6f %.6f", x_I(t_I, c), y_I(t_I, c)
            printf "\n"
        }

        # Time
        printf "%.6f", t

        # Target
        printf " %.6f %.6f", x_T(t), y_T(t)

        # Interceptor projectile?
        if (t &gt;= 0 &amp;&amp; t &lt; t_I)
            printf " %.6f %.6f", x_I(t, c), y_I(t, c)

        printf "\n"
    }

    exit(0)
}


When run, it outputs $N = 200$ rows of trajectory information. Each row has format time target_x target_y interceptor_x interceptor_y (with the last two duplicated on the moment of collision). If you have both awk and gnuplot available, you can run

awk -f example.awk &gt; out &amp;&amp; gnuplot -p -e 'plot "out" u 2:3 t "Target" w lines lc 1, "out" u 4:5 t "Interceptor" w lines lc 3, "out" u 6:7 notitle w points pt 1 lc -1'


to compute the trajectories, saving them in file out, and plotting it on screen using gnuplot.

Using the current parameters in the file, the collision occurs at time $t = 2.931$, with $27.1$ degree launch angle:
change in the MathJax that results in every MathJax equation being doubled, one being an image and one being a text-based rendering. Usually one of them is hidden, but sometimes the doubles are positioned corner to corner, as shown here. As was already noted, a hard-refresh (Ctrl-F5) usually