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?)
 A: First, the question seems to be:
Show that there are some $C,k$ such that for every $x$
$$A \sin bx + B \cos bx = C \sin(bx + k)$$
Notice that the step from 
$$A \sin bx + B \cos bx = C \sin(bx) \cos k + C \cos bx \sin k$$
to
$$C\cos k = A, \ \ C\sin k = B$$
is actually the implication
$$ C\cos k = A, \ \ C\sin k = B \Longrightarrow \ A \sin bx + B \cos bx = C \sin(bx) \cos k + C \cos bx \sin k$$
So, if you manage to find $C,k$ such that $C\cos k = A, \ \ C\sin k = B$, you have proved the statement. Notice that this does not help you find all such $C,k$. Just one such pair. (The reverse implication is true too, but needs a little more justification).
Now if $C\cos k = A, \ \ C\sin k = B$, then we must have for non-zero $A$ that $\tan k = \frac{B}{A}$.
This is just the implication in one direction:
$$ C\cos k = A, \ \ C\sin k = B \Longrightarrow \tan k = \frac{B}{A}$$
It only means that any solution of 
$C\cos k = A, \ \ C\sin k = B$ satisfies $\tan k = \frac{B}{A}$
i.e. the set of $k$ which satisfies $C\cos k = A, \ \ C\sin k = B$ is a subset of the set of solutions of $\tan k = \frac{B}{A}$.
It does not mean that any solution of $\tan k = \frac{B}{A}$ satisfies $C\cos k = A, \ \ C\sin k = B$
For instance consider the equation $x = 1$. Squaring gives $x^2 = 1$, which has $-1$ as a solution.
For a more extreme example: $x^2 = -1$ implies $0 \times x^2 = 0$, which is true for every $x$.
So the step is "legal" in the sense that it is a valid implication, but you cannot just read off the solutions of the original equation from the implied ones, as you yourself noticed.
If statement X implies statement Y it is not necessary that statement Y should imply statement X.
When solving equations, some manipulations are equivalent, i.e. the resulting equation you get also implies the original (like adding 1), while some are not, like squaring.
A: In general, you don't. You know that all of the solutions of the pair of equations you started with are solutions of the single equation you ended up with (barring division-by-zero issues), but you generally don't know the converse. In this case, the reason you can get away with the converse is that you can choose $C$. Knowing $\tan k$ is the same as knowing $(\cos k, \sin k)$ up to a multiplicative constant; draw a unit circle if you don't believe this.
In general, the only way you know whether it is "legal" to do anything is to prove or disprove that you can do it.
A: 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}$$
