Find the error in theta for noisy points in $R^2$ Assume I have two points in $R^2$:
$P_{t=0} = (x_1, y_1)$ and
$P_{t=1} = (x_2, y_2)$
at $t=1$ I want to calculate the heading angle/orientation of the particle.
Both points have measurement noise of N, and the noise is constant.
To calculate the orientation:
$\theta = arctan2((x_{1} - x_{2}), (y_{1} - y_{2}))$
However, I need some uncertainty around $\theta$, that accounts for the noisy x and y values. I know the methods of error propagation for powers, multiplication, subtraction and addition, but I don't understand how to propagate uncertainty in a trigonometric function.
EDIT:
I have done the following to try and calculate an error on theta.
$ \delta( \ atan2(\Delta x, \Delta y) \ ) = \sqrt{\Sigma_{i} \ \ \big(\delta(a_i) . \frac{d(atan2(\Delta x, \Delta y))}{da_i}}\big)^2$
Where:
$ a_i \ \epsilon \ [\Delta x, \Delta y]$
$ \Delta x = x_1 - x_2 \ \ \ $
$ \Delta y = y_1 - y_2$
$\frac{d(atan2(\Delta x, \Delta y))}{da_i}$ is the partial derivative of atan2.
$\delta(a_i)$ is effectively the noise on $\Delta x \ or  \ \Delta y$
i.e. $\delta(\Delta x)$ or $\delta(\Delta y)$ depending on $i$.
$\delta(\Delta x) = \sqrt{ N^2 + N^2 }$
I DO not propagate error when calculating the partial derivative of arctan2. Should I be doing this?
I tried to test this error on $\theta$, by computing a Gaussian of theta and the error. In about ten random samples of this distribution, I get perhaps one value that is indeed close to theta. But it seems a bit poor - not good enough of an error for theta.
 A: Let $(x,y)$ be Cartesian coordinates and $(r,\theta)$ be polar coordinates:
$$
\begin{cases} x = r\cos(\theta) \\ y = r\sin(\theta) \end{cases}
$$
Then we have the Lemma:
$$
dx^2 + dy^2 = dr^2 + (r \, d\theta)^2
$$
A very elementary proof of this will be given in the Appendix below.
In order to accomplish things, let's replace the infinitesimals by finite differences:
$$
(\Delta x)^2 + (\Delta y)^2 = (\Delta r)^2 + (r \cdot \Delta \theta)^2
$$
Due to homogeneity of space, we can write:
$$
\Delta x = \Delta y = N \quad \mbox{and} \quad \Delta r = r \cdot \Delta \theta
$$
Herewith we easily derive:
$$
2 N^2 = 2 (r \cdot \Delta \theta)^2 \quad \Longrightarrow \\
\Delta \theta =\frac{N}{r} = \frac{N}{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}}
$$
Appendix
$$
\begin{cases}
dx = \partial x / \partial r\,dr + \partial x / \partial \theta\,d\theta \\
dy = \partial y / \partial r\,dr + \partial y / \partial \theta\,d\theta
\end{cases} \quad \Longrightarrow \\ \begin{cases}
dx = \cos(\theta) dr - r\sin(\theta) d\theta
= \cos(\theta) dr - \sin(\theta) \, r d\theta \\
dy = \sin(\theta) dr + r\cos(\theta) d\theta
= \sin(\theta) dr + \cos(\theta)\, r d\theta \end{cases}
\quad \Longrightarrow \\ \begin{cases}
(dx)^2 = \cos^2(\theta) (dr)^2 - 2 dr\cos(\theta)\sin(\theta)\,r d\theta + \sin^2(\theta)(r d\theta)^2 \\
(dy)^2 = \sin^2(\theta) (dr)^2 + 2 dr\cos(\theta)\sin(\theta)\,r d\theta + \cos^2(\theta)(r d\theta)^2 \end{cases}
$$
Adding the latter equations together proves the Lemma.
A: Upon request. The purpose of this second answer is to show that the OP's method leads to the same result as in my first answer (approximately). It is noticed that $\,arctan2\,$ is rather a programming expression, not a mathematical one.
And the $2$ is redundant because the angle $\theta$ is small. Whatever. The derivation with $\,\arctan\,$ can be done as follows:
$$
d\arctan(y/x) = \frac{1}{1+(y/x)^2}d(y/x) =
\frac{1}{1+(y/x)^2}\left(\frac{1}{x}dy-\frac{y}{x^2}dx\right) \quad \Longrightarrow \\
d\theta = \frac{x\,dy-y\,dx}{x^2+y^2}
$$
In order to accomplish things, let's replace the infinitesimals by finite differences again:
$$
\Delta \theta = \frac{(x_2-x_1)\, \Delta y - (y_2-y_1)\, \Delta x}{(x_2-x_1)^2+(y_2-y_1)^2}
$$
The numerator of this fraction represents twice the area of a triangle, which is determinant of a parallelogram spanned by the vectors $(\Delta x,\Delta y)$ and $(x_2-x_1,y_2-y_1)$. While the denominator represents, of course, the square length of the vector $(x_2-x_1,y_2-y_1)$. For small angles, the numerator can be written with the error $N$ as : $\;\left|(x_2-x_1,y_2-y_1)\right|\,N$ . One could make a picture to see this; think of "twice" and the fact that the area of a circle is $\pi\,r^2$ while the perimeter is $2\pi\,r$ . Or make the parallelogram a rectangle. So the result is (approximately) the same as in the first answer.
