I watched Introduction To Bayesian InferenceĀ by Chris Bishop and decided to derive bayesian inference equation from scratch to make sure I follow the lecturer.

Posterior can be written as

That is definition of conditional probability (Grimmett and Stirzaker, 2001, p. 9)

Rewrite the numerator as (see Exercise (1.4.2) in Grimmett & Stirzaker or Chain rule from Wikipedia)

and apply Bayes’s formula to

then substitute

After cancelling common factors, we get posterior (since and are independent)

That has turned out to be useful for my friend so I posted it here.