A ball is launched as a projectile with initial speed $v$ at an angle $\theta$ above the horizontal. Using conservation of energy, find the maximum height $h_\text{max}$ of the ball's flight. Express your answer in terms of $v$, $g$, and $\theta$.
I am doing:
$$\begin{align*} \frac{1}{2}mv^2 &= mgh_\text{max} + \frac{1}{2}m(v\cos\theta)^2\\ v^2 &= 2gh_\text{max} + (v\cos\theta)^2 \\ h_\text{max} &= \bigl(v^2 - (v\cos\theta)^2\bigr)/2g \\ h_\text{max} &= v^2\bigl(1 - (\cos\theta)^2\bigr)/2g \\ h_\text{max} &= \frac{v^2\sin^2\theta}{2g} \end{align*}$$
Is that correct, or is there a much easier way...?