# How do I show that $Var(Y) = n\frac{(\theta _{1} - \theta _{2})^{2}}{(n+1)^{2} (n+2)}$?

My original pdf is $f(y) = \frac{n (y_{n} - \theta_{1})^{n-1}}{(\theta_{2} - \theta_{1})^{n}}$ for $\theta_{1} < y < \theta_{2}$.

After using U-substitution, I obtain $E(Y) = \frac{n \theta_{2} + \theta_{1}}{(n+1)}$.

For variance of $Y$, I need to find $E(Y^2)$ first.

This is what I have with U-substitution: $E(Y^2) = \frac{n\theta_{2} - n \theta_{1} + 2n \theta_{1} \theta_{2} - n\theta_{1}^{2} + \theta_{1}^{2}}{(n+1)}$.

But with this the $Var(Y)= E(Y^2) - \left [E(Y) \right ]^{2} \neq n\frac{(\theta _{1} - \theta _{2})^{2}}{(n+1)^{2} (n+2)}$

My mistake is definitely the $E(Y^2)$ part, so I would appreciate it if someone here can go over it with me.

Edit: $$\begin{eqnarray} \mathbb{E}\left(Y^2\right) &=& \mathbb{E}\left(\left(Y-\theta_1\right)^2\right) + 2 \theta_1 \cdot \mathbb{E}\left(\left(Y-\theta_1\right)\right) + \theta_1^2 \\ &=& \frac{n}{n+2} \left(\theta_2-\theta_1\right)^2 + 2 \theta_1 \cdot \frac{n}{n+1} \left(\theta_2-\theta_1\right) + \theta_1^2 \end{eqnarray}$$ from below and also my own work.

But now how do I simplify $$Var(Y) = \mathbb{E}\left(Y^2\right) - \left [ \mathbb{E}\left(Y\right) \right ]^{2}$$ to $$Var(Y) = n\frac{(\theta _{1} - \theta _{2})^{2}}{(n+1)^{2} (n+2)}?$$

Instead of $\theta_1$ and $\theta_2$ I will use $a$ and $b$.

For the expectation of $Y^2$, we want $$\int_a^b \frac{ny^2(y-a)^{n-1}}{(b-a)^n}\,dy.$$ If we let $u=y-a$, then $y^2=u^2+2au+a^2$. So we want $$\frac{n}{(b-a)^n}\int_{u=0}^{b-a} \left(u^{n+1}+2au^{n}+a^2u^{n-1}\right)\,du.$$ This is, after minor simplification, equal to $$\frac{n}{n+2}(b-a)^{2}+\frac{2an}{n+1}(b-a)+a^2.$$

A similar but simpler calculation shows that $E(Y)=\frac{n}{n+1}(b-a)+a$.

The calculation of $E(Y^2)-(E(Y))^2$ is simple, since there is some nice cancellation. We get $$(b-a)^2\left(\frac{n}{n+2}-\frac{n^2}{(n+1)^2}\right),$$ which simplifies to $$(b-a)^2\frac{n}{(n+2)(n+1)^2}.$$

• Yes, I have calculated $E(Y^2)$ again and have found what you've found. But after that how do I get the variance? It's becoming really tedious from here.
– OGC
Commented Sep 27, 2014 at 2:34
• I added some stuff, it is not complicated. You had the wrong mean. Commented Sep 27, 2014 at 2:58
• You are welcome. Your basic strategy worked well. Commented Sep 27, 2014 at 23:20

Instead of $\mathbb{E}(Y^2)$ consider $$c_2 =\mathbb{E}\left(\left(Y-\theta_1\right)^2\right) = \int_{\theta_1}^{\theta_2} \frac{n}{\left(\theta_2-\theta_1\right)^n} \left(y-\theta_1\right)^{n+1} \mathrm{d} y = \frac{n}{n+2} \left(\theta_2-\theta_1\right)^2$$ Similarly $$c_1 = \mathbb{E}\left(\left(Y-\theta_1\right)\right) = \frac{n}{n+1} \left(\theta_2-\theta_1\right)$$ Now clearly $$\begin{eqnarray} \mathbb{E}\left(Y^2\right) &=& \mathbb{E}\left(\left(Y-\theta_1\right)^2\right) + 2 \theta_1 \cdot \mathbb{E}\left(\left(Y-\theta_1\right)\right) + \theta_1^2 \\ &=& \frac{n}{n+2} \left(\theta_2-\theta_1\right)^2 + 2 \theta_1 \cdot \frac{n}{n+1} \left(\theta_2-\theta_1\right) + \theta_1^2 \end{eqnarray}$$

The conceptual way to do this is to recognize that $Y$ is a location-scale transformation of a beta distribution. If $f_Y(y) \propto (y-\theta_1)^{n-1}$ for $y \in [\theta_1, \theta_2]$, then this suggests the linear, order-preserving transformation $$X = g(Y) = \frac{Y-\theta_1}{\theta_2 - \theta_1}.$$ Then $Y = g^{-1}(X) = (\theta_2 - \theta_1)X + \theta_1$, and the PDF of $X$ is given by $$f_X(x) = f_Y(g^{-1}(x)) \left| \frac{dg^{-1}}{dx} \right| = nx^{n-1}, \quad x \in [0,1].$$ We immediately recognize that $X \sim \mathrm{Beta}(a = n, b = 1)$. Hence \begin{align*} \mathrm{E}[X] &= \frac{a}{a+b} = \frac{n}{n+1}, \\ \mathrm{Var}[X] &= \frac{ab}{(a+b)^2(a+b+1)} = \frac{n}{(n+1)^2(n+2)}. \end{align*} Since $Y = (\theta_2 - \theta_1)X + \theta_1$, it immediately follows that $\mathrm{Var}[Y] = (\theta_2-\theta_1)^2 \mathrm{Var}[X]$ and the result is proven.

In the event that we wish to derive the variance of $X$ directly from its PDF, the computation is a trivial exercise in integration: $$\mathrm{E}[X^k] = \int_{x=0}^1 x^k nx^{n-1} \, dx = n \int_{x=0}^1 x^{n+k-1} \, dx = n \left[\frac{x^{n+k}}{n+k} \right]_{x=0}^1 = \frac{n}{n+k}.$$ Thus $$\mathrm{Var}[X] = \mathrm{E}[X^2] - \mathrm{E}[X]^2 = \frac{n}{n+2} - \Bigl(\frac{n}{n+1}\Bigr)^2 = \frac{n}{(n+1)^2(n+2)}.$$