Deriving the marginal multivariate Dirichlet distribution I am trying to understand how my professor (see derivation below) has derived the multivariate marginal distribution of a subvector of $\theta_j$´s from a Dirichlet distribution. I understand everything really, until the third line. I understand that he wants the integral to represent a unnormalised beta integral and hence he have to divide $\theta^{\alpha_{k-1}-1}_{k-1}$ and $(1-\theta_1 ... - \theta_{k-1})^{\alpha_{k}-1}$ by their sum, i.e $\theta^{\alpha_{k-1}-1}_{k-1} + (1-\theta_1 ... - \theta_{k-1})^{\alpha_{k}-1}$
If I understand correctly, the sum is equal to $(1-\theta_1 ... - \theta_{k-1})^{\alpha_{k-2}+\alpha_{k-1}-2}$, but how do we get that this is in fact the sum?

 A: Since$$p(\theta_1,\ldots,\theta_{k-1})\propto (1-\theta_1-\cdots-\theta_{k-1})^{\alpha_{k}-1}\prod_{i=1}^{k-1} \theta_i^{\alpha_i-1}$$over the $\mathbb R^k$-simplex,
$$\mathfrak S = \left\{(\theta_1,\ldots,\theta_{k-1})\in\mathbb R^{k-1}_+\,;\,\sum_{i=1}^{k-1} \theta_i\le 1\right\}$$
integrating out $\theta_{k-1}$ produces the marginal density of $(\theta_1,\ldots,\theta_{k-2})$:
\begin{align}
p(\theta_1,\ldots,\theta_{k-2})&\propto \int_0^{1-\theta_1-\cdots-\theta_{k-2}}
(1-\theta_1-\cdots-\theta_{k-1})^{\alpha_k-1}\prod_{i=1}^{k-1} \theta_i^{\alpha_i-1}\,\text d\theta_{k-1}\\
&= \prod_{i=1}^{k-2} \theta_i^{\alpha_i-1}\, \int_0^{1-\theta_1-\cdots-\theta_{k-2}}
(1-\theta_1-\cdots-\theta_{k-1})^{\alpha_{k}-1}\,\theta_{k-1}^{\alpha_{k-1}-1}\,\text d\theta_{k-1}\\
\end{align}
Given the upper bound on $\theta_{k-1}$ found in the integral, one can rather naturally consider the change of variable
$$\theta_{k-1}=(1-\theta_1-\cdots-\theta_{k-2})\eta$$
leading to
\begin{align}
p(\theta_1,\ldots,\theta_{k-2})
&= \prod_{i=1}^{k-2} \theta_i^{\alpha_i-1}\, \int_0^1
(1-\theta_1-\cdots-\theta_{k-2})^{\alpha_{k-1}-1}(1-\eta)^{\alpha_{k-1}-1}\\
&\qquad\times(1-\theta_1-\cdots-\theta_{k-2})^{\alpha_{k-1}-1}\eta^{\alpha_{k-1}-1}\, (1-\theta_1-\cdots-\theta_{k-2})\text d\eta\\
&=\prod_{i=1}^{k-2} \theta_i^{\alpha_i-1}\,(1-\theta_1-\cdots-\theta_{k-2})^{\alpha_{k-1}+\alpha_k-1}\,
\underbrace{\int_0^1 (1-\eta)^{\alpha_{k}-1}\eta^{\alpha_{k-1}-1}\,\text d\eta}_\text{constant in $\theta$}\\
&\propto\prod_{i=1}^{k-2} \theta_i^{\alpha_i-1}\,(1-\theta_1-\cdots-\theta_{k-2})^{\alpha_{k-1}+\alpha_k-1}\,
\end{align}
