What is the Beta function?
The Beta function, also called the Euler integral of the first kind, is a special function of two arguments written \(B(a, b)\). It appears throughout probability (the Beta distribution), statistics, combinatorics and the evaluation of definite integrals. This calculator returns the numerical value of \(B(a, b)\) for any two real numbers \(a\) and \(b\), including negative arguments where the function is still defined through its gamma-ratio extension.
How to use this calculator
Enter the first argument \(a\) and the second argument \(b\). Both are pure dimensionless numbers, so no units are required. Choose how many significant digits to display (up to the roughly 15 digits a double-precision result can resolve) and read the value \(B(a, b)\) from the hero box. Because the function is symmetric, swapping \(a\) and \(b\) gives exactly the same answer.
The formula explained
The integral definition is $$B(a, b) = \int_0^1 t^{a-1}(1-t)^{b-1}\, dt$$ for \(\operatorname{Re}(a) > 0\) and \(\operatorname{Re}(b) > 0\). For computation we use the equivalent closed form $$B(a, b) = \frac{\Gamma(a)\,\Gamma(b)}{\Gamma(a+b)}.$$ To avoid overflow with large arguments, the calculator works in logarithms: \(\ln B = \ln\Gamma(a) + \ln\Gamma(b) - \ln\Gamma(a+b)\), then exponentiates and applies the correct sign. The gamma values come from a Lanczos approximation (\(g = 7\)), with the reflection formula \(\Gamma(x)\Gamma(1-x) = \pi/\sin(\pi x)\) handling arguments below 0.5.
Worked example
For \(a = 1.5\) and \(b = 0.2\): \(\Gamma(1.5) = \sqrt{\pi}/2 \approx 0.886227\), \(\Gamma(0.2) \approx 4.590844\) and \(\Gamma(1.7) \approx 0.908639\). Then $$B(1.5, 0.2) = \frac{0.886227 \times 4.590844}{0.908639} \approx 4.47748.$$ A clean check: $$B(2, 3) = \frac{\Gamma(2)\Gamma(3)}{\Gamma(5)} = \frac{1\cdot 2}{24} = \frac{1}{12} \approx 0.083333.$$
Key Terms and Symbols
- Beta function \(B(a,b)\)
- The Euler Beta function, defined by the integral \(B(a,b)=\int_0^1 t^{a-1}(1-t)^{b-1}\,dt\) for \(a,b>0\), and equivalently by the gamma ratio \(B(a,b)=\Gamma(a)\Gamma(b)/\Gamma(a+b)\). It is symmetric: \(B(a,b)=B(b,a)\).
- Gamma function \(\Gamma(x)\)
- The continuous extension of the factorial, \(\Gamma(x)=\int_0^\infty t^{x-1}e^{-t}\,dt\) for \(x>0\), satisfying \(\Gamma(n)=(n-1)!\) for positive integers and \(\Gamma(x+1)=x\,\Gamma(x)\).
- Arguments \(a\) and \(b\)
- The two real parameters of the Beta function. The integral definition converges for \(a>0\) and \(b>0\); the gamma-ratio form extends \(B\) to other real values except where the gamma factors have poles.
- Log-gamma \(\ln\Gamma(x)\)
- The natural logarithm of the gamma function. Computing \(B\) as \(\exp[\ln\Gamma(a)+\ln\Gamma(b)-\ln\Gamma(a+b)]\) avoids the very large intermediate values that \(\Gamma\) itself produces, keeping the result numerically stable.
- Lanczos approximation
- A widely used series approximation for \(\Gamma(x)\) (and \(\ln\Gamma(x)\)) that achieves high accuracy with a small fixed set of coefficients, commonly used inside Beta and gamma calculators.
- Reflection formula
- The identity \(\Gamma(x)\,\Gamma(1-x)=\dfrac{\pi}{\sin(\pi x)}\), used to evaluate the gamma function for negative or small arguments where direct series do not apply.
- Pole / divergence
- The gamma function has poles at \(x=0,-1,-2,\dots\) where it diverges. Consequently \(B(a,b)\) diverges when \(a\) or \(b\) is a non-positive integer (unless cancelled by the denominator), so such inputs have no finite value.
- Relation to the Beta distribution
- The Beta function is the normalizing constant of the Beta distribution: its probability density is \(f(x)=\dfrac{x^{a-1}(1-x)^{b-1}}{B(a,b)}\) on \([0,1]\). The same \(a\) and \(b\) parameters appear in the Beta distribution mean and variance.
FAQ
Is \(B(a, b)\) always positive? For \(a > 0\) and \(b > 0\) it is always positive and finite. For negative non-integer arguments the sign follows the product of the signs of the underlying gamma values.
What happens at non-positive integers? If \(a\) or \(b\) is \(0, -1, -2, \ldots\) the result diverges (undefined). If only \(a+b\) is a non-positive integer, the denominator pole dominates and \(B(a, b) = 0\).
Why use the gamma-ratio instead of the integral? It is a closed form, faster, and via log-gamma it stays accurate for both very small and very large arguments where direct integration would struggle.