Why sampling works when algebra does not
Today let's understand why sampling can find a posterior even when the neat algebra behind Bayes' rule cannot, using one real measurement problem.
A technician is checking one oven. The oven has a dial for its temperature, but the real temperature inside often drifts from what the dial says, by some fixed amount called the offset. To measure it, the technician uses a probe whose own measurement error is known from its calibration certificate, a standard deviation of 1C. The probe takes 20 independent readings of the offset, and they average 3.19C.
Before taking a single reading, the technician already held a real belief about the offset, built from years of servicing this model of oven. That belief is not a bell curve. It is a Gamma distribution with shape 4 and rate 1.3, a curve that climbs from zero, peaks, and then trails off slowly to the right.
That shape is the whole problem ahead. A Gamma prior paired with a normal likelihood from the readings has no neat formula waiting at the end, the way some other pairings do. So the only way forward is to compute, not to solve.
Bayes' rule always holds, a tidy formula rarely does
Bayes' rule always holds, no matter what shape the prior takes. In words: the posterior, what you believe about the offset after seeing the data, is proportional to the prior times the likelihood, what the data say about each candidate offset.
\[ p(\text{offset} \mid \text{data}) \;\propto\; p(\text{offset}) \times p(\text{data} \mid \text{offset}) \]
That proportionality always holds. What does not always hold is a tidy formula for the whole posterior curve. For a few special pairings, multiplying the prior by the likelihood lands you back in a named distribution, with its own mean and interval you can write down directly. Statisticians call a pairing like that a conjugate prior. A Beta prior paired with a count of successes and failures is one such pair.
The Gamma prior on this oven's offset, paired with the normal likelihood from the 20 readings, is not conjugate. So there is no formula waiting at the end for its mean, its spread, or anything else about it.
Even without a formula for the whole curve, you can still compare how spread out the prior's own belief is against how spread out the data's signal is. Run this.
The prior puts the middle 90% of its belief between about 1.05 and 5.96, a wide range built from years of guessing rather than from any single reading. The data, by contrast, pin the offset down to within about 0.224C of the sample average, since that is sigma over the square root of 20 readings. The data pin the offset down far more precisely here than the prior does, and that is going to matter later.