Tutorials › Statistical Theory I - Probability and Distribution Theory › The Beta-Gamma Ratio Construction

Uniform, Beta, and Gamma Laws · Tutorial 170 of 994

The Beta-Gamma Ratio Construction

Learn how a change of variables turns two independent common-rate gamma variables into an independent gamma sum and beta ratio.

Beginner 9 min read

What You'll Learn

  • Define the sum and ratio of two positive gamma random variables.
  • Calculate the Jacobian for the sum-and-ratio transformation.
  • Derive the beta density of the ratio and gamma density of the sum.
  • Prove that the ratio and sum are independent when the gamma rates agree.
  • Work explicit probability calculations for beta ratios.
  • Identify what changes when the gamma rates are unequal.

Why a Sum and Ratio Belong Together

Suppose two positive random quantities are generated independently. Their total describes their combined size, while their ratio describes how that total is divided between them. For gamma variables with a common rate, these two summaries have a particularly clean relationship: the total is again gamma distributed, the proportion is beta distributed, and the two summaries are independent.

The key is not just that a beta distribution appears. The transformation separates the joint density into a function of the total and a function of the proportion. That factorization gives both marginal distributions and independence in one calculation. The shared rate is essential to this separation.

Definitions and the Change of Variables

Definition: For \(a>0\) and rate \(\lambda>0\), a gamma random variable \(X\sim\operatorname{Gamma}(a,\lambda)\) has density $$ f_X(x)=\frac{\lambda^a}{\Gamma(a)}x^{a-1}e^{-\lambda x},\qquad x>0, $$ where \(\Gamma(a)=\int_0^\infty t^{a-1}e^{-t}\,dt\). For \(a,b>0\), a beta random variable \(R\sim\operatorname{Beta}(a,b)\) has density $$ f_R(r)=\frac{1}{B(a,b)}r^{a-1}(1-r)^{b-1},\qquad 0<r<1, $$ where \(B(a,b)=\int_0^1r^{a-1}(1-r)^{b-1}\,dr\).

Let \(X\sim\operatorname{Gamma}(a,\lambda)\) and \(Y\sim\operatorname{Gamma}(b,\lambda)\) be independent, with \(a,b,\lambda>0\). Define the total \(S=X+Y\) and the proportion \(R=X/(X+Y)\). Since gamma variables with positive shape are positive with probability one, \(S>0\) and \(0<R<1\) with probability one.

The inverse transformation is \(X=SR\), \(Y=S(1-R)\). Its Jacobian determinant is

$$ \left|\frac{\partial(x,y)}{\partial(s,r)}\right| = \left| \begin{matrix} r & s\\ 1-r & -s \end{matrix} \right| =s. $$

The factor \(s\) is required by the change-of-variables formula. Omitting it would give incorrect powers of \(s\), and would prevent the transformed density from separating into the claimed gamma and beta factors.

The Beta-Gamma Ratio Theorem

Before factoring the transformed density, the normalizing constants can be related by the beta-gamma identity. For \(a,b>0\),

Identity: $$ B(a,b)=\frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}. $$

To verify the identity, start with the product of the gamma integrals. In the positive quadrant, set \(u=st\) and \(v=s(1-t)\), where \(s>0\), \(0<t<1\), and the absolute Jacobian is \(s\). The integrand and area element become

$$ u^{a-1}v^{b-1}e^{-(u+v)}\,du\,dv =s^{a+b-1}e^{-s}t^{a-1}(1-t)^{b-1}\,ds\,dt. $$

All integrands are nonnegative, so the change of variables and the separation of the two integrals are justified by the change-of-variables theorem and Tonelli's theorem. Therefore

$$ \Gamma(a)\Gamma(b) =\left(\int_0^\infty s^{a+b-1}e^{-s}\,ds\right) \left(\int_0^1t^{a-1}(1-t)^{b-1}\,dt\right) =\Gamma(a+b)B(a,b). $$

Dividing by the finite positive quantity \(\Gamma(a+b)\) proves the identity. \(\square\)

Theorem: If \(X\sim\operatorname{Gamma}(a,\lambda)\) and \(Y\sim\operatorname{Gamma}(b,\lambda)\) are independent, then \(S=X+Y\) and \(R=X/(X+Y)\) are independent, with $$ S\sim\operatorname{Gamma}(a+b,\lambda), \qquad R\sim\operatorname{Beta}(a,b). $$

Proof. Independence of \(X\) and \(Y\) gives their joint density as the product of their densities. Substitute \(x=sr\), \(y=s(1-r)\), and multiply by the Jacobian \(s\). On \(s>0,\ 0<r<1\), this yields

$$ \begin{aligned} f_{S,R}(s,r) &=\frac{\lambda^{a+b}}{\Gamma(a)\Gamma(b)} (sr)^{a-1}\{s(1-r)\}^{b-1}e^{-\lambda s}s\\ &=\frac{\lambda^{a+b}}{\Gamma(a)\Gamma(b)} s^{a+b-1}e^{-\lambda s}r^{a-1}(1-r)^{b-1}\\ &=\left\{\frac{\lambda^{a+b}}{\Gamma(a+b)} s^{a+b-1}e^{-\lambda s}\right\} \left\{\frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)} r^{a-1}(1-r)^{b-1}\right\}. \end{aligned} $$

By the beta-gamma identity, the first braced expression is the gamma density with shape \(a+b\) and rate \(\lambda\); the second is the beta density with parameters \(a,b\). Each integrates to one on its support. The joint density is their product, which proves both the stated marginal distributions and independence. \(\square\)

Worked Examples

Worked Example: Shapes Two and Three With Rate Two

Let \(X\sim\operatorname{Gamma}(2,2)\) and \(Y\sim\operatorname{Gamma}(3,2)\) independently. Find the distributions of \(S=X+Y\) and \(R=X/(X+Y)\), then calculate \(P(R<1/2)\).

First check the gamma density constants. Since \(\Gamma(2)=1\) and \(\Gamma(3)=2\),

$$ f_X(x)=\frac{2^2}{\Gamma(2)}xe^{-2x}=4xe^{-2x}, \qquad f_Y(y)=\frac{2^3}{\Gamma(3)}y^2e^{-2y}=4y^2e^{-2y}. $$

The theorem gives \(S\sim\operatorname{Gamma}(5,2)\), \(R\sim\operatorname{Beta}(2,3)\), and independence. In particular, the ratio density is

$$ f_R(r)=\frac{\Gamma(5)}{\Gamma(2)\Gamma(3)}r(1-r)^2 =12r(1-r)^2,\qquad 0<r<1. $$

Integrating this density gives

$$ P(R<1/2) =\int_0^{1/2}12r(1-r)^2\,dr =\left[6r^2-8r^3+3r^4\right]_0^{1/2} =\frac{3}{2}-1+\frac{3}{16} =\frac{11}{16}. $$

The probability concerns the ratio only. The independence result says that this event is also independent of any event determined by \(S\).

Worked Example: A Symmetric Beta Ratio

Let \(X\) and \(Y\) be independent \(\operatorname{Gamma}(2,5)\) variables. Find the joint density of their sum \(S\) and ratio \(R\), and calculate \(P(1/4<R<3/4)\).

Here the original densities are \(f_X(x)=25xe^{-5x}\) and \(f_Y(y)=25ye^{-5y}\). Applying the transformation directly gives

$$ f_{S,R}(s,r)=625r(1-r)s^3e^{-5s},\qquad s>0,\ 0<r<1. $$

The factors can be written as

$$ \left(\frac{5^4}{\Gamma(4)}s^3e^{-5s}\right) \left(6r(1-r)\right), $$

because \(5^4/\Gamma(4)=625/6\), and \((625/6)\cdot6=625\). Thus \(S\sim\operatorname{Gamma}(4,5)\), \(R\sim\operatorname{Beta}(2,2)\), and they are independent.

For this beta density, an antiderivative is \(3r^2-2r^3\). Hence

$$ \begin{aligned} P(1/4<R<3/4) &=\left[3r^2-2r^3\right]_{1/4}^{3/4}\\ &=\left(\frac{27}{16}-\frac{27}{32}\right) -\left(\frac{3}{16}-\frac{1}{32}\right) =\frac{27}{32}-\frac{5}{32} =\frac{11}{16}. \end{aligned} $$

The matching shapes make the ratio density symmetric around \(1/2\), as is also visible from \(6r(1-r)\).

Worked Example: What Unequal Rates Change

Now let \(X\sim\operatorname{Gamma}(2,1)\) and \(Y\sim\operatorname{Gamma}(3,2)\) independently. Derive the density of \(R=X/(X+Y)\) and determine whether the common-rate theorem applies.

The densities are \(f_X(x)=xe^{-x}\) and \(f_Y(y)=4y^2e^{-2y}\). Under the sum-and-ratio transformation, their joint density becomes

$$ f_{S,R}(s,r) =4r(1-r)^2s^4e^{-s\{r+2(1-r)\}} =4r(1-r)^2s^4e^{-s(2-r)}. $$

Integrate out \(s\). For \(c>0\), substitution \(t=cs\) in the gamma integral gives \(\int_0^\infty s^4e^{-cs}\,ds=\Gamma(5)/c^5\). Therefore

$$ f_R(r) =4r(1-r)^2\frac{\Gamma(5)}{(2-r)^5} =\frac{96r(1-r)^2}{(2-r)^5},\qquad 0<r<1. $$

This is not a beta density: its powers at the two boundaries would require beta parameters \(2\) and \(3\), but the extra factor \((2-r)^{-5}\) is not constant. The sum and ratio are not independent either. For fixed \(s\), the joint density as a function of \(r\) contains \(e^{-s(2-r)}\); after conditioning on \(S=s\), the dependence on \(r\) still varies with \(s\). Thus neither conclusion of the common-rate theorem can be carried over unchanged.

Why the Construction Matters—and a Common Pitfall

The construction provides a direct way to generate a beta variable: draw two independent gamma variables with the same rate and divide the first by their sum. It also explains why beta laws naturally describe proportions: the common scale factor \(\lambda\) disappears from the ratio density, while the shapes determine how the total is divided. The total and proportion are independent precisely because the transformed density separates.

Common mistake: One might reason that the ratio must be beta whenever \(X\) and \(Y\) are independent gamma variables, without checking their rates. The derivation shows why that is wrong. A common rate makes the exponential term depend on \(s\) alone:

$$ e^{-\lambda sr}e^{-\lambda s(1-r)}=e^{-\lambda s}. $$

With unequal rates, the transformed exponential term depends jointly on \(s\) and \(r\), so the factorization fails. Another frequent error is to forget the Jacobian \(s\); the transformation changes area, and its determinant must be included before identifying either density.

Key takeaway: For independent gamma variables with a shared rate, the sum has the summed shape and unchanged rate, while the ratio of the first variable to the sum is beta with the original shapes. The sum and ratio are independent; a shared rate is a required condition.

Check Your Understanding

Use the definitions and change-of-variables argument above to answer these questions.

  1. If \(X\sim\operatorname{Gamma}(3,4)\) and \(Y\sim\operatorname{Gamma}(5,4)\) independently, what are the distributions of \(X+Y\) and \(X/(X+Y)\)? Are they independent?
  2. For independent \(X\sim\operatorname{Gamma}(2,\lambda)\) and \(Y\sim\operatorname{Gamma}(4,\lambda)\), write the support of the transformed pair \((S,R)\).
  3. In the sum-and-ratio change of variables, what is the absolute Jacobian determinant, and what error can result from omitting it?
  4. Why does the common rate make the exponential part of the transformed joint density depend only on the sum?
  5. If two independent gamma variables have different rates, which part of the factorization argument can fail?