Showing independence between two functions of a set of random variables I've been working on the following problem and I'm confused about how to get started:
Let $X_1, X_2,\dots, X_n$ denote i.i.d. real valued random variables, each absolutely continuous with an exponential distribution with parameter $\theta$. Let $a_1,\dots,a_n$ denote real non-zero constants and let $Y = \sum_1^n a_i\log\left(X_i\right)$. Specify the conditions on $\left(a_i\right)_{1\leqslant i \leqslant n}  $ under which $Y$ and $\sum_1^n X_i$ are independent. 
There is a suggestion to consider the gamma distribution. Based on that I've played around with the Moment Generating functions (mgfs) of $Y$ (which resembles the gamma function) and of $\sum_1^n X_i$, which as the sum of exponentials has a gamma distribution, and my plan was to show that under certain conditions the joint mgf $M(t_1,t_2)$ = $M(t_1,0)*M(0,t_2)$ but I'm not sure how to get a joint distribution of $Y$ and $\sum_1^n X_i$. 
Can anyone help me see how this is done? Is this even the right way to go about solving this? I feel like I'm not really making use of the suggestion in more than a trivial way at present, but I'm not sure how to go about using it.
 A: The MGF idea works well.
The scale of the exponential distribution doesn't matter, so we may take $\theta=1$ and set the exponential density to 
$$f(x) = e^{-x} \mathcal{I}(x \gt 0).$$
Writing
$$Y = \sum_i a_i \log(X_i),\ Z = \sum_i X_i,$$
for $|s|\lt 1$ and $|t|\lt 1$ compute the joint MGF as
$$\eqalign{
\phi_{Y,Z}(s,t) &= \mathbb{E}\left[e^{sY + tZ}\right] \\
&= \int\cdots\int \exp(sY+tZ) \prod_i \exp(-x_i)\mathrm{d}x_i \\
&= \prod_i \int_{0}^\infty \exp\left(sa_i \log(x_i) + (t-1) x_i\right) \mathrm{d}x_i\\
&= \prod_i \int_{0}^\infty x_i^{sa_i} e^{(t-1)x_i}\mathrm{d}x_i\\ 
&= \prod_i (t-1)^{-(sa_i + 1)} \Gamma(sa_i + 1) \\
&= \left((t-1)^{-n}(t-1)^{-s \sum_i a_i}\right)\ \left(\prod_i \Gamma(a_is + 1)\right).
}$$
The term $(t-1)^{-s\sum_i a_i}$ shows this factors into separate MGFs $\phi_Y(s)\phi_Z(t)$ if and only if $\sum_i a_i = 0.$  (When it does factor, we recognize the components $\phi_Y$ and $\phi_Z$ as the MGFs of a sum of shifted Gumbel distributions and a Gamma distribution, respectively.) Therefore

$Y$ and $Z$ are independent if and only if the $a_i$ sum to zero.


This figure documents a simulation of ten thousand draws of the $X_i$ with $n=3.$  The four panels are scatterplots of $Z$ vs $Y$ for four different sets of vectors $(a_i).$  The red lines are Lowess smooths: a non-horizontal smooth indicates lack of independence.  Can you spot the vector that does not sum to zero?
 
This R code produced the examples.
#
# Specify the problem, the simulation size, and number of examples to plot.
#
n <- 3
n.sim <- 1e4
n.examples <- 4
#
# Create the examples randomly.
#
a <- matrix(rnorm(n * n.examples), n)
a <- scale(a, scale=FALSE)                              # Will sum to 0
a[, n.examples] <- a[, n.examples] + runif(n, 1/n, 2/n) # Will not sum to 0
#
# Generate the data.
#
x <- matrix(rexp(n*n.sim), n)
#
# Compute Z and various Y.
#
z <- colSums(x)
y <- t(a) %*% log(x)
#
# Show scatterplots and smooths.
#
mfr <- par(mfrow=c(1, n.examples))
invisible(apply(y, 1, function(y) {
  plot(y, z, pch=19, col="#00000004")
  f <- lowess(z ~ y)
  lines(f$x, f$y, col="Red", lwd=2)
}))
par(mfrow=mfr)

