# Propagation of uncertainty in root finding

I have a set of measured variables, $x$, $z$, and $d$, with associated uncertainties $\delta x$, $\delta z$, and $\delta d$. From these, I need to calculate an angle $\theta$; since the below equation cannot be rearranged (as far anyone can tell) and solved explicitly, the only available method is to iteratively find the roots of equation using Newton-Raphson (or similar).

$$\tan^2 \theta = \frac{(x - z\tan\theta)^2}{(x - z\tan\theta)^2 + d^2}$$

This method works, and I get correct values for $\theta$, however I am unsure (nor can I find any references) on how to calculate/propagate $\delta \theta$ (uncertainty in $\theta$).

How do you propagate uncertainties in this case? Is it even possible?

The easiest thing to do would be to vary your input values ($x$, $z$, $d$) and see how much variance is produced in $\theta$. For example, if instead of using the fixed value of $x$ that you are interested in, you draw randomly from a gaussian distribution centered at $x$, with a variance $\sigma_x$. You will then retrieve a distribution of $\theta$, from which you could calculate a mean/median and variance. You can do the same thing with each input variable, or all of them together.
Another possible way: You have an implicit function, $f(\theta, x, z, d)=0$. Expanding this function up to first order only, you get \begin{align} \frac{\partial f}{\partial\theta}\delta\theta+\frac{\partial f}{\partial x}\delta x+\frac{\partial f}{\partial z}\delta z+\frac{\partial f}{\partial d}\delta d\approx 0 \end{align} for small errors in $\theta,x,z,d$. From this you can get fractional error $\frac{\delta\theta}{\theta}$ in terms of others.