Simultaneous equations, trig functions and the existence of solutions Came across this conundrum while going over the proof that
$$A \cdot \sin(bx) + B \cdot \cos(bx) = C \cdot \sin(bx + k)$$
for some numbers $C$ and $k$. ($A$, $B$ and $b$ are known.)
The usual method is to expand the RHS using the compound angle identity
\begin{align}
C \cdot \sin(bx + k) &= C \cdot \bigl( \sin(bx)\cos(k) + \cos(bx)\sin(k) \bigl) \\
&= C\cos(k) \cdot \sin(bx) + C\sin(k) \cdot \cos(bx)
\end{align}
and thus set
\begin{align}
C\cos(k) &= A \\
C\sin(k) &= B
\end{align}
My trouble comes with what happens at this point - we then proceed to divide the second equation by the first, obtaining
$$ \tan(k) = \frac{B}{A} $$
which we then solve to obtain $k$, etc. etc.
My question is: how do we know that this is "legal"? We have reduced the original two-equation system to a single equation. How do we know that the values of $k$ that satisfy the single equation are equal to the solution set of the original system?
While thinking about this I drew up this other problem:
\begin{align}
\text{Find all }x\text{ such that} \\
\sin(x) &= 1 \\
\cos(x) &= 1
\end{align}
Obviously this system has no solutions ($\sin x$ and $\cos x$ are never equal to $1$ simultaneously). But if we apply the same method we did for the earlier example, we can say that since $\sin(x) = 1$ and $\cos(x) = 1$, let's divide $1$ by $1$ and get
$$ \tan(x) = 1 $$
which does have solutions.
So how do we know when it's safe to divide simultaneous equations by each other? (If ever?)

Good question!
The question is similar to the following question:
"If we have two linear polynomials say, $ax + b$ and $cx+d$, and we know that they are equal at two distinct points then can we conclude that the two linear polynomials are the same?"
Getting back to your problem, First note that what we have is not a single equation but an infinite set of equations since we want the equation to hold true for all $x \in \mathbb{R}$. This is the key here and this is why we are allowed to "equate the corresponding coefficients".
A somewhat detailed explanation is below.
So in fact, we should be surprised that a solution actually exists for these $2$ variables and satisfies this infinite set of equations.
So, if a solution were to exist, then it better satisfy 
$$A \sin(bx) + B \cos(bx) = C \sin(bx+k)$$
at $x=0$ and $x = \frac{\pi}{2b}$ (assume $b$ is non-zero).
Plugging in $x=0$ and $x = \frac{\pi}{2b}$ gives us
$B = C \sin(k)$ and $A = C \sin(\frac{\pi}{2} + k) = C \cos(k)$.
Once you get to this stage you can solve for $C$ and $k$ by the usual algebra.
After solving this, you now go back and feed it into the original equation to check if the original equation is consistent. And you will find that it is consistent and does satisfy for all $x$ since we have the identity
$$\sin(bx+k) = \cos(k) \sin(bx) + \sin(k) \cos(bx)$$ which holds good $\forall$  $b,x,k \in \mathbb{R}$ and hence the only possible solution to this system is $$C = \sqrt{A^2+B^2}, \tan(k) = \frac{B}{A}$$
