If $p = (1- \cos x)(1+ \sin x)$ and $q = (1+ \cos x)(1- \sin x)$, write the expression $$\cos^2 x - \cos^4 x - \sin2x + 2$$
in terms of $p$ and $q$.
1. Given the expressions for \( p \) and \( q \):
   \[
   p = (1 - \cos x)(1 + \sin x)
   \]
   \[
   q = (1 + \cos x)(1 - \sin x)
   \]

2. First, let's add \( p \) and \( q \):
   \[
   p + q = (1 - \cos x)(1 + \sin x) + (1 + \cos x)(1 - \sin x)
   \]
   Expanding both terms:
   \[
   p + q = (1 - \cos x + \sin x - \cos x \sin x) + (1 + \cos x - \sin x - \cos x \sin x)
   \]
   Simplifying:
   \[
   p + q = 1 - \cos x + \sin x - \cos x \sin x + 1 + \cos x - \sin x - \cos x \sin x
   \]
   \[
   p + q = 2 - 2 \cos x \sin x
   \]
   Using the double-angle identity for sine, \(\sin 2x = 2 \sin x \cos x\):
   \[
   p + q = 2 - \sin 2x
   \]

3. Next, let's multiply \( p \) and \( q \):
   \[
   p \cdot q = (1 - \cos x)(1 + \sin x)(1 + \cos x)(1 - \sin x)
   \]
   Notice that this can be rearranged as:
   \[
   p \cdot q = [(1 - \cos x)(1 + \cos x)] \cdot [(1 + \sin x)(1 - \sin x)]
   \]
   Using the difference of squares:
   \[
   p \cdot q = (1 - \cos^2 x) \cdot (1 - \sin^2 x)
   \]
   Since \( \cos^2 x + \sin^2 x = 1 \), we have:
   \[
   1 - \cos^2 x = \sin^2 x \quad \text{and} \quad 1 - \sin^2 x = \cos^2 x
   \]
   Therefore:
   \[
   p \cdot q = \sin^2 x \cdot \cos^2 x
   \]
   \[
   p \cdot q = \cos^2 x - \cos^4 x
   \]

4. Now, we need to express \( \cos^2 x - \cos^4 x - \sin 2x + 2 \) in terms of \( p \) and \( q \):
   \[
   \cos^2 x - \cos^4 x - \sin 2x + 2 = p \cdot q - (p + q)
   \]
   Substituting the expressions for \( p \cdot q \) and \( p + q \):
   \[
   \cos^2 x - \cos^4 x - \sin 2x + 2 = (\cos^2 x - \cos^4 x) - (2 - \sin 2x)
   \]
   Simplifying:
   \[
   \cos^2 x - \cos^4 x - \sin 2x + 2 = p \cdot q - (p + q)
   \]

The final answer is \( \boxed{ p \cdot q - (p + q) } \).