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) $$
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!