Find $\displaystyle E(X)$ and $\displaystyle Var(X)$ for the random variable $\displaystyle X$ with probability density function proportional to:
$\displaystyle e^{-x^2+x}$
Find $\displaystyle E(X)$ and $\displaystyle Var(X)$ for the random variable $\displaystyle X$ with probability density function proportional to:
$\displaystyle e^{-x^2+x}$
First, and very much most importantly, you must specify a DOMAIN. I'm going to guess you mean $\displaystyle [-\infty,\infty]$, but [-5,5] is about the same on this one. Please think about complete definitions. Your life WILL be better.
With that, we can solve the silly "proportional" word. The probability, whatever it is, must sum to unity.
$\displaystyle \int_{-\infty}^{\infty}a\cdot e^{x-x^{2}}\;dx = 1$
Solve for 'a'. I get a = 1.3153602668. You may have to employ some numerical methods.
Can you take it from there? Calculating the first two moments seems a good way to proceed.
Ok, so once we find a, to find the expected value and variance, do I do the following?
$\displaystyle E(X)=1.32\int_{-\infty}^{\infty}xe^{x-x^2}\;dx$
$\displaystyle Var(X)=1.32\int_{-\infty}^{\infty}x^2e^{x-x^2}\;dx-[E(X)]^2$
By the way, what's an easy way of integrating that?
you need to use integration by parts for both i think.
Since different people use different notation for integration by parts, here is how i write it:
$\displaystyle \int uv' = \left[uv \right] - \int u'v$
For E(X) use
$\displaystyle v'=xe^{-x^2}$
$\displaystyle v = -0.5e^{-x^2}$
$\displaystyle u=e^{x}$
$\displaystyle u'=e^{x}$
Integration by parts:
$\displaystyle \int_{-\infty}^{\infty} xe^{x-x^2} = \left[uv \right]_{-\infty}^{\infty} - \int_{-\infty}^{\infty} -0.5e^{-x^2}e^{x}$
$\displaystyle \int_{-\infty}^{\infty} xe^{x-x^2} = \left[uv \right]_{-\infty}^{\infty} + 0.5 \int_{-\infty}^{\infty} e^{x-x^2}$
You can recognise the integral on the RHS as the pdf multiplied by a constant $\displaystyle \frac{0.5}{a}$, you know the PDF integrates to 1.
If you take a similar approach to do the $\displaystyle E(x^2)$, I think you will find that the integral "appearing" on the right is equal to E(X) + pdf, multiplied by various constants, but this should be no problem as you just calculated the value of E(X).
Try that, my apologies if it doesn't work. I haven't worked it through myself.
Edit I did the second one to check
Spoiler:
Well, that's why I mentioned the numerical methods. Really, it's not evil to have only 15 decimal places rather than an exact solution. If you were trying to find Mars, I think that much accuracy would get you there. For well-behaved functions, as strictly continuous probability densities often are, simpler methods, such as Simpson's rule, are likely to be quite sufficient. Throw in Rhomberg Extrapolation and a very large percentage of such integrals easily are solved. Maybe Gaussian Quadrature if your feeling a little adventurous.
Just a quick reference for you.
You should be able to re-write this as $\displaystyle e^{-\left(x - \frac{1}{2}\right)^2} e^{-1/4}$ and then normalise $\displaystyle e^{-\left(x - \frac{1}{2}\right)^2}$ by recognising it as being proportional to the pdf of a normal distribution with mean ..... and sd ......
Then use the well known results for mean and variance of a normal distribution to answer your question.