Knowing distributions of X|Y and X find distribution of Y Let $X|Y$ have normal distribution $\mathcal N(0,\frac{1}{2Y})$ and $X$ have Cauchy distribution $C(1)$. Find distribution of $Y$. 
I don't know how to approach this kind of exercises. I tried to guess joint density function but with no results.
 A: There may be a more principled way of doing this, and you don't suggest the support of $p(y)$, but this is an educated guessing type approach to find some solution where I take the support of $Y$ to be $(0,\infty)$. We know that
$$
p(x) = \int_{0}^{\infty}p(x |y ) p(y) dy,
$$
and so
\begin{align*}
\frac{1}{\pi(1+x^2)}=\int_{0}^{\infty}\frac{y^{1/2}}{\sqrt{\pi}}e^{-yx^2}p(y)dy \tag{1}
\end{align*}
this suggests we want to make a judicious choice of $p(y)$ so that the integrand of the expression is proportional to some recognisable class of distributions - preferably with normalising constant $\pi(1+x^2)$.
Now the fact that we have $1+x^2$ appearing in $(1)$ but only $x^2$ appearing in the argument of the exponential suggests that the choice
$$
p(y) = f(y)e^{-y}, \tag{2}
$$
for some choice of $f(y)$ will simplify things. After this substitution and rearranging $(1)$ we have
\begin{align*}
\frac{1}{\pi(1+x^2)} =\int_0^{\infty}\frac{1}{\sqrt{\pi}}y^{1/2}e^{-(1+x^2)y}f(y)dy \tag{3}
\end{align*}
Now we need to consider the class of distributions we are familiar with and pick some possible candidates. After letting $\beta = 1+x^2$ then $(3)$ has components that look similar to a Gamma distribution and infact we know that
$$
\int_0^{\infty} y^{\alpha - 1}e^{-\beta y} =\frac{\Gamma(\alpha)}{\beta^{\alpha}} = \frac{\Gamma(\alpha)}{(1+x^2)^{\alpha}}, \tag{4}
$$
now on inspection it would be ideal if we could choose $f(y)$ such that $\alpha = 1$ in $(4)$. Which suggests that $f(y)y^{1/2} = 1$
$$
p(y) \propto \frac{1}{\sqrt{y}}e^{-y}, \qquad \mbox{or} \qquad p(y) = \frac{1}{\sqrt{\pi}}y^{1/2 - 1}e^{-y},
$$
which is a $\mbox{Gamma}(1/2, 1)$ distribution. So unless I have made a mistake along the way that is one possible solution to your problem as posed - though there may be others?
