# Finding the posterior distribution of a Bayesian analysis prior

I have a prior distribution $$f(x)=\pi cos(\pi x)$$ where $$x$$ is the probability of getting tails in a coin toss. Should a coin toss result in tails, how would this be reflected in the posterior distribution?

Would the posterior distribution simply be $$f(x)=\pi cos(\pi/2)$$, as $$P(x)=1/2$$?

Thank you!

• Is $x$ in $[0,0.5]$? May 11, 2019 at 19:29
• Hi gunes, $x$ is in [0,1] May 11, 2019 at 19:30
• Then, $f(x)$ is not a valid PDF, since it is negative after $0.5$. May 11, 2019 at 19:31

## 2 Answers

If your prior is made valid, e.g. as in your comment, $$f(x)=\pi/2\sin(\pi x)$$, you can find the posterior via Bayes Rule ($$D$$ denotes your experiment): $$f(x|D)=\frac{p(D|x)f(x)}{p(D)}\propto p(D|x)f(x)=x\pi/2\sin(\pi x)$$ $$p(D|x)=x$$ because we have only one toss and it is tails. Finally, we need to normalize this expression by calculating the following integral and dividing the expression by it: $$Z=\pi/2\int_0^1 x\sin(\pi x)dx\rightarrow f(x|D)=\frac{1}{Z}x\pi/2\sin(\pi x)$$

• Hi gunes, thank you so much! If this were two tails, how would the $p(D|x)$ function change? May 11, 2019 at 20:11
• Thank you! Can I ask you one more question regarding this.. in order to calculate posterior probability, would the function need to be integrated at a certain value? May 11, 2019 at 20:24
• You should just calculate $Z$ above. I didn't get what you mean by integrating at a certain value. May 11, 2019 at 20:26
• thank you for your help! May 11, 2019 at 20:43
• @Sarina if it were two tails: $p(D|x)=x^2$ May 12, 2019 at 4:13

If $$f(x)\propto x\,\sin \pi x\Bbb 1_{(0,1)}(x)$$, then $$\int_0^1 x\,\sin \pi x\,\text{d}x=\pi^{-2}\int_0^\pi x\,\sin x\,\text{d}x=\pi^{-2}\underbrace{\left[-x\cos x\right]_0^\pi}_{=\pi-0}+\pi^{-2}\underbrace{\int_0^\pi \cos x\,\text{d}x}_{=0}=\pi^{-1}$$ therefore $$f(x)=\pi x \sin \pi x$$