Uniform random variables: joint density function to compute product I have found similar questions on the website but none of them use the "double integral" approach so I'm going to show what I've done with the hope that someone tells me where I'm going wrong.
Suppose we draw two random numbers X and Y each distributed uniform on [0,1]. If X and Y are independent, I would like to compute what is the probability that their product is smaller than 1/2.
What I've done is:
$$
P(XY \leq \frac{1}{2}) = \int\int_{xy \leq 0.5}1\cdot1 \,dx\,dy = \int_{x=0}^{x=1}\int_{y = \frac{1}{2x}}^{y = 1}1\cdot1\,dx\,dy
$$
But now if I integrate using those limits of integration, I end up with the expression
$$
x -  0.5\ln x
$$
that I have to evaluate at $x=0$ (division by 0) and $x=1$. 
What is wrong with my derivation?
 A: Note that $Y$ cannot be greater than $1$. Your final $y$-integral should be from $0$ to $\min\{1/(2x),1\}$, and if $x \ge 1/2$ then this is just $1$. In particular, we have the following:
\begin{align*}
P(XY \le 1/2)
=
\int_{xy \le 1/2} d(x,y)
&=
\int_0^1 dx \int_0^1 dy \, 1(xy \le 1/2)
\\&=
\int_0^1 dx \int_0^{\min\{1/(2x),1\}} dy
\\&=
\int_0^1 \min\{1/(2x),1\} \, dx
\\&=
\int_0^{1/2} 1 \, dx + \int_{1/2}^1 1/(2x) \, dx
\\&=
\tfrac12 + \tfrac12 \bigl( \log(1) - \log(1/2) \bigr)
\\&=
\tfrac12 + \tfrac12 \log(2) = (1 + \log(2))/2.
\end{align*}
As a sanity check, notice that this is indeed less than $1$.

With these questions, going hands on into calculating integrals is rarely the way to go. Let's do it in a more probabilistic way: use the law of total probability to condition on what $Y$ is, and use the fact that $P(U \le u) = \min\{u,1\}$ for $U \sim \text{Unif}(0,1)$ and $u \ge 0$; we obtain
\begin{align}
P(XY \le 1/2)
&=
E(P(X \le 1/(2Y) \mid Y))
=
E( \min\{1/(2Y),1\} )
\\&=
\tfrac12 E(1/(2Y) \mid Y \ge 1/2) + \tfrac12
\\&=
\tfrac14 E(1/Y \mid Y \ge 1/2) + \tfrac12.
\end{align}
When we condition a uniform random variable to lie in a certain interval, it is then uniform on that interval:
$$
E(1/Y \mid Y \ge 1/2) = E(Z)
\quad\text{where}\quad
Z \sim \text{Unif}(1/2,1).
$$
Now you can directly calculate this expectation using the fact that $f_Z(z) = \tfrac12$ for $z \in (1/2,1)$.
This involves less messing around with limits, and you'll find in the future that in general this is a much better way to approach such problems :)
