# Simple and direct application of Bayes Theorem

Suppose that $\theta \in \Theta=\{0,1\}$ such that $P(\theta = 0) = 0.1$. Let $X$ be a r.v such that, given $\theta=0$, $X \sim N(50,1)$ and given $\theta = 1$, $X \sim N(52,1)$. Show that the posteriori probability of $\theta=0$ is greater than the posteriori of $\theta = 1$ if and only if $$x < 51 - \frac{3}{2} \log(9)$$

My attempt Using bayes theorem

$$P(\theta = \theta|X)=\frac{P(X|\theta=\theta) P(\theta)}{\sum_\Theta P(X|\theta=\theta) P(\theta)}$$

We note that the denominator is common for both values of theta. Then we need to compare $$P(X|\theta=0) P(\theta=0) \text{ and } P(X|\theta=1) P(\theta=1)$$

$\Rightarrow P(X|\theta=0) P(\theta=0) > P(X|\theta=1) P(\theta=1) \iff 0.1 \frac{1}{\sqrt{2 \pi}} e^{\frac{-(x-50)^2}{2}} > 0.9 \frac{1}{\sqrt{2 \pi}} e^{\frac{-(x-52)^2}{2}}$

$\Rightarrow \frac{-(x-50)^2}{2} > \log(9) + \frac{-(x-52)^2}{2} \iff x^2 - 100x + 2500 < x^2 - 104x + 2704 - 2 \log(9) \iff x < 51 - \frac{1}{2} \log(9)$

I wonder if I am missing something, because I couldn't find out from where this 3 camed from.

Thanks!

As far as I am concerned you are right and that seems to be a typo.

grid <- seq(40,60,0.05)

posterior <- function(theta, x) {
z = 0
if(theta==0) {
z = 0.1
m = 50
} else if(theta==1) {
z = 0.9
m = 52
}
return((dnorm(x, mean=m, sd=1)*z)/(dnorm(x ,mean=50,s d=1)*0.1
+ dnorm(x, mean=52,s d=1)*0.9))
}

par(lwd=2)
plot(x=grid, y=posterior(theta=0,x=grid), type="l",
col="red3", ylab="Posterior Probability", xlab="")
lines(x=grid, y=posterior(theta=1, x=grid), col="steelblue")
abline(v=51-0.5*log(9), lty=2)
legend(x = 40, y=0.8, legend=c(expression(paste(theta, " = ", 0)),
expression(paste(theta, " = ", 1))),
col=c("red3", "steelblue"), lty=c(1,1),
lwd=c(2,2), bty= "n")
mtext(text = expression(paste("51 - 0.5 ", log(9))))