# Math Help - Solving for theta of a projectile over uneven ground

1. ## Solving for theta of a projectile over uneven ground

Hello- I put this question in this forum because I didn't really think it fell under "trigonometry", and this was the only category that seems to somewhat fit.

I am modeling a projectile on a computer program, and need a formula to solve for the angle necessary for a projectile shot at a given velocity to hit a target a given distance away, but not over flat ground, ie the target is higher or lower than the initial position of the projectile. Solving for theta over flat ground is fairly trivial, but I cannot solve for theta over uneven ground. First, is there even a closed form solution? Secondly, here is what I have so far--

v= velocity of the projectile
$
\theta$
= the angle it is being launched at

First the parametric equations-
$
y = vtsin(\theta) - \frac{gt^2}{2}
$

$
x = vtcos(\theta)
$

So $t = \frac{x}{vcos(\theta)}$

Substituting in t,
$
y = \frac{vxsin(\theta)}{vcos(\theta)} - \frac{gx^2}{2v^2cos(\theta)^2}
$

which simplifies to
$
y = xtan(\theta) - \frac{gx^2}{2v^2cos(\theta)^2}
$

Using normal trig methods, I could not solve this equation for theta. Asking a teacher, she suggested I use Euler's identities because sometimes those are easier to work with than trig identities. So I converted

$sin(\theta)$ to $\frac{e^{i\theta} - e^{-i\theta}}{2}$

and $cos(\theta)$ to $\frac{e^{i\theta} + e^{-i\theta}}{2i}$ to see if I could work it that way...

After manipulation, it comes out to-

$

e^{i\theta} = \frac{-igx \frac{+}{} \sqrt{4y^2v^4-g^2x^4-4x^2v^4}}{2v^2(y-ix)}

$

$

\theta = i ln(\frac{-igx \frac{+}{} \sqrt{4y^2v^4-g^2x^4-4x^2v^4}}{2v^2(y-ix)})

$

Which has an imaginary part. When I plug in what the known values for x and y are for theta = $\frac{\pi}{4}$ and v = 100, this formula returns theta as imaginary, which is obviously incorrect since I know it should return $\frac{\pi}{4}$. Did I go wrong somewhere? This problem cannot be new- has anyone else solved this, or know of a way to solve it? Thanks for your help!

2. I always tell my students to solve the quadratic
$
y = vt\cdot sin(\theta) - \frac{gt^2}{2}
$

Because this one will give you two solutions one being $t \le 0$.
If $t = 0,$ this is absolutely a solution, but it doesn't satisfy the $x$ equation, for $x>0$, so it must be thrown out. Clearly, $t < 0$ is not a solution. Anyway, that leaves
$
t = \dfrac{v\cdot \sin \theta + \sqrt{v^2\cdot \sin^2 \theta - 2g\cdot y}}{g}.
$

Now plug this in for $t$ in the $x$ equation.

3. Ah, thanks so much. I can't believe I didn't think of doing that before. In case anyone else is wondering, the answer turns out to be--

$\theta = arctan(\frac{2v^2 \frac{+}{} v^2 \sqrt{4- \frac{4g^2x^2}{v^4} - \frac {8gy}{v^2}}}{2gx})$

Thanks again.