Proof that joint density is the product of non-negative functions Let $Y_1$ and $Y_2$ have a joint density $f(y_1, y_2)$ that is positive if and only if $a \leq y_1 \leq b$ and $c \leq y_2 \leq d$, for constants $a$, $b$, $c$, and $d$; and $f(y_1, y_2) = 0$ otherwise. Then $Y_1$ and $Y_2$ are independent random variables if and only if $f(y_1, y_2) = g(y_1)h(y_2)$
where $g(y_1)$ is a non-negative function of $y_1$ alone and $h(y_2)$ is a non-negative function of $y_2$ alone.
How can we prove this? I need this for my report.
 A: We know that the definition of two independent random variables can be expressed as:
\begin{align}
P(Y_1|Y_2) = P(Y_1)
\end{align}
We start from the forward direction. We assume that the two random variables are independent and show that if $f(y_1,y_2)$ is non-negative then $f(y_1, y_2) = g(y_1)h(y_2)$
where $g(y_1)$ is a non-negative function of $y_1$ alone and $h(y_2)$ is a non-negative function of $y_2$ alone:
\begin{align}
P(Y_1|Y_2) &= \frac{P(Y_1,Y_2)}{P(Y_2)}\\
P(Y_1|Y_2)&=\frac{f(y_1,y_2)}{P(Y_2)}
\end{align}
We made the assumption that the two variables are independent so we change our expression to:
\begin{align}
P(Y_1)&=\frac{f(y_1,y_2)}{P(Y_2)}\\
P(Y_1)P(Y_2)&=f(y_1,y_2)\\
\end{align}
We can see that the independence of the two variables implies that their joint distribution can be written as the product of two functions. To get a positive function, we need to multiply two positive functions together, or two negative ones. Since we are talking about probability distributions, we know that we cannot have negative probabilities. From this, we can see that the two functions need to be positive.
The opposite direction is very similar. We start from the assumption that the the individual distributions for $Y_1$ and $Y_2$ are two non-negative functions. Again using the definition of conditional distribution, we substitute in our two positive functions. With some algebra we show that $P(Y_1|Y_2) = P(Y_1)$ and therefore the two random variables are independent. 
