# Why is this Conditional Density Function correct?

This answered question shows how to solve the problem but I still do not understand how to get the conditional density function, i.e.

${"}$Let $Z=X+Y$, then the density $f_{X,Z}$ of $(X,Z)$ is defined by $f_{X,Z}(x,z)=f_X(x)f_Y(z-x)$ because $X$ and $Y$ are independent hence the conditional distribution of $X$ conditionally on $Z=z$ is proportional to $f_X(x)f_Y(z-x)$, that is, $$f_{X\mid Z}(x\mid z)=\frac1{c(z)}f_X(x)f_Y(z-x),\qquad c(z)=\displaystyle\int f_X(t)f_Y(z-t)\mathrm dt."$$ I keep getting that $$f_{X\mid Z}(x\mid z)=\frac1{c(z)}f_X(x)f_Z(z)=\frac1{c(z)}f_X(x)\int f_X(x)f_Y(z-x),\qquad c(z)=\displaystyle\int f_X(x)f_Y(z-x)\mathrm dx.$$ which just ends up being $$f_{X\mid Z}(x\mid z)=f_X(x).$$ I know that I'm making a fundamental error, could someone please explain in more detail what it is?

The general formula for conditional density is $$f_{X\mid Z}(x\mid z) = {f_{X,Z}(x,z)\over f_Z(x)}.\tag1$$ Your error is in replacing the numerator in (1) with $$f_{X,Z}(x,z)=f_X(x)f_Z(z),$$ which is true only if $X$ and $Z$ are independent. What you should do is replace the numerator in (1) with $$f_{X,Z}(x,z)=f_X(x)f_Y(z-x)$$ and the denominator in (1) with $$f_Z(z)=\int f_{X,Z}(x,z)\,\mathrm dx = \int f_X(x)f_Y(z-x)\,\mathrm dx=:c(z),$$ and you'll get the desired conditional density function.