# Statistics: Finding posterior distribution given prior distribution & R.Vs distribution

I'm now learning Bayesian inference.This is one of the questions I'm doing.

Suppose we have R.V.s $X_1,X_2,\ldots,X_n$ each have an Exponential distribution with parameter $\theta$. and prior for $\theta$ is an Exponential distribution with parameter $\lambda$. So what would you do to find posterior?

Attempts: Prior should be PDF of exponential with parameter $\lambda$. Likelihood should be product of PDF of exponential of each $X_i$, with parameter $\theta$.

Then what would you do next?

Many thanks.

By definition, for every $x=(x_1,\ldots,x_n)$, $$f(\theta\mid x)\propto f(x\mid\theta)f(\theta)=\theta^n\mathrm e^{-s\theta}\cdot\lambda\mathrm e^{-\lambda\theta}\propto\theta^n\mathrm e^{-(s+\lambda)\theta},$$ where $s=x_1+\cdots+x_n$. For every positive $z$, $$\int_0^{+\infty}\theta^n\mathrm e^{-z\theta}\mathrm d\theta=\frac{n!}{z^{n+1}},$$ hence $$f(\theta\mid x)=\frac1{n!}(s+\lambda)^{n+1}\theta^n\mathrm e^{-(s+\lambda)\theta},$$ that is, $f(\ \mid x)$ is the Gamma $(n+1,s+\lambda)$ distribution.
• Indeed $x$ is the observed sample.
Use the fact that: $$f(\theta|x_1,...,x_n)=\frac{L(\theta)*p(\theta)}{\int_{-\infty}^\infty L(\theta)*p(\theta)d\theta}$$ Where $L(\theta)$ is the likelihood function, $p(\theta)$ is the prior, and $f(\theta|x_1,...,x_n)$ is the posterior distribution.
In this case, you have that: $$f(\theta|x_1,...,x_n)=\frac{\theta^ne^{-\theta \sum_{i=1}^nX_i}*\lambda e^{-\lambda\theta}}{\int_0^\infty \theta^ne^{-\theta \sum_{i=1}^nX_i}*\lambda e^{-\lambda\theta} d\theta}$$