Can someone explain the chi squared distribution in layman's terms I understand that the chi squared distribution is the square of a normal distribution. If X is a normal variable, what are we squaring, the values of X or the corresponding probabilities? 
I am unable to see the intuitive explanation as to how by squaring a normal variable, I can use the resultant distribution for hypothesis testing and confidence interval?
 A: Let's say you have random numbers $x_i$. When you estimate the variance of the series, you have to calculate sums like $\sum_i x_i^2$. If your numbers are from normal distribution, then the sum is from $\chi^2$ distribution. If you need to know the confidence intervals of your variance estimate, then you can use $\chi^2$ distribution to get them.
Often your numbers are not from normal distribution. However, due to central limit theorem (CLT) the sums of non-normal random variables are still normal in some cases. So, if you look at the mean of the sample, it's from normal distribution $\bar x=\frac{1}{n}\sum_i x_i$. Hence, if you want to know the variance of the sample mean, you'll get to calculate the sums like $\sum_k \mu_k^2$, where $k$ is a sample. Again, you can use $\chi^2$ to get confidence intervals of the variance of the sample mean.
A: Your understanding is slightly flawed. A $\chi^2$ distribution with $k$ degrees of freedom arises as the sum of squares of $k$ independent standard normal deviates.
This is useful for hypothesis tests when the data (are assumed to) follow a normal distribution. For example, in the case of Pearson's test $\chi^2$ test of independence, the test statistic is constructed as the sum-of-squared deviations from expected values.
A: As others have mentioned, a $\chi_{n}^2$ distribution is the distribution of the sum of $n$ (independent identically distributed) variables with Normal distributions (each of mean 0 and variance 1). But when students first encounter this concept, they're given tables to look up probabilities. How are those derived? 
Let's start with $n=1$ so, for any $x \geq 0$, our variable $\leq x$ iff the underlying normal variable is $\in \left[-\sqrt{x},\,\sqrt{x}\right]$, which has probability $2\Phi\left(\sqrt{x}\right)-1$ where $\Phi\left( x \right)=\int_{-\infty}^x \frac{1}{\sqrt{2\pi}}\text{e}^{-t^2/2}dt$. Differentiating, the pdf is $x^{-1/2}\Phi'\left( \sqrt{x}\right)=\frac{1}{\sqrt{2\pi x}}\text{e}^{-x/2}$ for $x\geq 0$. Integrating that to check it's normalised is equivalent to computing $\Gamma\left( \frac{1}{2} \right)$, so the characteristic function turns out to be $\left( 1-2it \right)^{-1/2}$.
Now we can generalise to arbitrary $n$ . The characteristic function becomes $\left( 1-2it \right)^{-n/2}$ . By the inversion formula, the pdf on $\left[0, \,\infty\right]$ is proportional to $x^{n/2-1}\text{e}^{-x/2}$ (for the simple reason that such a pdf would obtain the right characteristic function). Now we just need the proportionality constant, viz. $\frac{x^{n/2-1}\text{e}^{-x/2}}{2^{n/2}\Gamma\left(\frac{n}{2} \right)}$. For even $n$ , an elementary expression for the cdf can be obtained by integration; for odd $n$ , we get a result in terms of $\Phi$, such as the one obtained above for the $n=1$ case. The $n=2$ case is especially simple; the pdf is $\frac{1}{2}\text{e}^{-x/2}$, which is an exponential distribution with $\lambda=\frac{1}{2}$.
