I'm trying to analyse the derivation of the confidence interval in a normally distributed sample. To be specific, I have some problems understanding why we use certain quantiles.
In the picture above, why is $a$ equal to $\chi_{1-\frac{\alpha}{2}}^2$ and not $\chi_{\frac{\alpha}{2}}^2$?
I thought the quantile is related to the area to the left of a given point (due to the cdf being defined as $P(X \leq t)$), which in this case is $\frac{\alpha}{2}$. In my opinion, $a$ and $b$ should be switched. I'm even more confused since I've both ways of choosing the point, e.g. in my textbook there is:
which is the same as my reasoning.
What am I missing?


A 95% confidence interval is based on $Q = (n-1)S^2/\sigma^2 \sim \mathsf{Chisq}(df=n-1).$ Thus we can find numbers $L$ and $U$ so that $$.95 = P\left(L \le Q = \frac{(n-1)S^2}{\sigma^2} \le U\right) = P\left(\frac{1}{U} \le \frac{\sigma^2}{(n-1)S^2} \le \frac{1}{L}\right)\\ P\left(\frac{(n-1)S^2}{U} \le \sigma^2 \le \frac{(n-1)S^2}{L}\right),$$ so that a 95% CI for $\sigma^2$ is of the form $$ \left(\frac{(n-1)S^2}{U},\:\frac{(n-1)S^2}{L}\right).$$
From a simpler point of view, as mentioned by @Henry, if you were to use $L$ for the denominator of the left-hand confidence limit and $U$ in the right-hand limit then you would have $$ \frac{(n-1)S^2}{L} > \frac{(n-1)S^2}{U}.$$
Notes: (a) This kind of "reversal" of probability limits occurs frequently in making confidence limits.
(b) For example, in the simple CI for normal $\mu$ of the form $\bar X \pm 1.96\sigma/\sqrt{n}.$ the limits are really $\bar X - U\sigma/\sqrt{n}$ and $\bar X - L\sigma/\sqrt{n},$ where $U = 1.96$ and $L = -1.96.$ But this is seldom noticed because of the symmetry of the normal distribution.
(c) In making an unbiassed bootstrap CI, it is especially important to be aware of this "reversal."