If $A_{p\times p}$ is a non-random matrix, symmetric and idempotent matrix with $\mu_{p\times 1}=0$ and $\Sigma=\sigma^2 I_{p\times p}$, then $$V=\frac{1}{\sigma^2}Y'AY\sim \chi_r^2$$ where $Y_{p\times 1}\sim N(\mu,\Sigma)$ and $r=rank(A)$.
First I used the matrix properties of $A$, so $$V=\frac{1}{\sigma^2}Y'AY=\frac{1}{\sigma^2}Y'AAY=\frac{1}{\sigma^2}(AY)'AY$$
Let $Z_{p\times 1}=AY$ then $$V=\frac{1}{\sigma^2}Z'Z=\frac{1}{\sigma^2}\sum_{i=1}^pZ_i^2 \quad(*)$$
To find the distribution of $Z$ I used moment generating function
$$M_Z(t)=E[\exp(t'(AY)]=E[\exp(A't)'Y]=M_Y(t)(A't)$$ $$=\exp\Big(\frac{1}{2}t'(A\Sigma A')t\Big)$$ so $Z\sim N_p(0,A\Sigma A')$ and from marginalization propertie I know that each $Z_i$ have Normal distribution also.
The problem is that I don't find a way to link it with $(*)$
I'm not understanding well the relationsheep between the rank of $A$ and the degree of freedom in the chi-squared distribution. Why when I have $A=I_{p\times p}$ (identity matrix) I get that $V\sim \chi_p^2$?
...matrix with rank=p
, is it rank?? $\endgroup$