To solve the equation \( \cos x = \left(\cos \frac{x}{2} - \sin \frac{x}{2}\right)^2 - 1 \), we'll first simplify the right side of the equation and then isolate \( x \).
Step 1: Expand the Right Side
Start by expanding the square on the right side:
\[ \left(\cos \frac{x}{2} - \sin \frac{x}{2}\right)^2 = \cos^2 \frac{x}{2} - 2 \cos \frac{x}{2} \sin \frac{x}{2} + \sin^2 \frac{x}{2} \]
Using the Pythagorean identity, \( \cos^2 \theta + \sin^2 \theta = 1 \):
\[ \cos^2 \frac{x}{2} + \sin^2 \frac{x}{2} = 1 \]
Thus, we can rewrite:
\[ \left(\cos \frac{x}{2} - \sin \frac{x}{2}\right)^2 = 1 - 2 \cos \frac{x}{2} \sin \frac{x}{2} \]
Recall that \( 2 \cos \frac{x}{2} \sin \frac{x}{2} = \sin x \) (double angle formula). Therefore:
\[ \left(\cos \frac{x}{2} - \sin \frac{x}{2}\right)^2 = 1 - \sin x \]
Now substitute back into the original equation:
\[ \cos x = \left(1 - \sin x\right) - 1 \]
This simplifies to:
\[ \cos x = -\sin x \]
Step 2: Solve the Equation
We can rewrite \( \cos x + \sin x = 0 \):
\[ \cos x = -\sin x \]
Dividing both sides by \( \cos x \) (for \( \cos x \neq 0 \)) yields:
\[ 1 = -\tan x \]
This gives:
\[ \tan x = -1 \]
Step 3: Find General Solutions
The solutions for \( \tan x = -1 \) occur when:
\[ x = \frac{3\pi}{4} + k\pi \quad (k \in \mathbb{Z}) \]
Conclusion
The complete solution set for the equation \( \cos x = \left(\cos \frac{x}{2} - \sin \frac{x}{2}\right)^2 - 1 \) is:
\[ x = \frac{3\pi}{4} + k\pi, \quad k \in \mathbb{Z} \]