I have the following system of equations:
\begin{align*} a_1\sin(\theta) + b_1\cos(\theta) &= x + c_1 \\ a_2\sin(\theta) + b_2\cos(\theta) &= x + c_2 \\ \end{align*}
And I am trying to solve for $\theta$ and $x$. I substitute $x$, get $$(a_2-a_1)\sin(\theta)+(b_2-b_1)\cos(\theta) = c_2-c_1$$
Calling $a = a_2-a_1$, $b = b_2-b_1$, $c = c_2-c_1$ I solve this equation by usual methods and arrive at the answers $$\sin(\theta+\phi) = \frac{c}{\sqrt{a^2+b^2}}$$ with $\cos(\phi) =\frac{a}{\sqrt{a^2+b^2}}$
However, substituting the result in either first or second equation yields different values for $x$. What is the problem here? Is there no unique solution?
Nothing is wrong. Maybe some miscalculations?
I did some "rough" verification of your suggested method (by rough I mean taking inverse trig without seriously thinking about domains) and it seems fine.
$$\sin(\theta+\phi) = \frac{c}{\sqrt{a^2+b^2}}\implies \theta= \sin^{-1}(\frac{c}{\sqrt{a^2+b^2}})-\phi$$ $$\therefore \theta= \sin^{-1}(\frac{c}{\sqrt{a^2+b^2}})-\cos^{-1}(\frac{a}{\sqrt{a^2+b^2}})$$
substitution to the first equation : $$\begin{align} x&=a_1sin\theta+b_1\cos\theta-c_1\\ &=a_1(\frac{c}{\sqrt{a^2+b^2}}\frac{a}{\sqrt{a^2+b^2}}-\sqrt{1-\frac{c^2}{a^2+b^2}}\sqrt{1-\frac{a^2}{a^2+b^2}})\\ &+b_1(\sqrt{1-\frac{c^2}{a^2+b^2}}\frac{a}{\sqrt{a^2+b^2}}+\sqrt{1-\frac{a^2}{a^2+b^2}}\frac{c}{\sqrt{a^2+b^2}})\\ &-c_1\\ \end{align}$$
and similarly if we do with the equation 2 we get the same expression except $a_1, b_1, c_1$ are replaced by $a_2, b_2, c_2$ so to prove that the two solutions are the same we subtract them and show that it yields $0$. Note that when subtracting we get :
$$\begin{align} asin\theta+b\cos\theta-c &=a(\frac{c}{\sqrt{a^2+b^2}}\frac{a}{\sqrt{a^2+b^2}}-\sqrt{1-\frac{c^2}{a^2+b^2}}\sqrt{1-\frac{a^2}{a^2+b^2}})\\ &+b(\sqrt{1-\frac{c^2}{a^2+b^2}}\frac{a}{\sqrt{a^2+b^2}}+\sqrt{1-\frac{a^2}{a^2+b^2}}\frac{c}{\sqrt{a^2+b^2}})\\ &-c\\ \end{align}$$
The right hand side might look ugly but it does simplify to zero!