# Compute derivative involving mod

Consider two angles $\alpha_1$ and $\alpha_2$. Let $$\theta=\alpha_1-\alpha_2.$$ If $\alpha_1, \alpha_2\in [0,2\pi)$, it is obvious that $\theta\in(-2\pi,2\pi)$. Because I need to compute an error angle $\theta-\theta_0$ where $\theta_0\in[0,2\pi)$ is a constant angle, I need to restrict $\theta$ in $[0,2\pi)$. Thus I write $$\theta=\alpha_1-\alpha_2 \ (\mathrm{mod}\ 2\pi).$$ Then when computing the derivative of $\theta$ with respect to time, can I have the following result? $$\dot{\theta}=\dot{\alpha}_1-\dot{\alpha}_2.$$

-
The arguments $\alpha_1$, $\alpha_2$ and $\theta=:\alpha_1-\alpha_2$ are only defined up to a multiple of $2\pi$; but their derivatives with respect to time are uniquely determined real numbers which stand in the relation $\dot\theta=\dot\alpha_1-\dot\alpha_2$. – Christian Blatter Sep 1 '12 at 16:01
Thanks. So that means the derivative has nothing to do with the modulo operation, right? BTW, please post your comment as an answer. – Shiyu Sep 1 '12 at 16:11

The arguments $\alpha_1$, $\alpha_2$ and $\theta:=\alpha_1-\alpha_2$ are only defined up to a multiple of $2\pi$; but their derivatives with respect to time are uniquely determined real numbers which stand in the relation $\dot\theta=\dot\alpha_1-\dot\alpha_2$.
In order to see this we can argue as follows: For each of the three arguments we can choose a representant which changes differentiably with time. After these choices have been made (maybe by three different people) there is an integer $k_0$ such that for all times $t$ one has $$\theta(t)=\alpha_1(t)-\alpha_2(t)+2k_0\pi\ .$$ Now differentiate this with respect to $t$.