How to find the value of the constant $c$? Given $X,Y$ random variables continuously I need to find the Probability density function of $X$
$$f_{X,Y}(x,y) = \begin{cases} c e^{-y} \cdot e^{-\frac{ (y-1-x)^2 }{2}} & x >0 \\ 0 & x \leq 0 
\end{cases}$$
my plan is to find $c$ and than I will be able to calculate $f_{\small {X}}$. to find $c$ I need to use the fact that $$1=\int _{-\infty }^{\infty }\int _0^{\infty }ce^{-y}e^{−\left(y−1−x\right)^2}\:dxdy$$
I am not sure if the limits of $y$ is true here, and I am stuck on calculate this integral.
assume that I found $c$ I just need to write
$$f_{\small {X}}=\int _{-\infty }^{\infty }ce^{-y}e^{−\left(y−1−x\right)^2}\:dy$$
Is my plan correct? how do I find $c$?
 A: To find $c$ we need to solve:
$$1=\int _{-\infty }^{\infty }\int _0^{\infty }ce^{-y}e^{−\left(y−1−x\right)^2}\:dxdy$$
this is a bit easier to solve is we first switch the order of integration and do a bit of rearranging
$$\frac{1}{c}=\int _{0}^{\infty }\int _{-\infty}^{\infty } \exp[-(y+(y-1-x)^2)] \:dydx$$
expanding and completing the square for the expression inside
$$y+(y-1-x)^2 = y^2-y(1+2x)+(1+x)^2$$
$$=\left(y-\frac{1+2x}{2}\right)^2-\left(\frac{1+2x}{2}\right)^2+(1+x)^2$$
$$=\left(y-\frac{1+2x}{2}\right)^2 +x +\frac{3}{4}$$
Returning to our original integral now
$$\frac{1}{c}=\int _{0}^{\infty }\int _{-\infty}^{\infty } \exp[-(y+(y-1-x)^2)] \:dydx$$
$$ = \int _{0}^{\infty }\int _{-\infty}^{\infty } \exp \left[-\left(y-\frac{1+2x}{2}\right)^2 - x -\frac{3}{4}\right] dydx$$
$$ = e^{-\frac{3}{4}} \int _{0}^{\infty } e^{ - x} \int _{-\infty}^{\infty } e^{-\left(y-\frac{1+2x}{2}\right)^2} dydx$$
Notice that the pdf of a normal distribution with mean $\left(\frac{1+2x}{2}\right)$ and var $\frac{1}{2}$ is
$$\frac{1}{\sqrt{\pi}}e^{-\left(y-\frac{1+2x}{2}\right)^2}\:$$
therefore the integral of the above from $-\infty$ to $\infty$ is $1$
$$ \frac{1}{c} = \sqrt{\pi} e^{-\frac{3}{4}} \int _{0}^{\infty } e^{ - x} \int _{-\infty}^{\infty } \frac{1}{\sqrt{\pi}}e^{-\left(y-\frac{1+2x}{2}\right)^2} dydx$$
$$ = \sqrt{\pi} e^{-\frac{3}{4}} \int _{0}^{\infty } e^{ - x} = \sqrt{\pi} e^{-\frac{3}{4}}$$
Thus $c = \frac{e^{\frac{3}{4}}}{\sqrt \pi}$
