To calculate the expectation of a variable with a given pdf Let the pdf of a random variable X be given by $f(x)=ae^{-x^2-bx}, -\infty<x<\infty$. If $E(X)=-\frac{1}{2}$, then
(A)$a=\frac{1}{\sqrt{\pi}}e^{-1/4},b=1$
(B)$a=\frac{1}{\sqrt{\pi}}e^{-1/4},b=-1$
(C)$a=\sqrt{\pi}e^{-1/4},b=1$
(D)$a=\sqrt{\pi}e^{-1/4},b=-1$
My Steps:
$\begin{aligned}
E(X) & = \displaystyle\int\limits_{-\infty}^{\infty}xf(x)\;dx=-\frac{1}{2} \\
 & = \displaystyle a \int\limits_{-\infty}^{\infty}xe^{-x^2-bx}\;dx \\
 & = \displaystyle ae^{b/4} \int\limits_{-\infty}^{\infty}xe^{-(x+b/2)^2}\;dx \\
 & = \displaystyle ae^{b/4} \int\limits_{-\infty}^{\infty}(x+b/2)e^{-(x+b/2)^2}\;dx -  \displaystyle ae^{b/4}\frac{b}{2} \int\limits_{-\infty}^{\infty}e^{-(x+b/2)^2}\;dx \\
\end{aligned}$
I need hints to integrate the second part. Please advise. 
 A: Recall that a normally distributed random variable $X$ with mean $\mu$ and standard deviation $\sigma$ has the probability density function $$f_X(x) = \frac{1}{\sqrt{2\pi} \sigma} e^{-(x-\mu)^2/(2\sigma^2)}, \quad -\infty < x < \infty.$$  So if we set $\mu = -1/2$, then $\operatorname{E}[X] = \mu = -1/2$ as desired.  Now write $$ae^{-x^2-bx} = ae^{b^2/4} e^{-x^2-bx-b^2/4} = ae^{b^2/4} e^{-(x+b/2)^2}.$$  So we now seek a choice of $\sigma > 0$ such that $$\frac{(x+1/2)^2}{2\sigma^2} = (x+b/2)^2,$$ and simultaneously, $$\frac{1}{\sqrt{2\pi} \sigma} = ae^{b^2/4}.$$  This suggests letting $b = 1$, $\sigma = 1/\sqrt{2}$, and solving for $a$ from these choices gives $$a = \pi^{-1/2} e^{-1/4},$$ which is answer choice A.
A: Write $f(x) = ae^{b^2/4}e^{-(x + b/2)^2}$, and note that $f$ is a normal distribution function (it's of the form $g(x) = (2\pi \sigma^2)^{-1/2}e^{-(x - \mu)^2/(2\sigma^2)}$). If $\mu$ and $\sigma^2$ is the mean and variance of $X$, respectively, then $\mu = -b/2$. So since $\mu = E(X) = -1/2$, $b = 1$ and $f(x) = ae^{1/4}e^{-(x + 1/2)^2}$. Now $2\sigma^2 = 1$ and $(2\pi \sigma^2)^{-1/2} = ae^{1/4} \implies a = \pi^{-1/2} e^{-1/4}$. So the answer is $(A)$.
A: For the second part, let $u = x+\dfrac{b}{2}$, then you integrate 
$\displaystyle \int_{-\infty}^{\infty} e^{-u^2}du = \sqrt{\displaystyle \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} e^{-(u^2+v^2)}dudv}$, and this can be done with polar coordinates by letting $r^2=u^2+v^2, dudv = rdrd\theta$. Can you continue?
