<s>[INST] 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}$$
 [/INST] $$\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.
</s>