# Find variance of g(x)

• March 11th 2010, 03:39 AM
downthesun01
Find variance of g(x)
I'm having trouble getting the answer here.

$g(X)=3X-2$

Density function:
$f(x)=\left\{\begin{array}{cc}\frac{1}{4}e^\frac{-x}{4},&\mbox{ if }x>0 \\0, & \mbox{ elsewhere }\end{array}\right.$

I used:

$var(g(X))=E(g(X)^2)-[E(g(X))]^2$

So I got:

$E(g(X))= \int g(X)f(x)=\int(3X-2)(\frac{1}{4}e^\frac{-x}{4})$

$=\int\frac{3}{4}Xe^\frac{-x}{4}-\int\frac{1}{2}e^\frac{-x}{4}$

$=\frac{3}{4}[-4Xe^\frac{-x}{4}+4\int e^\frac{-x}{4}dx]-\int\frac{1}{2}e^\frac{-x}{4}$

$=\frac{3}{4}[-4Xe^\frac{-x}{4}-16 e^\frac{-x}{4}]+2e^\frac{-x}{4}$

$=-3Xe^\frac{-x}{4}-10e^\frac{-x}{4}\mid \begin{array}{cc}\infty\\0\end{array}$

$=0-(-10)=10$

Nevermind, I think I've got it right but if someone would double check my work that'd be great. Thanks.
However, the answer should be 10, so the signs are switched up somewhere in there but I can't find where. Apparently, this first part of the problem is the only part that's wrong. If someone could help me, that'd be awesome. After typing the second part out and redoing the math, see that it's right.

$E(g(X)^2)= \int(3X-2)^2 f(x) = \int(9X^2 -12X+4)(\frac{1}{4}e^\frac{-x}{4})$

$=\frac{9}{4}\int X^2 e^\frac{-x}{4}-3\int Xe^\frac{-x}{4}+\int e^\frac{-x}{4}$

$=\frac{9}{4}[X^2 e^\frac{-x}{4}+4\int 2Xe^\frac{-x}{4}]-3\int Xe^\frac{-x}{4}+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+8[-4Xe^\frac{-x}{4}+4\int e^\frac{-x}{4}]]-3\int Xe^\frac{-x}{4}+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+8[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]]-3\int Xe^\frac{-x}{4}+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+8[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]]-3[-4Xe^\frac{-x}{4}+4\int e^\frac{-x}{4}]+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+4[-8Xe^\frac{-x}{4}-16e^\frac{-x}{4}]]-3[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+8[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]]-3[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]-4e^\frac{-x}{4}$

$=-9X^2e^\frac{-x}{4}-72Xe^\frac{-x}{4}-288e^\frac{-x}{4}+12Xe^\frac{-x}{4}+48e^\frac{-x}{4}-4e^\frac{-x}{4}$

$=-9X^2e^\frac{-x}{4}-60Xe^\frac{-x}{4}-244e^\frac{-x}{4}\mid \begin{array}{cc}\infty\\0\end{array}$

$=0-(0-0-244)=244$

This part is correct because the final answer is supposed to be 144

So finally:

$var(g(X))= 244-(-10)^2= 144$

It's the right answer, but for the first part it should be 10, not-10.
• March 11th 2010, 03:52 AM
mr fantastic
Quote:

Originally Posted by downthesun01
I'm having trouble getting the answer here.

$g(X)=3X-2$

Density function:
$f(x)=\left\{\begin{array}{cc}\frac{1}{4}e^\frac{-x}{4},&\mbox{ if }x>0 \\0, & \mbox{ elsewhere }\end{array}\right.$

I used:

$var(g(X))=E(g(X)^2)-[E(g(X))]^2$

So I got:

$E(g(X))= \int g(X)f(x)=\int(3X-2)(\frac{1}{4}e^\frac{-x}{4})$

$=\int\frac{3}{4}Xe^\frac{-x}{4}-\int\frac{1}{2}e^\frac{-x}{4}$

$=\frac{3}{4}[-4Xe^\frac{-x}{4}+4\int e^\frac{-x}{4}dx]-\int\frac{1}{2}e^\frac{-x}{4}$

$=\frac{3}{4}[-4Xe^\frac{-x}{4}-16 e^\frac{-x}{4}]+2e^\frac{-x}{4}$

$=-3Xe^\frac{-x}{4}-10e^\frac{-x}{4}\mid \begin{array}{cc}\infty\\0\end{array}$

$=0-(-10)=10$

Nevermind, I think I've got it right but if someone would double check my work that'd be great. Thanks.
However, the answer should be 10, so the signs are switched up somewhere in there but I can't find where. Apparently, this first part of the problem is the only part that's wrong. If someone could help me, that'd be awesome. After typing the second part out and redoing the math, see that it's right.

$E(g(X)^2)= \int(3X-2)^2 f(x) = \int(9X^2 -12X+4)(\frac{1}{4}e^\frac{-x}{4})$

$=\frac{9}{4}\int X^2 e^\frac{-x}{4}-3\int Xe^\frac{-x}{4}+\int e^\frac{-x}{4}$

$=\frac{9}{4}[X^2 e^\frac{-x}{4}+4\int 2Xe^\frac{-x}{4}]-3\int Xe^\frac{-x}{4}+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+8[-4Xe^\frac{-x}{4}+4\int e^\frac{-x}{4}]]-3\int Xe^\frac{-x}{4}+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+8[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]]-3\int Xe^\frac{-x}{4}+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+8[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]]-3[-4Xe^\frac{-x}{4}+4\int e^\frac{-x}{4}]+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+4[-8Xe^\frac{-x}{4}-16e^\frac{-x}{4}]]-3[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]+\int e^\frac{-x}{4}$

$=\frac{9}{4}[-4X^2 e^\frac{-x}{4}+8[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]]-3[-4Xe^\frac{-x}{4}-16e^\frac{-x}{4}]-4e^\frac{-x}{4}$

$=-9X^2e^\frac{-x}{4}-72Xe^\frac{-x}{4}-288e^\frac{-x}{4}+12Xe^\frac{-x}{4}+48e^\frac{-x}{4}-4e^\frac{-x}{4}$

$=-9X^2e^\frac{-x}{4}-60Xe^\frac{-x}{4}-244e^\frac{-x}{4}\mid \begin{array}{cc}\infty\\0\end{array}$

$=0-(0-0-244)=244$

This part is correct because the final answer is supposed to be 144

So finally:

$var(g(X))= 244-(-10)^2= 144$

It's the right answer, but for the first part it should be 10, not-10.

Life is much much easier if you just use the simple fact that Var(3X - 2) = 3^2 Var(X). Now note that Var(X) = 16 (see here: Exponential distribution - Wikipedia, the free encyclopedia)
• March 11th 2010, 04:15 AM
downthesun01
You're so right. I completely forgot about that. We just went over it in class on Tuesday. Thanks for the input.