[proofplan]
Translate independence into equality of the joint law and the product of marginal laws. Since the laws have densities, equality of measures is equivalent to equality of the corresponding densities almost everywhere.
[/proofplan]
[step:Identify the product density]
For each $i$, the law of $X_i$ has density $f_i$ with respect to one-dimensional Lebesgue measure. Hence the product measure of the marginal laws has density
\begin{align*}
(x_1,\ldots,x_n)\mapsto \prod_{i=1}^n f_i(x_i)
\end{align*}
with respect to $\mathcal L^n$.
[/step]
[step:Independence implies factorisation]
If $X_1,\ldots,X_n$ are independent, the joint law is the product of its marginal laws. The joint law has density $f$, while the product marginal law has density $\prod_i f_i(x_i)$. Uniqueness of Radon-Nikodym derivatives with respect to $\mathcal L^n$ gives
\begin{align*}
f(x_1,\ldots,x_n)=\prod_{i=1}^n f_i(x_i)
\end{align*}
for $\mathcal L^n$-almost every $(x_1,\ldots,x_n)$.
[/step]
[step:Factorisation implies independence]
Conversely, assume the displayed factorisation holds almost everywhere. Then the joint law and the product of the marginal laws have the same density with respect to $\mathcal L^n$. Therefore the two measures are equal. Equality of the joint law with the product of the marginal laws is equivalent to independence, so $X_1,\ldots,X_n$ are independent.
[/step]