So I have the equation
$$\tan^2 \theta = \frac{x^2+y^2}{z^2}$$
I got the first derivative of $\theta$ with respect to $x$ by doing this
\begin{align} 2\sec^2 \theta \tan \theta d \theta &= \frac{2x}{z^2} dx \\ \frac{d \theta}{dx} &= \frac{x \cos^3 \theta}{z^2 \sin \theta} \end{align}
But I'm having difficulty solving for $\frac{d^2\theta}{dx^2}$. Any help?