If $A$ and $B$ are independent, when are they conditionally independent on $C$? This problem comes from Grimmett's Probability and Random Processes Problem 1.5.5.

Suppose that A and B are conditionally independent events given $C$, and they are also
  conditionally independent given $C^c$, and that $0 < P(C) < 1$. Prove that $A$ and $B$ are
  independent if and only if either
  $$ P(A|C) = P(A|C^c) $$
  or 
  $$ P(B|C) = P(B|C^c) $$

My attempt:
I was able to show that if $P(A|C)=P(A|C^c)$, then $A$ and $B$ are independent. I did it by using the Partioning Theorem on $A$ and $B$, multiplying $P(A)$ and $P(B)$, and showing that it was equal to $P(A \cap B)$.
The reverse direction has been much more difficult for me. Intuitively, the statement makes sense. If $A$ and $B$ are separately independent and conditionally independent given $C$, then you would expect either $A$ and $C$ or $B$ and $C$ to be independent, but I can't seem to find the formalism. My attempt was to partition the intersection and get the result algebraically:
$$ P(A)P(B) = P(A \cap B) = P(A \cap B | C)P(C) + P(A \cap B | C^c)P(C^c) $$
$$ = \ldots = \left[P(A|C)-P(A|C^c))\right]P(B \cap C) + P(A | C^c)P(B)$$
I'd like to match terms and say that since $P(BC)$ does not appear in $P(A)P(B)$, then $P(A|C)-P(A|C^c)=0$, but I don't think I can formally.
I may be taking the wrong approach (or an unnecessarily complicated approach). I would appreciate it if anyone could drop a hint on this. Thanks!
 A: To prove that if $A$ and $B$ are independent, then $P(A|C) = P(A|C^c)$ or $P(B|C) = P(B|C^c)$, you take the difference of $P(A \cap B)$ and $P(A)P(B)$ which we know are equal because $A$ and $B$ are independent.
Write $P(A \cap B)$ conditioned on $C$, and use the fact that $A$ and $B$ are conditionally independent on $C$ to write
$$ P(A \cap B) = P(A|C)P(B|C)P(C) + P(A|C^c)P(B|C^c)P(C^c). $$
Next write $P(A)$ and $P(B)$ conditioned on $C$.
$$ P(A)P(B) = \left[P(A|C)P(C)+P(A|C^c)P(C^c)\right]\left[P(B|C)P(C)+P(B|C^c)P(C^c)\right] $$
$$ = P(A|C)P(B|C)P(C)^2 + \left[P(A|C)P(B|C^c)+P(B|C)P(A|C^c)\right]P(C)P(C^c)+P(A|C^c)P(B|C^c)P(C^c)^2 $$
Now we subtract the two
$$ P(A \cap B) - P(A)P(B) = $$
$$ P(A|C)P(B|C)P(C)(1-P(C)) + P(A|C^c)P(B|C^c)P(C^c)(1-P(C^c)) - \left[P(A|C)P(B|C^c)+P(B|C)P(A|C^c)\right]P(C)P(C^c) $$
$$ = P(C)P(C^c)\left[P(A|C)P(B|C)+P(A|C^c)P(B|C^c)-P(A|C)P(B|C^c)-P(B|C)P(A|C^c)\right]$$
$$ = P(C)P(C^c)\left[(P(A|C)-P(A|C^c)(P(B|C)-P(B|C^c))\right] = 0$$
Since $0 < P(C) < 1$, we must have either $P(A|C)=P(A|C^c)$ or $P(B|C)=P(B|C^c)$.
A: I think that $A$ and $B$ are conditionally independent on $C$ does not imply that $A$ and $B$ are conditionally independent on the complementary set of $C$，which means that we cannot derive
$P(AB)=P(A|C)P(B|C)P(C)+P(A|C^c)P(B|C^c)P(C^c). C^c$ represents the complimentary set of $C$.
An example is, we toss flip three times, $A=(HHH, THH, HHT), B=(HHH,TTH,HHT,TTT), C=(HHH, HTH, THH,TTH)$, and $C^c=(HHT,HTT,THT,TTT)$.
In this example, $A$ and $B$ are conditionally independent on $C$, but not on the commplement of $C$.
