# Solve for Initial Velocity of a projectile given Angle, Gravity, and Initial and Final positions?

I've found equations http://www.physicsclassroom.com/Class/1DKin/U1L6a.cfm for solving everything (and rearranged to solve everything) to do with projectile motion EXCEPT this, even though it should be possible.

• Gravity = 10 m/s^2 (for simplicity)
• Launch Angle = any angle in 0-360 degrees
• Launch Position in x,y coordinates = any position, could be a different elevation than landing position
• Landing position in x,y coordinates = any position other than Launch position, could be a different elevation than launch position

What is the general equation to solve for initial velocity for all angles 0-360 to hit a target at x2,y2 when launching from x1,y1?

Note: depending on the direction you are launching the projectile, some angles will not be possible, but keep in mind that if you were at a very high altitude and were launching a projectile at a target beneath you, launch angles other than 0-180 will be viable.

Just to be clear, this is the orientation of the 360 degree wheel I'm talking about, which has 90 degrees at the top and 270 at the bottom:

• And what part are you having difficult with? Apr 10, 2013 at 0:43
• Presumably you are ignoring drag and curvature of the earth, so the horizontal speed will remain constant. This fixes time in some sense. Apr 10, 2013 at 0:48
• Thanks Kevin, I didn't know about the physics stack exchange.
– Luke Allen
Apr 10, 2013 at 1:05
• @copper.hat, yes I'm ignoring drag, curvature, and all other variables not mentioned to keep it simple, but I don't think time is needed at all for this problem, as we already have 4 parts of the puzzle (Angle, Gravity, Initial Pos., Final Pos.)
– Luke Allen
Apr 10, 2013 at 1:06
• I was working on a derivation that was simple and clear, but couldn't come up with anything meaningful. So, I'll just say that the answer you are looking for is on wikipedia. projectile motion. If you are interested in the derivation, come back and let us know. Apr 10, 2013 at 2:12

Equations of motion:

(i) $y(t) = -10t^2 + v_y t + y_1$, where $v_y$ is the $y$-component of the initial velocity.

(ii) $x(t) = v_x t + x_1$, where $v_x$ is the $x$-component of the initial velocity.

Solve for $t_f$, the time of landing, in terms of $v_x$ using equation (ii). Plug that into equation (i) to get a relation between $v_y$ and $v_x$.

• isn't there a simpler way, with just one equation? since we know both the starting position and final position, by subtracting these (x2-x1),(y2-y1) we get the displacement of x and y, which suggests a single equation to solve for any Initial Velocity given any viable Angle, right? There shouldn't be a need to know time at all, it just introduces complexity. I'm just not smart enough to compose a formula such as that.
– Luke Allen
Apr 10, 2013 at 1:03
• Yes there is a simpler way than this. I will be posting a response shortly, since it seems that Math SE has seemed this appropriate. Apr 10, 2013 at 1:11

Begin with equations of motion:
$$\Delta x=V\cos\theta*t$$ $$\Delta y=V\sin\theta*t-\frac{1}{2}gt^2$$ We have two unknowns $V,t$ and two equations. From the first equation, we have: $$t=\frac{\Delta x}{V\cos\theta}$$ Plug it into the second equation: $$\Delta y=V\sin\theta\left(\frac{\Delta x}{V\cos\theta}\right)-\frac{1}{2}g\left(\frac{\Delta x}{V\cos\theta}\right)^2$$ Now we can solve for $V$. $$\Delta y=\tan\theta\Delta x-\frac{1}{2}g\frac{\Delta x^2}{V^2\cos^2\theta}$$ $$\Delta y-\tan\theta\Delta x=-\frac{1}{2}g\frac{\Delta x^2}{V^2\cos^2\theta}$$ $$-\Delta y+\tan\theta\Delta x=\frac{1}{2}g\frac{\Delta x^2}{V^2\cos^2\theta}$$ $$V^2=\frac{g\Delta x^2}{2\cos^2\theta(-\Delta y+\tan\theta\Delta x)}$$ $$V=\sqrt\frac{g\Delta x^2}{2\cos^2\theta(-\Delta y+\tan\theta\Delta x)}$$ $$V=\sqrt\frac{g\Delta x^2}{\Delta x2\sin\theta\cos\theta-2\Delta y\cos^2\theta}$$ since $2\sin\theta\cos\theta=\sin2\theta$ $$V=\sqrt\frac{g\Delta x^2}{\Delta x\sin2\theta-2\Delta y\cos^2\theta}$$

Here we have $V$ in terms of our initial conditions, $\Delta x,\Delta y,g,\theta.$

Here is what I've found to work so far:

$$\text{initial velocity} = \frac{\sqrt{\text{Gravity}}\sqrt{x_2-x_1}\sqrt{(\tan{(\text{LaunchAngle})})^2+1})}{\sqrt{2\tan{(\text{LaunchAngle})} - \dfrac{2\text{Gravity}(y_2-y_1)}{x_2-x_1}}}$$

However, while it appears to work great for high launch angles, the lower the angle the less accurate it seems to become (using pixels on the screen as a reference), can anyone find out what flaw it has?

UPDATE I was wrong earlier, it works fine at all angles as long as the Y positions of launch and landing position are the same, the equation somehow fails to take into account "uneven" ground, and I'm stumped by this!