# how do i write $y = 2\sin2(x + \frac{\pi}{4}) - \cos2(x + \frac{\pi}{4} )$ in format $y = A\sin(kx) + B\cos(kx)$

The problem is the double angles. I tried to simplify them and change them around but no luck,

\begin{align} y&=A\sin(kx)+B\cos(ky)\\ y&=2\sin2(x+\pi/4)-\cos2(x+\pi/4)\\ &=2\left(2\sin(x+\pi/4)\cos(x+\pi/4)\right)-\cos^2(x+\pi/4)+\sin^2(x+\pi/4)\\ &=4\left(\sin x\cos\frac\pi 4+\cos x\sin\frac\pi4\right)\left(\cos x\cos\frac\pi 4-\sin x\sin\frac\pi4\right)-\cos^2(x+\pi/4)+\sin^2(x+\pi/4)\\ &=4\left(\sin x\frac1{\sqrt2}+\cos x\frac1{\sqrt2}\right)\left(\cos x\frac1{\sqrt2}-\sin x\frac1{\sqrt2}\right)-\cos^2(x+\pi/4)+\sin^2(x+\pi/4)\\ &=\frac 4{\sqrt 2}\left(\sin x+\cos x\right)\left(\cos x-\sin x\right)-\cos^2(x+\pi/4)+\sin^2(x+\pi/4)\\ &=2\sqrt 2(\cos^2x-\sin^2x)+\left(\sin x\frac1{\sqrt2}+\cos x\frac1{\sqrt2}\right)^2-\left(\cos x\frac1{\sqrt2}-\sin x\frac1{\sqrt2}\right)^2\\ &=2\sqrt 2(\cos^2x-\sin^2x)+4\left(\frac1{\sqrt2}\sin x\frac1{\sqrt2}\cos x\right)\\ &=2\sqrt 2(\cos^2x-\sin^2x+\sin x\cos x) \end{align}

• Photos can be difficult to read. Please type in your question using $\TeX$. Here is a tutorial. Dec 26 '13 at 22:28
• Hint: $cos^2(x)-sin^2(x) = cos(2x)$ and $2sin(x)cos(x) = sin(2x)$
– Tim
Dec 26 '13 at 22:30
• @TimRatigan thanks for the edit.
– user116528
Dec 26 '13 at 23:11
• Can you please explain what $\sin 2(x+\tfrac{\pi}{4})$ means? Is it $\sin\left[2(x+\tfrac{\pi}{4})\right]$ or is it $\sin^2 (x+\tfrac{\pi}{4})$? Dec 26 '13 at 23:29

\begin{align} 2\sin\left(2\left(x+\frac \pi4\right)\right)-\cos \left(2\left(x+\frac \pi4\right)\right)&=2\sin\left(2x+\frac \pi2\right)-\cos\left(2x+\frac \pi2\right)\\ &=2\cos(2x)+\sin(2x) \end{align} Shifting sine by $\pi/2$ obtains cosine, and cosine shifted by $\pi/2$ is negative sine, so the result follows.

To be slightly more concrete: \begin{align}\sin(2x+\pi/2)&=\sin(2x)\cos(\pi/2)+\cos(2x)\sin(\pi/2)=\cos(2x)\\ \cos(2x+\pi/2)&=\cos(2x)\cos(\pi/2)-\sin(2x)\sin(\pi/2)=-\sin(2x)\end{align}

The problem with your approach is that you consistently fail to square $\frac1{\sqrt 2}$ after factoring it out of two terms. e.g. $$[(\sin x)/\sqrt 2+(\cos x)/\sqrt 2][(\cos x)/\sqrt 2-(\sin x)/\sqrt 2]=\frac1{\sqrt 2}(\sin x+\cos x)\frac 1{\sqrt 2}(\cos x-\sin x)=\frac12(\sin x+\cos x)(\cos x-\sin x)$$

Once you adjust for this, your final expression is $$2(\cos^2x-\sin^2x+\sin x\cos x)=2\cos(2x)+\sin(2x)$$ So you weren't too far from the finish line.

Don't forget that double-angle formulas work in both directions.

Hint: Use $2(x+\frac{\pi}{4})=2x+\frac{\pi}{2}$ and then use the addition formulas for $\sin x$ and $\cos x$.

\begin{align} y &=\color{red}{ 2\sin2\left(x + \frac{\pi}{4}\right)} -\color{blue}{ \cos2\left(x + \frac{\pi}{4} \right)}\\ &=\color{red}{2\sin\left(2x + \frac{\pi}{2}\right)} -\color{blue}{ \cos\left(2x + \frac{\pi}{2} \right)}\\ &=\color{red}{2\sin \left(2x \right)\require{cancel} \cancelto{0}{\cos \left(\frac{\pi}{2}\right)}+2\left(\cos \left(2x \right)\require{cancel} \cancelto{1}{\sin (\frac{\pi}{2})}\right)}-\color{blue}{\cos(2x)\require{cancel} \cancelto{0}{\cos \left(\frac{\pi}{2}\right)}+\sin\left(2x\right)\require{cancel} \cancelto{1}{\sin \left(\frac{\pi}{2}\right)}} \\ &=\color{red}{0+2\cos \left(2x \right)}-\color{blue}{0+\sin(2x)}\\ &=\color{red}{2\cos \left(2x \right)}-\color{blue}{\sin(2x)} \equiv B\cos(kx)+A\sin(kx)\\ \\ &\implies A=-1;\; B=2; \; k=2 \end{align}

First, notice that $2(x+\tfrac{\pi}{4}) \equiv 2x+\tfrac{\pi}{2}$. Using this fact, we have $$y= 2\sin\left(x+\tfrac{\pi}{2}\right) - \cos\left(x+\tfrac{\pi}{2}\right).$$

There are two standard formulae: $$\begin{eqnarray*} \sin(A+B) &\equiv& \sin A \cos B + \sin B \cos A \\ \\ \cos(A+B) &\equiv& \cos A \cos B - \sin A \sin B \end{eqnarray*}$$

Applying these two formulae with $A=2x$ and $B=\tfrac{\pi}{2}$ gives: $$\color{blue}{y = 2\left(\sin 2x \cos \tfrac{\pi}{2} + \sin \tfrac{\pi}{2} \cos 2x\right) - \left( \cos 2x \cos \tfrac{\pi}{2} - \sin 2x \sin \tfrac{\pi}{2}\right) \equiv 2\cos 2x + \sin 2x}$$

Moreover, we can simplify $2\cos 2x + \sin 2x$ even further. Consider $$R\cos(2x-\alpha) \equiv 2\cos 2x + \sin 2x$$ Expanding the left hand side gives $$(R\cos\alpha)\cos 2x + (R\sin\alpha)\sin 2x \equiv 2\cos 2x + \sin 2x$$ Solving $R\cos\alpha=2$ and $R\sin\alpha=1$ gives $R=\sqrt{5}$ and $\alpha=\arctan(1/2)$. Hence:

$$\color{blue}{2\sin\left[2\left(x+\tfrac{\pi}{4}\right)\right] - \cos\left[2\left(x+\tfrac{\pi}{4}\right)\right] \equiv \sqrt{5}\cos\left(2x-\arctan\tfrac{1}{2}\right)}$$