<s>[INST] Range of integration for joint and conditional densities Did I mess up the range of integration in my solution to the following problem ?
Consider an experiment for which, conditioned on $\theta,$ the density of $X$ is
\begin{align*}
    f_{\theta}(x) = \frac{2x}{\theta^2},\,\,0 < x< \theta.
\end{align*}
Suppose the prior density for $\theta$ is 
\begin{align*}
    \pi(\theta) = 1,\,\,\,0 \leq \theta \leq 1
\end{align*}
Find the posterior density of $\theta,$ then find $\mathbb{E}[\theta|X]$. Do the same for $X = (X_1,\dots, X_n)$
where $X_1,\dots, X_n$ are i.i.d and have the density above.\
The joint density of $\theta$ and $X$ is given by 
\begin{align*}
    f_{\theta}(x)\pi(\theta) = \frac{2x}{\theta^2},\,\,0 < x< \theta \leq 1.
\end{align*}
and so the marginal density $g(x)$ of $X$ is given by 
\begin{align*}
    g(x)=\int_{x}^1f_{\theta}(x)\pi(\theta)d\theta &= \int_{x}^1\frac{2x}{\theta^2}d\theta\\
    &=2x\int_{x}^1\theta^{-2}d\theta\\
    &=2x[-\frac{1}{\theta}]_x^1\\
    &= -2(x -1),\,\,\,0 <x<1
\end{align*}
So the posterior density of $\theta$ is 
\begin{align*}
    f_x(\theta) = \frac{f_{\theta}(x)\pi(\theta)}{g(x)} = \frac{-x}{(x-1)\theta^2}, \,\, x < \theta \leq 1
\end{align*}
and 
\begin{align*}
    \mathbb{E}[\theta|X]&= \int_{x}^1\frac{-x}{x-1}\theta^{-1}d\theta\\
    &=\frac{-x}{x-1}\ln\theta|_x^1\\
    &= \frac{x}{x-1}\ln x
\end{align*}
Now let $X = (X_1,\dots, X_n)$ where each $X_i$ has the density above. Then the joint density is 
\begin{align*}
    f_{\theta}(x)\pi(\theta) = \prod_{i = 1}^n\frac{2x_i}{\theta^2},\,\, 0 < x_{[1]} \leq x_{[n]} < \theta \leq 1
\end{align*}
and so the marginal density $g(x)$ of $X$ is given by 
\begin{align*}
    g(x)=\int_{x_{[n]}}^1f_{\theta}(x)\pi(\theta)d\theta &= \int_{x_{[n]}}^1\prod_{i = 1}^n\frac{2x_i}{\theta^2}d\theta\\
    &=\prod_{i = 1}^n2x_i\int_{x_{[n]}}^1\theta^{-2}d\theta\\
    &=\prod_{i = 1}^n2x_i[-\frac{1}{\theta}]_{x_{[n]}}^1\\
    &=\Bigg(\frac{1}{x_{[n]}} -1\Bigg) \prod_{i = 1}^n2x_i,\,\,\,0 <x<1
\end{align*}
and so the posterior density is 
\begin{align*}
    f_{x}(\theta) = \Bigg(\prod_{i = 1}^n\frac{2x_i}{\theta^2}\Bigg) \cdot \Bigg( \Bigg(\frac{1}{x_{[n]}} -1\Bigg) \prod_{i = 1}^n2x_i \Bigg)^{-1}
\end{align*}
 [/INST] The univariate case seems correct to me. The multivariate case should be as follows:
$$\begin{align*}
    g(x)=\int_{x_{[n]}}^1f_{\theta}(x)\pi(\theta)d\theta &= \int_{x_{[n]}}^1\prod_{i = 1}^n\left(\frac{2x_i}{\theta^2}\right)d\theta\\
    &=\left(\prod_{i = 1}^n2x_i\right)\int_{x_{[n]}}^1\theta^{-2n}d\theta\\
    &=\left(\prod_{i = 1}^n2x_i\right)\left[-\frac{1}{(2n-1)\theta^{2n-1}}\right]_{x_{[n]}}^1\\
    &=\left(\frac{1}{2n-1}\right)\Bigg(\frac{1}{\left(x_{[n]}\right)^{2n-1}} -1\Bigg) \left(\prod_{i = 1}^n2x_i\right),\,\,\,0 <x<1
\end{align*}$$
Then, the posterior is
$$\begin{align*}
    f_{x}(\theta) = \frac{2n-1}{\theta^{2n}} \Bigg(\frac{1}{\left(x_{[n]}\right)^{2n-1}} -1\Bigg)^{-1}, x_{[n]}<\theta\leq 1
\end{align*}$$
</s>