# Computing a conditional joint density

Given the joint density $f_{12}(x_1,x_2)$ of two (dependent) random variables $X_1$ and $X_2$, each defined on $\mathbb{R}$. Suppose that $f_{12}$ is differentiable everywhere on $\mathbb{R}^2$. Now define the event

$Y=\{(x_1,x_2) : x_2 - x_1 \leq d\}$

for some real $d$.

What is the conditional density $f_{12}(x_1,x_2|Y )$ ?

In other words, I need the joint density when event points are restricted to the subspace $Y$ of $\mathbb{R}^2$.

More generally, given a $Y \subsetneq \mathbb{R}^2$, defined by one or more "algebraic" constraints (like the one given above), is there an algorithm to compute the conditional joint density?

I don't know if "conditional joint density" is the right term. I'd also appreciate any references on this.

If a random vector $X$ has density $f$, and $A=\{\omega:X(\omega)\in B_0\}$, for some fixed Borel set $B_0$, supposing that $P(A)>0$, we can define a conditional density $f(\;\cdot\mid A)$ as a function that satisfies $$P(X\in B\mid A) =\int_B f(x\mid A)\,dx \, , \qquad\qquad (*)$$ for every Borel set $B$. It is easy to prove that $$f(x\mid A) = \frac{f(x)}{P(A)} I_{B_0}(x)$$ satisfies $(*)$; just use that $P(X\in B\mid A)=P(X\in B\cap B_0) / P(A)$. If you need help with any details of the proof, just ask.