A particle is projected at an angle $\theta$ above the horizontal from a point on a horizontal plane. The particle just passes over two walls that are at horizontal distances $d_1$ and $d_2$ from the point of projection and are of heights $d_2$ and $d_1$, respectively. Show that
$$
\tan\theta=\frac{d_1^2+d_1d_2+d_2^2}{d_1d_2}.
$$
Find (and simplify) an expression in terms of $d_1$ and $d_2$ only for the range of the particle.