# Solving for initial velocity required to launch a projectile to a given destination at a different height

I need to calculate the initial velocity required to launch a projectile at a given angle from point A to point B. The only force acting on the projectile after launch will be gravity – zero air resistance. The projectile is launched within a simulated, virtual environment; however, I am asking for help with the physics rather than the simulation itself.

I have had success (with a different equation) when point A and point B are at the same height; however, once point B is at a different height, my calculations become less precise – well, wrong in fact.

I researched the following formula for finding the range of a projectile on uneven ground. The parameters are all available to me, except the initial velocity that I need to solve for.

$d$ : range or distance
$v_i$ : initial velocity
$g$ : gravity
$\theta$ : launch angle
$y_0$ : launch height

$$d = \frac{v_i \cos\theta}{g}(v{_i} \sin \theta + \sqrt{(v_i \sin\theta)^2 + 2gy_0})$$

I attempted to solve for initial velocity (eq: A):

$$v_i = \sqrt{\frac{d^2g}{2\cos\theta^2(y_0+d \tan\theta)}}$$

Using this equation in my simulation I apply the velocity to a normalised displacement vector and launch the projectile. It gets close to its target but:

• $x_{final}$ is always correct
• $z_{final}$ is always incorrect - it is close to the desired $z$ but always offset by a seemingly proportional amount.

I have spent many hours trying to review the equation but I have been unsuccessful. Any advice would be most appreciated:

• is this the correct equation?
• have I solved for $v_i$ correctly? I have looked for an example equation online but I have not found one structured how I need it, i.e. solving for $v_i$
• I have spent hours researching online - perhaps I have missed some good (but entry-level) resources. Do you know of any reference material that may help me?

Update - I have now named the equation above for referencing below

Following on from the answer by @Pygmalion, which I am still gratefully working to understand:

I agree that your derived equation is equivalent to mine (A). Using yours (@Pygmalion's) in my simulation, I therefore observe the same failures: the projectile always lands short of the target.

I have simplified the simulation keeping the launch height and target height the same. I still encounter the same problem with equation A; however, when passing the same parameters to the following equation the projectile always hits the target precisely (eq: B):

$$v_i = \sqrt{\frac{dg}{\sin2\theta}}$$

Given the success of equation B when the launch and target heights are the same and the failure of equation A given the same conditions, I question whether equation A is the correct one to solve the problem since I would expect it to work for any combination of launch|target height.

I think the help I need is around why equation B works. Does it cater for conditions that equation A overlooks? If equation A is unsuitable, are you able to recommend an alternative?

In short, the $v_i$ calculated by equation A (in my simulations) is always less than $v_i$ from equation B given the same inputs - the projectile therefore always falls short of its target.

-
Hi James, and welcome to Physics Stack Exchange! This is a borderline case, in part because it is a very elementary question, but I think you're correct that the homework tag doesn't apply because what you actually need is the answer, not the method by which you would derive an answer. – David Z May 8 '12 at 12:19
Are you solving the problem in 2D or 3D? You say "$z_{final}$ is always incorrect - it is close to the desired $z$ but always offset by a seemingly proportional amount". And then you also have $y_0$ in your answer for the initial velocity. Perhaps the geometry of the situation is not clearly stated. – Vijay Murthy May 8 '12 at 16:55
I'm solving in 3D; however, I have hopefully simplified my test scenario sufficiently to avoid the extra complication: Xinitial and Xfinal are both 0; Yi and Yf are both equal; Zi and Zf are different. In this scenario, Z is treated as X in the 2D domain. Once the problem is solved then I will move the target in X also, but until then X is redundant. As mentioned earlier, in this setup, equation A fails yet equation B succeeds. – James May 8 '12 at 17:01

This types of problems are solved by observing projectile movements in $x$ and $y$ direction separately. In $x$ direction you have constant velocity movement

$$v_x = v_{x0} = v_0 \cos(\theta), \; (1)$$

$$x = v_{x0} t +x_0 = v_0 \cos(\theta) \; t +x_0, \; (2)$$

and in $y$ direction you have constant acceleration movement with negative acceleration $-g$

$$v_y = - g t + v_{y0} = - g t + v_0 \sin(\theta), \; (3)$$

$$y = - \frac{1}{2} g t^2 + v_{y0} t + y_0 = - \frac{1}{2} g t^2 + v_0 \sin(\theta) \; t + y_0. \; (4)$$

$$x_0 = 0, \; y_0 \ne 0,$$

and final conditions (at moment $t=T$ projectile falls back on the ground) are

$$t = T, \; x = d, \; y = 0.$$

If you put initial and final conditions into equations (2) and (4) you end up with two equations and two unknowns $v_0, T$. By eliminating $T$ you get expression for $v_0$.

My calculations show that

$$v_0 = \frac{1}{\cos(\theta)}\sqrt{\frac{\frac{1}{2} g d^2}{d \tan(\theta)+y_0}}$$

which is I believe equal to your equation. Maybe your problem is that $d$ means displacement in direction $x$, while the total displacement is $\sqrt{d^2+y_0^2}$?

-
Thanks Pygmalion, especially for the quick and detailed response. This is taking me well past my comfort zone in physics/maths, so it's going to take me a short while to digest what you've written. I'm interested in your closing question: displacement in direction x vs total displacement. I sourced the formula from the link below where their description does seem to match my problem. I will investigate further and reply back. Equation Source – James May 8 '12 at 11:51
The answer is correct, but maybe there is confusion with the nomenclature. If the separation between the launch point and target is $(\Delta x,\Delta y)$ in xy components, then the equation relating the separations is $\Delta y = \Delta x \tan\theta - \frac{ \frac{1}{2} g \Delta x^2} {v_0^2 \cos^2 \theta}$. This can be solved for $v_0$. – ja72 May 8 '12 at 17:31
@ja72 Exactly my point! Thanks for pointing this out in even more clear way that I did. – Pygmalion May 8 '12 at 20:13
@Pygmalion and ja72. I am indeed using xy components and so switching the equation to that suggested has solved the problem for me. Thank you for your time. – James May 11 '12 at 9:00
@James I've only seen the change to your answer now. If you got your asnwer, I consider the case closed. – Pygmalion May 11 '12 at 9:28