Calculating the Posterior Distribution i'm trying to solve a question from my lecture notes.
given a geometric distribution with parameter $a \in [0,1]$ has PMF
$$p(k) = (1-a)^{k-1}a,\quad k = 1,2,3\dots$$
Let $\Theta = \theta$ , $X$ follows a geometric distribution with the following prior distribution
$f_\Theta(\theta) = 2\theta $ for $\theta \in [0,1]$
Here's what I have so far:
$f_{\theta | X}(\theta|X)=cf_{x|\theta}(x | \theta)f_\Theta(\theta)$
$2\theta c(1-a)^{k-1}a$
$2ac\theta(1-a)^{k-1}$
I know this should be a $\operatorname{Beta}(3,x_1)$ distribution would really appreciate any help or guidance on how to make it to the posterior!
 A: I assume the hierarchical model is
$$\Theta \sim \operatorname{Beta}(2,1), \quad f_\Theta(\theta) = 2\theta, \quad \theta \in [0,1] \\ X \mid \Theta \sim \operatorname{Geometric}(\Theta), \quad \Pr[X = x \mid \Theta = \theta] = (1-\theta)^{x-1} \theta, \quad x \in \{1, 2, \ldots\}.$$  Then the posterior density of $\Theta$ given a single observation $X = x$ is $$f_{\Theta \mid X} (\theta \mid x) = \frac{\Pr[X = x \mid \Theta = \theta]f_\Theta(\theta)}{\Pr[X = x]}, \tag{1}$$ where the denominator is the unconditional or marginal probability of $X = x$.  But since this denominator does not depend on $\theta$, we can simply compute the likelihood in the numerator and recognize the kernel of the result:
$$\Pr[X = x \mid \Theta = \theta]f_\Theta(\theta) = 2 (1 - \theta)^{x-1} \theta^2, \tag{2}$$ which is proportional to a beta distribution whose posterior hyperparameters are $a = 3$ and $b = x-1$; i.e., the full density is $$f_{\Theta \mid X}(\theta \mid x) = \frac{\Gamma(x + 3)}{\Gamma(3) \Gamma(x)} \theta^{3-1} (1-\theta)^{x-1} = \frac{(x+2)(x+1)x}{2} \theta^2 (1-\theta)^{x-1}, \quad \theta \in [0,1]. \tag{3}$$
Now, if you did not recognize that the kernel is beta (notwithstanding the fact that the beta distribution is a conjugate prior for a geometric likelihood), we can explicitly compute the marginal distribution of $X$ from Equation $(2)$:  $$\Pr[X = x] = \int_{\theta = 0}^1 \Pr[X = x \mid \theta = \theta]f_\Theta(\theta) \, d\theta = \int_{\theta = 0}^1 2(1-\theta)^{x-1}\theta^2 \, d\theta.$$  With the substitution $$u = 1-\theta, \quad du = -d\theta,$$ we get $$\begin{align}
\Pr[X = x] &= 2 \int_{u=0}^1 (1-u)^2 u^{x-1} \, du \\
&= 2 \int_{u=0}^1 u^{x-1} - 2u^x + u^{x+1} \, du \\
&= 2 \left[ \frac{u^x}{x} - \frac{2u^{x+1}}{x+1} + \frac{u^{x+2}}{x+2} \right]_{u=0}^1 \\
&= 2 \left( \frac{1}{x} - \frac{2}{x+1} + \frac{1}{x+2} \right) \\
&= \frac{4}{x(x+1)(x+2)}. \end{align}$$
Then we substitute back into Equation $(1)$:
$$f_{\Theta \mid X}(\theta \mid x) = \frac{2(1-\theta)^{x-1} \theta^2}{\frac{4}{x(x+1)(x+2)}} = \frac{(x+2)(x+1)x}{2} \theta^2 (1 - \theta)^{x-1},$$ which is the same as Equation $(3)$.
This exercise is more challenging if you observe more of the $X$; e.g., if we observe an iid sample of size $n$.
