# Transformation of density and $W=(X+Y+Z)^2$

I want to solve this exercise with the transformation formula, what did I do wrong in my solution?:

Let $X,Y,Z$ be independent random variables with uniform distribution on [0,1]. What's the expectation value of $(X+Y+Z)^2$

Solution:

The transformation formula is $$f_{W,Y,Z}=f_{X,Y,Z}|\operatorname{det}(J_{T^{-1}})|$$ to calculate a joined density. Lets define a transformation $T$

$T(X,Y,Z)=\left((X+Y+Z)^2,Y,Z\right)\qquad T([0,1],[0,1],[0,1])={[0,9],[0,1],[0,1]}$

Then $T^{-1}(W,Q,R)=(\sqrt{W}-Q-R,Q,Z)$

The jacobi matrix is

$$J_T^{-1} = \begin{pmatrix}\frac{1}{2\sqrt{w}} & -1 & -1\\ 0 & 1 &0\\ 0 & 0 & 1\end{pmatrix}$$

$$det( J_{T^{-1}}) = \frac{1}{2\sqrt{w}}$$ $$f_{W,Q,R}=f_{X,Y,Z}(\sqrt{W}-Q-R,Q,R)\frac{1}{2\sqrt{w}}=\mathrm{1}_{q\in(0,1)}\mathrm{1}_{r\in(0,1)}\frac{1}{2\sqrt{w}}=\mathrm{1}_{r\cap q\in(0,1)}\frac{1}{2\sqrt{w}}$$

So we integrate with respect to $q$ and $r$ $$f_{W}=\int\limits_{0}^1 \int\limits_{0}^1\frac{1}{2\sqrt{w}}\mathrm{d}r\mathrm{d}q$$

Now the expectation value is $$E[W]=\int\limits_{0}^9 w f_{W}\mathrm{d}w= \int\limits_0^9 \frac{w}{2 \sqrt{(w)}} \mathrm{d}w = 9$$

The solution says it's $5/2$ and I know that I can solve it with the expansion of $(X+Y+Z)^2$, but I want to solve it with the transformation rule so what did I do wrong?

• Your $f_{WQR}$ is incorrect - it needs a third indicator term $\mathbf{1}_{\{0<\sqrt{w} - q -r <1\}}$. Also, this is a needlessly complex way to go about this. Exploit the independence of the RVs to directly calculate the second moment, the joint density is not required. <Include rant about appropriate tool for the job> – stochasticboy321 Jul 11 '16 at 11:48
• @stochasticboy321 Thank you very much for the answer. But I don't understand why I need this indicator function that depends on all 3 variables, can I not just put the interval $[0,1]^3$ into the transformation and then I get $[0,9]\times [0,1]\times[0,1]$? – Matriz Jul 11 '16 at 15:33

## 1 Answer

I think you are quite over-complicating it.
If $X,Y,Z$ are uniformly distributed over $[0,1]$ and independent, $$\begin{eqnarray*}E=\mathbb{E}[(X+Y+Z)^2]&=&\iiint_{[0,1]^3}(x+y+z)^2\,d\mu\\&=&\iiint_{[0,1]^3}(x^2+y^2+z^2+2xy+2xz+2yz)\,d\mu\\&=&3\cdot\frac{1}{3}+3\cdot 2\cdot \frac{1}{4}=\color{red}{\frac{5}{2}}.\end{eqnarray*}$$ Jensen's inequality gives $E\geq \mathbb{E}[X+Y+Z]^2 = \frac{9}{4}$, and the linearity of expectation gives $$E = 3\mathbb{E}[X^2]+6\mathbb{E}[X]^2 =3\text{Var}[X]+9\mathbb{E}[X]^2$$ so $E-\frac{9}{4}$ is exactly $3\text{Var}[X]=\frac{1}{4}$.

• @Matriz Yes. If you know the joint density function, $f_{X,Y,Z}(x,y,z)$, and the support interval, $\mathcal S$, then indeed, $\mathbb E[g(X,Y,Z)] = \iiint_{\mathcal S} g(x,y,z)\,f_{X,Y,Z}(x,y,z)\operatorname d z \operatorname d y \operatorname d x$ – Graham Kemp Jul 11 '16 at 13:08
• @GrahamKemp Thanks a lot! – Matriz Jul 11 '16 at 14:51