Prove a random variable to be a Chi-squared distribution Here is the thing I am trying to prove:

Suppose that the random variables $X_1, X_2, \dots, X_n$ are independent, and each random variable $X_i$ has a continuous c.d.f. $F_i$. Also, let the random variable $Y$ be defined by the relation $Y = -2\sum_{i = 1}^n \log F_i(X_i)$. Show that $Y$ has the $\chi ^2$ distribution with $2n$ degrees of freedom.

My current approach is to prove $Y$ is a gamma distribution with parameters $\alpha = n$ and $\beta = \frac{1}{2}$, which is the sum of $n$ i.i.d. random variables drawn from gamma distribution with parameters $\alpha = 1$ and $\beta = \frac{1}{2}$. However, we don't know the distribution of $X_i$ or the c.d.f. $F_i$. I don't know how to establish a relation between the given expression (a.k.a. the log c.d.f.) to a gamma distribution (or any other specific distribution). How can I proceed?
 A: The core idea here is that the random variable $$U_i = F_i(X_i) \sim \operatorname{Uniform}(0,1); \tag{1}$$ that is to say, the CDF applied to a random variable $X$ has the continuous uniform distribution on $[0,1]$.  Why is this the case?  Well, recall that $$F_i(x) = \Pr[X_i \le x]. \tag{2}$$  So $$\Pr[U_i \le u] = \Pr[F_i(X_i) \le u] = \Pr[X_i \le F_i^{-1}(u)] = F_i(F_i^{-1}(u)) = u. \tag{3}$$  The first equality is just the application of our definition that $U_i = F_i (X_i)$.  Then, because $F_i$ is a continuous CDF, it has a well-defined inverse (some additional care is needed if $F_i'(x) = 0$ on some interval).  Then we apply Equation $(2)$.
It follows from $(3)$ that the CDF of $U_i$ is continuous uniform, and because the support of $U_i$ is clearly on $[0,1]$, the claim $(1)$ follows.
Therefore, $-\log U_i = \log F_i(X_i)$ is exponentially distributed, since $$\Pr[-\log U_i \le u] = \Pr[U_i \le e^{-u}] = e^{-u}, \tag{4}$$ which is the CDF of an exponential distribution with mean $1$.
Finally, $$Y = -2\sum_{i=1}^n \log F_i (X_i)$$ is twice the sum of IID exponential random variables, so must be gamma distributed and the rest I leave to you as an exercise.
