# 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:

-

## migrated from math.stackexchange.comApr 10 '13 at 1:14

This question came from our site for people studying math at any level and professionals in related fields.

And what part are you having difficult with? –  copper.hat Apr 10 '13 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. –  copper.hat Apr 10 '13 at 0:48
Thanks Kevin, I didn't know about the physics stack exchange. –  Luke Allen Apr 10 '13 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 '13 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. –  Kevin Driscoll Apr 10 '13 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 '13 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. –  Kevin Driscoll Apr 10 '13 at 1:11

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

initial velocity = (sqrt(Gravity) * sqrt(x2-x1) * sqrt((tan(LaunchAngle)*tan(LaunchAngle))+1)) / sqrt(2 * tan(LaunchAngle) - (2 * Gravity * (y2-y1)) / (x2-x1))

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!

-

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=\frac{\Delta x}{\cos\theta}\sqrt{\frac{g}{2(-\Delta y+\tan\theta\Delta x)}}$$ Here we have $V$ in terms of our initial conditions, $\Delta x,\Delta y,g,\theta.$

-