conditional distribution of random variable given its sum with another random variable I am trying to figure out the following problem:

I have two random variables: $X$ with pdf $f_X(x)$ on $[0,A]$ and $Y$ with pdf $g_Y(y)$ on $[0,B]$. Let's denote $Z=X+Y$. What should be the distribution of $X$, given $Z$?

Many thanks!
 A: Assuming $X$ and $Y$ are independent and continuous, find the joint probability density function for $X$ and $Z$, i.e. $f_{X,Z}(x,z)$.
The probability density function of the conditional random variable then reads:
$$
    f_{X|Z}\left(x\mid z\right) = \frac{f_{X,Z}(x,z)}{f_Z(z)}
$$
where $f_Z(z)$ is the marginal pdf of $Z$, which is obtained as $f_Z(z) = \int_0^A f_{X,Z}(x,z) \mathrm{d}x$.
To find $f_{X,Z}(x,z)$ simply change measure in an expectation of a bounded function:
$$
  \mathbb{E}\left(h(X,Z)\right) = \int_0^A \int_0^B h(x,x+y) f_X(x) g_Y(y) \mathrm{d}x \mathrm{d}y = \int_0^A \int_0^{A+B} h(x,z) f_{X,Z}(x,z) \mathrm{d}x \mathrm{d}z
$$
to find
$$
    f_{X,Z}(x,z) = f_X(x) g_Y(z-x) [ 0<x<A, x<z<B+x ]
$$
and therefore:
$$
    f_Z(z) = \int_{\max(0,z-B)}^{\min(z,A)} f_X(x) g_Y(z-x) \mathrm{d}x
$$
A: In full generality, the conditional distribution of a random variable $X$ conditionally on a random variable $Z$ is a family $(\nu_z)_z$ of distributions such that $\mathbb E(\varphi(X)\mid Z)=A_\varphi(Z)$ for every bounded measurable function $\varphi$, where
$$
A_\varphi(z)=\int\varphi(x)\mathrm d\nu_z(x).
$$
This means that, for every bounded measurable function $\psi$, 
$$
\mathbb E(\varphi(X)\psi(Z))=\mathbb E(A_\varphi(Z)\psi(Z)).
$$
In the present case, assuming that $X$ and $Y$ are independent, one gets
$$
\mathbb E(\varphi(X)\psi(Z))=\iint\varphi(x)\psi(x+y)f(x)g(y)\mathrm dx\mathrm dy,
$$
and the goal is to identify $\varphi\mapsto A_\varphi$ such that this coincides with
$$
\mathbb E(A_\varphi(Z)\psi(Z))=\iint A_\varphi(x+y)\psi(x+y)f(x)g(y)\mathrm dx\mathrm dy,
$$
for every bounded measurable function $\psi$. Can you proceed from here?
