# mean and variance from a probability distribution function

#### fred

##### New member
f(x)=f(x)={█(2/(√2π) e^(〖-x〗^2/2)@0 otherwise)┤for 0<x<∞

Find the mean and variance of X
The hint says, compute E(X) directly and then compute E(X2) by comparing that integral with the integral representing the variance of a variable that is N (0, 1)

#### Attachments

• 668 bytes Views: 4

#### MarkFL

Staff member
Hello fred,

I find the probability distribution function, as given, hard to interpret, and the attached file does not help me.

What do the symbols "@0" and "┤" mean?

#### Chris L T521

##### Well-known member
Staff member
f(x)=f(x)={█(2/(√2π) e^(〖-x〗^2/2)@0 otherwise)┤for 0<x<∞

Find the mean and variance of X
The hint says, compute E(X) directly and then compute E(X2) by comparing that integral with the integral representing the variance of a variable that is N (0, 1)
I'm making an educated guess with this, but is this the pdf?

$f(x)=\begin{cases} \frac{2}{\sqrt{2\pi}} e^{-x^2/2} & 0<x<\infty\\ 0 & \text{otherwise}\end{cases}$

I would recommend that you look at our LaTeX help subforums for learning how to use LaTeX on our forums.

Anyways, if that's the proper pdf, then you have that

$E[X] = \int_{-\infty}^{\infty} xf(x)\,dx\quad\text{and}\quad E[X^2]=\int_{-\infty}^{\infty}x^2f(x)\,dx$

Furthermore, they want you to evaluate $E[X^2]$ by comparing it to the variance integral for $\mathcal{N}(0,1)$. Since the pdf of $\mathcal{N}(0,1)$ is
$f(x)=\frac{1}{\sqrt{2\pi}} e^{-x^2/2}$
and since we know that $E[X]=0$, we have that
$1=\text{Var}[X]=E[X^2]-(E[X])^2=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}x^2e^{-x^2/2}\,dx$
Thus, to evaluate $\displaystyle\int_{-\infty}^{\infty} x^2f(x)\,dx$, you'll need to use the fact that $\displaystyle\int_{-\infty}^{\infty} x^2e^{-x^2/2}\,dx = \sqrt{2\pi}$.

I hope this helps!