Skip to content

Commit 97f8659

Browse files
authored
added 3 proofs
1 parent 08ecf07 commit 97f8659

3 files changed

Lines changed: 398 additions & 0 deletions

File tree

P/beta-med.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
layout: proof
3+
mathjax: true
4+
5+
author: "Joram Soch"
6+
affiliation: "BCCN Berlin"
7+
e_mail: "joram.soch@bccn-berlin.de"
8+
date: 2025-10-24 13:45:52
9+
10+
title: "Median of the beta distribution"
11+
chapter: "Probability Distributions"
12+
section: "Univariate continuous distributions"
13+
topic: "Beta distribution"
14+
theorem: "Median"
15+
16+
sources:
17+
- authors: "Wikipedia"
18+
year: 2025
19+
title: "Beta distribution"
20+
in: "Wikipedia, the free encyclopedia"
21+
pages: "retrieved on 2025-10-24"
22+
url: "https://en.wikipedia.org/wiki/Beta_distribution#Median"
23+
24+
proof_id: "P519"
25+
shortcut: "beta-med"
26+
username: "JoramSoch"
27+
---
28+
29+
30+
**Theorem:** Let $X$ be a [random variable](/D/rvar) following a [beta distribution](/D/beta):
31+
32+
$$ \label{eq:beta}
33+
X \sim \mathrm{Bet}(\alpha, \beta) \; .
34+
$$
35+
36+
Then, the [median](/D/med) of $X$ is
37+
38+
$$ \label{eq:beta-med}
39+
\mathrm{median}(X) = \mathrm{B}_{\alpha,\beta}^{-1}\left( \frac{\mathrm{B}(\alpha,\beta)}{2} \right) = \mathrm{I}_{1/2}^{-1}(\alpha,\beta)
40+
$$
41+
42+
where $\mathrm{B}(a,b)$ is the beta function, $\mathrm{B}_{a,b}^{-1}(y)$ is the inverse function of the incomplete beta function $\mathrm{B}(x; a, b)$ and $\mathrm{I}_y^{-1}(a,b)$ is the inverse function of the regularized incomplete beta function.
43+
44+
45+
**Proof:** The [median](/D/med) is the value at which the [cumulative distribution function](/D/cdf) is $1/2$:
46+
47+
$$ \label{eq:median}
48+
F_X(\mathrm{median}(X)) = \frac{1}{2} \; .
49+
$$
50+
51+
The [cumulative distribution function of the beta distribution](/P/beta-cdf) is
52+
53+
$$ \label{eq:beta-cdf}
54+
F_X(x) = \frac{\mathrm{B}(x; \alpha, \beta)}{\mathrm{B}(\alpha, \beta)}
55+
$$
56+
57+
where the incomplete beta function $\mathrm{B}(x; a, b)$ is given by
58+
59+
$$ \label{eq:inc-beta-fct}
60+
\mathrm{B}(x; a, b) = \int_0^x t^{a-1} (1-t)^{b-1} \, \mathrm{d}t \; .
61+
$$
62+
63+
Thus, the inverse CDF, i.e. the [quantile function](/D/qf), is
64+
65+
$$ \label{eq:beta-cdf-inv}
66+
x = \mathrm{B}_{\alpha,\beta}^{-1}(p \, \mathrm{B}(\alpha,\beta))
67+
$$
68+
69+
where $\mathrm{B}_{a,b}^{-1}(y)$ is the inverse function of $\mathrm{B}(x; a, b)$. Setting $p = 1/2$, we obtain:
70+
71+
$$ \label{eq:beta-med-qed}
72+
\mathrm{median}(X) = \mathrm{B}_{\alpha,\beta}^{-1}\left( \frac{\mathrm{B}(\alpha,\beta)}{2} \right) \; .
73+
$$
74+
75+
Alternatively, the cumulative distribution function may be written as
76+
77+
$$ \label{eq:beta-cdf-alt}
78+
F_X(x) = \mathrm{I}_x(a,b)
79+
$$
80+
81+
using the regularized incomplete beta function
82+
83+
$$ \label{eq:reg-inc-beta-fct}
84+
\mathrm{I}_x(a,b) = \frac{\mathrm{B}(x; \alpha, \beta)}{\mathrm{B}(\alpha, \beta)}
85+
$$
86+
87+
in which case the inverse CDF is
88+
89+
$$ \label{eq:beta-cdf-inv-alt}
90+
x = \mathrm{I}_p^{-1}(a,b) \; ,
91+
$$
92+
93+
such that the median becomes
94+
95+
$$ \label{eq:beta-med-qed-alt}
96+
\mathrm{median}(X) = \mathrm{I}_{1/2}^{-1}(\alpha,\beta) \; .
97+
$$

P/beta-mode.md

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
---
2+
layout: proof
3+
mathjax: true
4+
5+
author: "Joram Soch"
6+
affiliation: "BCCN Berlin"
7+
e_mail: "joram.soch@bccn-berlin.de"
8+
date: 2025-10-24 13:48:56
9+
10+
title: "Mode of the beta distribution"
11+
chapter: "Probability Distributions"
12+
section: "Univariate continuous distributions"
13+
topic: "Beta distribution"
14+
theorem: "Mode"
15+
16+
sources:
17+
- authors: "Wikipedia"
18+
year: 2025
19+
title: "Beta distribution"
20+
in: "Wikipedia, the free encyclopedia"
21+
pages: "retrieved on 2025-10-24"
22+
url: "https://en.wikipedia.org/wiki/Beta_distribution#Mode"
23+
24+
proof_id: "P520"
25+
shortcut: "beta-mode"
26+
username: "JoramSoch"
27+
---
28+
29+
30+
**Theorem:** Let $X$ be a [random variable](/D/rvar) following a [beta distribution](/D/beta):
31+
32+
$$ \label{eq:beta}
33+
X \sim \mathrm{Bet}(\alpha, \beta) \; .
34+
$$
35+
36+
Then, the [mode](/D/mode) of $X$ is
37+
38+
$$ \label{eq:beta-mode-p1}
39+
\mathrm{mode}(X) \in \left\{
40+
\begin{array}{rl}
41+
\left\lbrace 0, 1 \right\rbrace \; , & \text{if} \quad \alpha < 1 \quad \text{and} \quad \beta < 1 \\
42+
\left[ 0, 1 \right] \; , & \text{if} \quad \alpha = 1 \quad \text{and} \quad \beta = 1
43+
\end{array}
44+
\right.
45+
$$
46+
47+
and
48+
49+
$$ \label{eq:beta-mode-p2}
50+
\mathrm{mode}(X) = \left\{
51+
\begin{array}{rl}
52+
0 \; \text{or} \; 1 \; ,
53+
& \text{if} \quad \alpha < 1 \quad \text{or} \quad \beta < 1 \quad (\text{but not} \; \alpha < 1 \; \text{and} \; \beta < 1) \\
54+
\frac{\alpha-1}{\alpha+\beta-2} \; ,
55+
& \text{if} \quad \alpha \geq 1 \quad \text{and} \quad \beta \geq 1 \quad (\text{but not} \; \alpha = 1 \; \text{and} \; \beta = 1) \; .
56+
\end{array}
57+
\right.
58+
$$
59+
60+
61+
**Proof:** The [mode](/D/mode) is the value which maximizes the [probability density function](/D/pdf):
62+
63+
$$ \label{eq:mode}
64+
\mathrm{mode}(X) = \operatorname*{arg\,max}_x f_X(x) \; .
65+
$$
66+
67+
The [probability density function of the beta distribution](/P/beta-pdf) is:
68+
69+
$$ \label{eq:beta-pdf}
70+
f_X(x) = \frac{1}{\mathrm{B}(\alpha, \beta)} \, x^{\alpha-1} \, (1-x)^{\beta-1} \; .
71+
$$
72+
73+
1) If $\alpha < 1$, then 0 is the mode, since
74+
75+
$$ \label{eq:beta-mode-p2a-s1}
76+
\lim_{\substack{x \rightarrow 0 \\ \alpha < 1}} f_X(x) = \infty \; ,
77+
\quad \text{because} \quad
78+
\lim_{x \rightarrow 0} x^{\alpha-1} = \infty
79+
\quad \text{for} \quad
80+
\alpha < 1 \; ,
81+
$$
82+
83+
and if $\beta < 1$, then 1 is the mode, since
84+
85+
$$ \label{eq:beta-mode-p2a-s2}
86+
\lim_{\substack{x \rightarrow 1 \\ \beta < 1}} f_X(x) = \infty \; ,
87+
\quad \text{because} \quad
88+
\lim_{x \rightarrow 1} (1-x)^{\beta-1} = \infty
89+
\quad \text{for} \quad
90+
\beta < 1 \; .
91+
$$
92+
93+
2) If both $\alpha < 1$ and $\beta < 1$, then
94+
95+
$$ \label{eq:beta-mode-p1a}
96+
\lim_{x \rightarrow 0} f_X(x) = \infty
97+
\quad \text{and} \quad
98+
\lim_{x \rightarrow 1} f_X(x) = \infty \; ,
99+
$$
100+
101+
so any value from the set $\left\lbrace 0, 1 \right\rbrace$ may be considered the mode.
102+
103+
3) If both $\alpha = 1$ and $\beta = 1$, then
104+
105+
$$ \label{eq:beta-mode-p1b}
106+
\begin{split}
107+
f_X(x)
108+
&= \frac{1}{\mathrm{B}(1,1)} \, x^{1-1} \, (1-x)^{1-1} \\
109+
&= \frac{\Gamma(2)}{\Gamma(1) \Gamma(1)} x^0 \, (1-x)^0 \\
110+
&= 1 = \mathrm{const.} \; ,
111+
\end{split}
112+
$$
113+
114+
i.e. the distribution becomes equivalent to the (standard) [continuous uniform distribution](/D/cuni) with parameters $a = 0$ and $b = 1$ which has a [constant probability density function](/P/cuni-pdf). Thus, any value from the interval $\left[ 0,1 \right]$ [may be considered the mode](/P/cuni-mode).
115+
116+
4) For the remaining cases, we must analyze the probability density function. The first two deriatives of this function are:
117+
118+
$$ \label{eq:beta-pdf-der1}
119+
\begin{split}
120+
f'_X(x)
121+
= \frac{\mathrm{d}f_X(x)}{\mathrm{d}x}
122+
&= \frac{1}{\mathrm{B}(\alpha, \beta)} \left[ - (\beta-1) x^{\alpha-1} (1-x)^{\beta-2} + (\alpha-1) x^{\alpha-2} (1-x)^{\beta-1} \right] \\
123+
&= \frac{1}{\mathrm{B}(\alpha, \beta)} \left[ (\alpha-1) x^{\alpha-2} (1-x)^{\beta-1} - (\beta-1) x^{\alpha-1} (1-x)^{\beta-2} \right]
124+
\end{split}
125+
$$
126+
127+
$$ \label{eq:beta-pdf-der2}
128+
\begin{split}
129+
f''_X(x)
130+
= \frac{\mathrm{d}^2f_X(x)}{\mathrm{d}x^2}
131+
&= \frac{1}{\mathrm{B}(\alpha, \beta)} \left[
132+
(\alpha-1) \left( (\alpha-2) x^{\alpha-3} (1-x)^{\beta-1} - (\beta-1) x^{\alpha-2} (1-x)^{\beta-2} \right) - \right. \\
133+
&\hphantom{=} \quad\quad\quad\quad\;
134+
\left. (\beta-1) \left( (\alpha-1) x^{\alpha-2} (1-x)^{\beta-2} - (\beta-2) x^{\alpha-1} (1-x)^{\beta-3} \right)
135+
\right] \\
136+
&= \frac{1}{\mathrm{B}(\alpha, \beta)} \left[
137+
(\alpha-1) (\alpha-2) x^{\alpha-3} (1-x)^{\beta-1} - 2 (\alpha-1) (\beta-1) x^{\alpha-2} (1-x)^{\beta-2} + \right. \\
138+
&\hphantom{=} \quad\quad\quad\quad\;
139+
\left. (\beta-1) (\beta-2) x^{\alpha-1} (1-x)^{\beta-3}
140+
\right] \; .
141+
\end{split}
142+
$$
143+
144+
We now calculate the root of the first derivative \eqref{eq:beta-pdf-der1}:
145+
146+
$$ \label{eq:beta-mode-p2b-s1}
147+
\begin{split}
148+
f'_X(x)
149+
= 0
150+
&= \frac{1}{\mathrm{B}(\alpha, \beta)} \left[ (\alpha-1) x^{\alpha-2} (1-x)^{\beta-1} - (\beta-1) x^{\alpha-1} (1-x)^{\beta-2} \right] \\
151+
&\Leftrightarrow \\
152+
(\beta-1) x^{\alpha-1} (1-x)^{\beta-2} &= (\alpha-1) x^{\alpha-2} (1-x)^{\beta-1} \\
153+
(\beta-1) x &= (\alpha-1) (1-x) \\
154+
x [(\beta-1) + (\alpha-1)] &= \alpha-1 \\
155+
x &= \frac{\alpha-1}{\alpha+\beta-2} \; .
156+
\end{split}
157+
$$
158+
159+
Note that for this quantity, we have
160+
161+
$$ \label{eq:beta-mode-p2b-s2}
162+
\begin{split}
163+
\frac{\alpha-1}{\alpha+\beta-2} &< 0 \; ,
164+
\quad \text{if} \quad \alpha < 1
165+
\quad \text{and} \quad \beta > 2 - \alpha \\
166+
\frac{\alpha-1}{\alpha+\beta-2} &> 1 \; ,
167+
\quad \text{if} \quad \beta < 1
168+
\quad \text{and} \quad \alpha > 2 - \beta \; .
169+
\end{split}
170+
$$
171+
172+
Also note that the following holds:
173+
174+
$$ \label{eq:beta-mode-p2b-s3}
175+
1 - x
176+
= 1 - \frac{\alpha-1}{\alpha+\beta-2}
177+
= \frac{\alpha+\beta-2}{\alpha+\beta-2} - \frac{\alpha-1}{\alpha+\beta-2}
178+
= \frac{\beta-1}{\alpha+\beta-2} \; .
179+
$$
180+
181+
By plugging $x$ and $1-x$ into the second deriative \eqref{eq:beta-pdf-der2}, we find:
182+
183+
$$ \label{eq:beta-mode-p2b-s4}
184+
\begin{split}
185+
f''_X\left( \frac{\alpha-1}{\alpha+\beta-2} \right)
186+
&= \frac{1}{\mathrm{B}(\alpha, \beta)} \left[
187+
(\alpha-1) (\alpha-2) \left( \frac{\alpha-1}{\alpha+\beta-2} \right)^{\alpha-3} \left( \frac{\beta-1}{\alpha+\beta-2} \right)^{\beta-1} - \right. \\
188+
&\hphantom{=} \quad\quad\quad\quad
189+
\left. 2 (\alpha-1) (\beta-1) \left( \frac{\alpha-1}{\alpha+\beta-2} \right)^{\alpha-2} \left( \frac{\beta-1}{\alpha+\beta-2} \right)^{\beta-2} + \right. \\
190+
&\hphantom{=} \quad\quad\quad\quad\;
191+
\left. (\beta-1) (\beta-2) \left( \frac{\alpha-1}{\alpha+\beta-2} \right)^{\alpha-1} \left( \frac{\beta-1}{\alpha+\beta-2} \right)^{\beta-3} \right] \; .
192+
\end{split}
193+
$$
194+
195+
Multiplying with factors which are certainly positive, we can focus on those parts of the second derivative which determine its sign:
196+
197+
$$ \label{eq:beta-mode-p2b-s5}
198+
\begin{split}
199+
\frac{f''_X(x) \cdot \mathrm{B}(\alpha, \beta)}{\left( \frac{\alpha-1}{\alpha+\beta-2} \right)^{\alpha-3} \cdot \left( \frac{\beta-1}{\alpha+\beta-2} \right)^{\beta-3}}
200+
&= (\alpha-1) (\alpha-2) \left( \frac{\beta-1}{\alpha+\beta-2} \right)^2 - \\
201+
&\hphantom{=} 2 (\alpha-1) (\beta-1) \left( \frac{\alpha-1}{\alpha+\beta-2} \right) \left( \frac{\beta-1}{\alpha+\beta-2} \right) + \\
202+
&\hphantom{=} (\beta-1) (\beta-2) \left( \frac{\alpha-1}{\alpha+\beta-2} \right)^2 \; .
203+
\end{split}
204+
$$
205+
206+
Further multiplying with or dividing by terms which are necessarily positive and thus do not change the sign of the function value, we get:
207+
208+
$$ \label{eq:beta-mode-p2b-s6}
209+
\begin{split}
210+
\frac{f''_X(x) \cdot \mathrm{B}(\alpha, \beta)}{\left( \frac{\alpha-1}{\alpha+\beta-2} \right)^{\alpha-3} \cdot \left( \frac{\beta-1}{\alpha+\beta-2} \right)^{\beta-3}} \cdot \frac{(\alpha+\beta-2)^2}{(\alpha-1) (\beta-1)}
211+
&= (\alpha-2) (\beta-1) - 2 (\alpha-1) (\beta-1) + (\alpha-1) (\beta-2) \\
212+
&= (\alpha-1) [(\beta-2)-(\beta-1)] + (\beta-1) [(\alpha-1)-(\alpha-2)] \\
213+
&= - (\alpha-1) - (\beta-1) \\
214+
&< 0,
215+
\quad \text{if} \quad \alpha > 1
216+
\quad \text{and} \quad \beta > 1 \; .
217+
\end{split}
218+
$$
219+
220+
Thus, $f''_X(x)$ is negative for $x = \frac{\alpha-1}{\alpha+\beta-2}$, demonstrating that this is a maximum. To summarize:
221+
222+
* If $\alpha < 1$ and $\beta < 1$, then $f_X(x)$ diverges at both ends and both values from the set $\left\lbrace 0, 1 \right\rbrace$ can be seen as the mode of $X$.
223+
224+
* If $\alpha < 1$ or $\beta < 1$ (but not $\alpha < 1$ and $\beta < 1$), then the mode of $X$ is 0 or 1, because $f_X(x)$ tends towards infinity at $x = 0$ or $x = 1$.
225+
226+
* If $\alpha = 1$ and $\beta = 1$, then $f_X(x)$ is constant and any value in the interval $\left[ 0,1 \right]$ can be seen as the mode of $X$.
227+
228+
* If $\alpha \geq 1$ and $\beta \geq 1$ (but not $\alpha = 1$ and $\beta = 1$), then $0 < x = < 1$ and $f'_X(x) = 0$ and $f''_X(x) < 0$, such that $f_X(x)$ reaches its machimum at $\mathrm{mode}(X) = \frac{\alpha-1}{\alpha+\beta-2}$.

0 commit comments

Comments
 (0)