# How to find starting velocity for a body thrown by an angle when known distance it must pass?

From course of mechanic, we know, that to find distance, passed by a body thrown by an angle, we need to use that formula:

Sy(t) = V0 * sin(angle) * t - (gtt) / 2;
Sx(t) = V0 * cos(angle) * t;

My question is, how do we find the right starting velocity, if we know the distance body must pass (Sx and Sy) and angle (let's say, it's 45 degrees)?

I tried to derive formula, but it seems to be wrong:

V0 = ( Sy(t) + (g * t * t) / 2 ) / sin(angle_in_rads);

Your starting velocity is a vector, not a scalar (to be pedantic, V0 is actually the speed, i.e. the magnitude of the velocity).

If v0x= v0*cos(a) and v0y= v0*sin(a), then your analytical solution for the positions is correct: sx(t) = v0*cos(a)*t and sy(t) = v0*sin(a)*t - g*t^2/2.

Your question is ambiguous, but assuming you want to find the launch speed and angle that allows you to reach a maximum height (sy_max) and a maximum range (sx_max), then this is how to approach it:

• the maximum height is attained when the instantaneous velocity attains a null vertical component. Since vy = v0*sin(a) - g*t then t_sy_max = v0*sin(a)/g. Since you know sy_max = sy(t_sy_max), you have found one equation.

• the maximum range is attained when sy becomes zero (and t > 0, naturally). So you start with the equation 0 = v0*sin(a)*t_max - g*t_max^2/2 from where you find tour t_max = 2*v0*sin(a)/g. Due to the symmetry of the parabola, you can confirm that t_max = 2*t_sy_max. You end up with the second equation, mainly sx_max = sx(t_max).

• Both equations that you have written for the known (sx_max, sy_max) input pair are assembled into system of equations that is nonlinear (trigonometric in this case). You should be able to work out the values of v0 and a from it.

• @Your starting velocity is a vector, not a scalar - that's right, I derived x and y components of a velocity vector by multiplying scalar speed onto sin and cos, respectively. – PaulD Jun 15 '16 at 10:35
• I've made a simple python program which should test my calculations, can you please look at it and say where I made a mistake? pastebin.com/nSMdAUDp – PaulD Jun 15 '16 at 12:41
• Hi, I've found my mistake and made a correction, now everything works as expected, thank you. Here's the right program in case someone will need it: pastebin.com/gDfkL2v0 – PaulD Jun 15 '16 at 13:38