I was following along with an example given here in which we are trying to classify emails as spam ($S \in \{0, 1\}$) based on the occurrence of the words "buy" ($B \in \{0, 1\}$) and "cheap" ($C \in \{0, 1\}$). From the example, we know the following: $$ \begin{align} P(S=1) &= 0.25\\ P(B=1) &= 0.25\\ P(C=1) &= 0.25\\ P(B=1|S=1) &= 0.8\\ P(B=1|S=0) &= 0.067\\ P(C=1|S=1) &= 0.6\\ P(C=1|S=0) &= 0.133 \end{align} $$ Furthermore, from Bayes rule, we can obtain: $$ \begin{align} P(S=1|B=1) = \frac{P(B=1|S=1)P(S=1)}{P(B=1)} = \frac{(0.8)(0.25)}{0.25} = 0.8\\ P(S=1|C=1) = \frac{P(C=1|S=1)P(S=1)}{P(C=1)} = \frac{(0.6)(0.25)}{0.25} = 0.6 \end{align} $$
Using a naive Bayes classifier, we have that $P(B, C | S) = P(B|S)P(C|S)$. Thus, we find that: $$ \begin{align} P(S | B,C) &= \frac{P(B, C| S) P(S)}{P(B, C)}\\ &= \frac{P(B|S)P(C|S)P(S)}{P(B)P(C)} \mbox{ (by assumption)} \tag{1} \end{align} $$
We can rewrite this last line as $\frac{P(S|B)P(S|C)}{P(S)}$ by using Bayes rule: $$ \begin{align} \frac{P(B|S)P(C|S)P(S)}{P(B)P(C)} &= \frac{P(B|S)P(S)}{P(B)}\frac{P(C|S)P(S)}{P(C)}\frac{1}{P(S)} \tag{2a}\\ &= \frac{P(S|B)P(S|C)}{P(S)} \tag{2b} \end{align} $$
Upon substituting, we get: $$ \begin{align} P(S=1|B=1,C=1) &= \frac{P(S=1|B=1)P(S=1|C=1)}{P(S=1)}\\ &= \frac{(0.8)(0.6)}{0.25}\\ &= 1.92 \end{align} $$ which clearly doesn't make sense since probabilities must be between 0 and 1. On the other hand, we can also write: $$ \begin{align} P(S=1|B=1,C=1) &= \frac{P(B=1|S=1)P(C=1|S=1)P(S=1)}{P(B=1)P(C=1)} \tag{3}\\ &= \frac{P(B=1|S=1)P(C=1|S=1)P(S=1)}{\sum_{S \in \{0,1\}}P(B=1|S)P(C=1|S)P(S)}\\ &= \frac{(0.8)(0.6)(0.25)}{(0.067)(0.133)(0.75) + (0.8)(0.6)(0.25)}\\ &= 0.947 \end{align} $$
Why does the second formula work out while the first does not?