Mathematics Bayes' Theorem, Theorem of total probability and Bayes' theorem