8.352. $\cos 2 x-\cos x+\cos \left(x+\frac{\pi}{4}\right)+\sin \left(x+\frac{\pi}{4}\right)=\sin \frac{\pi}{4}-1$.
## Solution.

By the formulas

$$
\cos (\alpha+\beta)=\cos \alpha \cos \beta-\sin \alpha \sin \beta, \sin \left(\alpha^{\circ}+\beta\right)=\sin \alpha \cos \beta+\cos \alpha \sin \beta
$$

$$
\text { and } \cos 2 \alpha=2 \cos ^{2} \alpha-1
$$

we have

$$
2 \cos ^{2} x-1-\cos x+\cos \frac{\pi}{4} \cos x-\sin \frac{\pi}{4} \sin x+\sin x \cos \frac{\pi}{4}+\cos x \sin \frac{\pi}{4}=
$$

$=\sin \frac{\pi}{4}-1 \Leftrightarrow 2 \cos ^{2} x-1-\cos x+\frac{\sqrt{2}}{2} \cos x-\frac{\sqrt{2}}{2} \sin x+\frac{\sqrt{2}}{2} \sin x+$ $+\frac{\sqrt{2}}{2} \cos x-\frac{\sqrt{2}}{2}+1=0 \Leftrightarrow 4 \cos ^{2} x-2(1-\sqrt{2}) \cos x-\sqrt{2}=0$.

Solving this equation as a quadratic equation in terms of $\cos x$, we have $\cos x=-\frac{\sqrt{2}}{2}, x_{1}= \pm \frac{3 \pi}{4}+2 \pi k=\frac{\pi}{4}(8 k \pm 3), k \in Z ;$ $\cos x=\frac{1}{2}, x_{2}= \pm \frac{\pi}{3}+2 \pi n=\frac{\pi}{3}(6 n \pm 1), n \in Z$.

Answer: $x_{1}=\frac{\pi}{4}(8 k \pm 3) ; x_{2}=\frac{\pi}{3}(6 n \pm 1)$, where $k$ and $n \in Z$.