I have the equation where $t$ is the independent variable and $x_1, x_2$ are functions of $t$.
I have the constraint that $x_2 - x_1 = 2\pi \theta$, where $\theta$ is an external variable I set.
I'm not seeking to solve it, but as I try to simplify using 2 different methods I get a different final form!
$ f(t) = A \sin(x_1) + B\cos(x_2) + A\sin(x_2) + B\cos(x_2) $
Method 1:
Use the trig identities
$ \sin(\alpha) + \sin(\beta) = 2\cos(\frac{\alpha - \beta}{2})\sin(\frac{\alpha+\beta}{2}) $
$ \cos(\alpha) + \cos(\beta) = 2\sin(\frac{\alpha - \beta}{2})\cos(\frac{\alpha+\beta}{2})$
in the equation above.
$ f(t) = A( \sin(x_1) +\sin(x_2)) + B(\cos(x_1)+\cos(x_2)) = 2A\cos(\frac{x_1-x_2}{2})\sin(\frac{x_1+x_2}{2}) + 2B\sin(\frac{x_1-x_2}{2})\cos(\frac{x_1+x_2}{2})$
Next I use my above mentioned constraint, I set $\theta=\frac{1}{2}$ so $x_2 = x_1 + \pi$. Then substituting it into my result from the trig identities:
$ f(t) = 2A\cos(\frac{x_1-x_1 - \pi}{2})\sin(\frac{x_1+x_1+\pi}{2}) + 2B\sin(\frac{x_1-x_1-\pi}{2})\cos(\frac{x_1+x_1 +\pi}{2}) $
$= 2A\cos(-\frac{\pi}{2})\sin(x_1+\frac{\pi}{2}) + 2B\sin(\frac{-\pi}{2})\cos(x_1+\frac{\pi}{2})= -2B\cos(x_1 +\frac{\pi}{2})$
Finally using $\cos(\alpha + \frac{\pi}{2})= -\sin(\alpha)$ I get the result:
$f(t) = 2B\sin(x_1).$
Method 2:
I use my constraint first and set $\theta= \frac{1}{2}$ so $x_2 = x_1 + \pi$ thus:
$f(t) = A(\sin(x_1) + \sin(x_2)) + B(\cos(x_1)+\cos(x_2)) = A(\sin(x_1) + \sin(x_1+\pi)) + B(\cos(x_1)+\cos(x_1+\pi)) $
Now I use the trig identities $\sin(\alpha + \pi) = - \sin(\alpha)$ and $\cos(\alpha + \pi)= -\cos(\alpha)$ and I get zero!
$f(t) = A(\sin(x_1) - \sin(x_1)) + B(\cos(x_1)-\cos(x_1)) = 0.$
Why does this happen, am I doing something wrong? I don't really see how using the constraint before or after using the identities differs. What is the correct way to simplify this?
Thanks in advance!