calculate posterior probability $\pi(\theta < 0.5 | X = 2)$

The random variable $$X∼Binomial(n= 2,θ)$$ and $$θ∼Uniform(0,1)$$. Calculate the posterior probability $$Π(θ <0.5|X= 2)$$.

Solution:

$$θ|X∼Beta (1 +x,1 +n−x)$$

$$θ|X= 2∼Beta (1 + 2,1 + 2−2) = Beta(3,1)$$ $$i.e. \pi(\theta | X= 2) = 3 \theta^2$$

$$Π(θ <0.5|X= 2) =\int_{0}^{0.5}3θ^2dθ =1/8$$.

Why is $$θ|X∼Beta (1 +x,1 +n−x)$$? I don't understand how they came up with that.

Also I don't understand how $$i.e. \pi(\theta | X= 2) = 3 \theta^2$$ for beta$$(3, 1)$$.

• Seem the prior distribution (unmentioned in your question) may have been $\theta \sim UNIF(0,1) \equiv BETA(1,1).$ Then with data $n = x = 2,$ you'd have posterior dist'n $BETA(3,1).$ Result is from multiplying Prior $\times$ Likelihood to get Posterior according to Bayes' Thm. – BruceET Apr 12 at 0:33

Let $$\text{Unif}(0,1)$$ be a prior distribution on $$\theta$$, $$p(\theta)=1$$ on $$(0,1)$$. Thus, the prior is just a constant (equal 1).
The likelihood for a single data point is the binomial pmf $$p(x|\theta)=$$ $$n \choose x$$ $$\theta^{x}(1-\theta)^{n-x}$$.
Then, the posterior distribution, $$p(\theta| \text{data}=x)$$ is proportional to a multiple of prior and likelihood:
$$p(\theta| x) \propto \theta^{x}(1-\theta)^{n-x}.$$
Note that we treat the RHS as a function of $$\theta$$ and drop the multiplying constants, such as $$n \choose x$$.
Now, you need to recognize the RHS as a form of a density (of $$\theta$$) and it is a Beta density with parameters $$x+1$$ and $$n-x+1$$ (see the definition to convince yourself). In particular, for $$n=2, x=2$$, $$p(\theta|x)=3\theta^2$$.