Reducing a two term signal to one term I am trying to solve a phasor addition problem, reducing from its original form to 
$$X(t) = A \cos(\omega_0 * t + \phi)$$
The original equation is :
 $$X(t) = 2 \sin(\omega_0 * t + 45) + \cos(\omega_0*t)$$
I converted the sine term into cosine. The result that i got was 
$$X(t) = 2 \cos(\pi/2 - \omega_0*t - \pi/4) + \cos(\omega_0*t) $$
Which reduces to :
$$X(t) = 2 \cos(\pi/4 - \omega_0*t) + \cos(\omega_0*t) $$
Up to this point I verify in MATLAB that the original function and the function in cosines are equal by graphing them and then calling the $norm()$ function and verify that it is something very close to 0. 
http://www.mathworks.com/help/matlab/ref/norm.html
I then perform the phasor addition process. 
$X(t) = Re(2e^{j(\pi/4)}e^{j\omega_0 t})+Re(e^{j0}e^{j\omega_0 t})$ 
$$X_1= 2e^{j(\pi/4)} = 2(cos(\pi/4) + jsin(\pi/4)) = 2(\frac{\sqrt2}2+j\frac{\sqrt2}2) = \sqrt2 + j\sqrt2$$
$$X_2 = e^{j0} = cos0 + jsin0 = 1$$
$$X_3 = X_1 + X_2 = \sqrt2 + j\sqrt2 + 1 = 2.41421 + j1.41421$$
 To turn it into back into the stated form of $X(t) = A \cos(\omega_0 * t + \phi)$ i find the $R$ 
$$R = \sqrt{2.41421^2 + 1.41421^2} = 2.79793$$
$$\theta = arctan(1.41421/2.41421) = .529902$$
The final result being $X(t) = 2.79793\cos(\omega_0 t + .529902) $
I then go to MATLAB to plot the original signal and the reduced signal that I found but when I call the $norm(originalSignal - reducedSignal)$ I get a number much greater than 0.
I am trying to figure out why this is returning such a high number. Some of my guesses are the negative $-\omega_0 t$ in the first term of the function when I convert sine to cosine $X(t) = 2 \cos(\pi/2 - \omega_0 t - \pi/4) + \cos(\omega_0 t) $ I don't know if the process changes for a situation like that. Problems I have worked through and have gotten the correct answer always seem to have the $\omega_0 t$ as positive part inside the cosine term.
Below is the Matlab code.
t = [0 : .01 : 1];
originalWave = 2*sin(50 *t + pi/4) + cos(50*t);
reducedWave = 2.79793*cos(50*t+.529902);

subplot(2,1,1)
plot(t, originalWave)
subplot(2,1,2)
plot(t, reducedWave)

norm(originalWave - reducedWave)

Any ideas on what could be wrong with my process or answer?
I appreciate any advice or help. Thanks. 
 A: I do not use Matlab and, so, I performed my calculations by hand.  
I set the problem as two equations for two unknowns ($A$ and $\phi$) and I selected two arbirary points to define the equations, namey $t=0$ and $t=\frac{\pi }{2 \omega }$.  
I so found two solutions which are given by
$$A=3 \sqrt{\frac{2}{17} \left(7+4 \sqrt{2}\right)}-\sqrt{\frac{1}{17} \left(7+4
   \sqrt{2}\right)}=2.797932652$$ 
$$\phi=-\cos ^{-1}\left(\sqrt{\frac{1}{17} \left(7+4 \sqrt{2}\right)}\right)=-0.5299027897$$ and
$$A=\frac{1}{17} \left(\sqrt{17 \left(7+4 \sqrt{2}\right)}-3 \sqrt{34 \left(7+4
   \sqrt{2}\right)}\right)=-2.797932652$$
$$\phi=\cos ^{-1}\left(-\sqrt{\frac{1}{17} \left(7+4 \sqrt{2}\right)}\right)=2.611689864$$
So, I agree with your numbers except for the sign of $\phi$.   
When plotting the differences of the original and modified functions, there absolutes values differ by less than $5 \cdot 10^{-15}$ which is almost the machine accuracy for my compiler.
A: You just made an sign error in your calculation is all. The complex exponential form of $2 \cos( \pi / 4 − \omega_0  t )$ is $\operatorname{Re} \left( 2 e^{j\pi/4} e^{-j\omega_0 t} \right)$. However, since $\cos(-\theta) = \cos(\theta)$, we have $2 \cos( \pi / 4 − \omega_0  t ) = 2 \cos( \omega_0 t -\pi/4) = \operatorname{Re} \left( 2 e^{-j\pi/4} e^{j\omega_0 t} \right)$.
The difference this makes in the final answer is that you end up with a phase of $-0.529902$ rather than $+0.529902$. Fixing this will give you a total squared error (i.e., norm( originalWave - reducedWave, 2 ).^2) on the order of $6 \cdot 10^{-10}$, which is attributable to the precision of your calculations.
