Derive conditional density when there is a deterministic function describing the relationship between $X$ and $Y$ Suppose there are two random variables $X$ and $Y$. I know the marginal density of $X$ and $Y$ and also that $X$ and $Y$  satisfy $f(X,Y)=0$.
I wonder how I could get the conditional density $X|Y$, also how I could generate a random variable from this distribution at given $Y=y$

The constraint $f(X,Y)=0$ is not sufficient to ensure a deterministic relationship between the random variables $X$ and $Y$.  So, the first thing you need to do is to apply the implicit function theorem to see if there is an implicit function $g: \mathbb{R} \rightarrow \mathbb{R}$ for which:
$$X = g(Y).$$
Assuming there is an implicit function $g$ that determines $X$ from $Y$, the conditional distribution of $X|Y$ is a point mass distribution on its determined value ---i.e., you have:
$$\mathbb{P}(X=g(y)|Y=y) = 1
\quad \quad \quad \text{for all } y \in \mathbb{R}.$$
In terms of finding the value $g(y)$ given a value of $y$, that is essentially a root-finding exercise, for which a number of well-known algorithms exist.  In the case where $f$ is differentiable it is usual to use the Newton-Raphson method to find the roots of the function.
