Bayes theorem:
Let $$E_{1}, E_{2}, E_{3}...$$ be mutually exclusive and collectively exhaustive events each with a probability $$p_{1}, p_{2}, p_{3}...$$ of occurring. Let B be another event of non-zero probability such that probability of B given $$E_{1}$$ is $$q_{1}$$, B given $$E_{2}$$ is $$q_{2}$$ etc. By Bayes theorem: $$$P(E_{i}/B) = \frac{p_{i}q_{i}}{\sum_{j=1}^{n}p_{j}q_{j}}$$$