B Function (LibreOffice Calc)

Statistical Advanced LibreOffice Calc Introduced in LibreOffice 3.0
statistics probability beta-function gamma-function continuous-distributions advanced-math

The B function returns the value of the beta function B(x; y). It is mathematically equivalent to Beta(x, y) = Γ(x)·Γ(y) / Γ(x + y). This function is rarely used directly but is essential in probability theory, continuous distributions, and advanced mathematical modeling.

Compatibility

What the B Function Does

  • Computes the beta function B(x; y)
  • Equivalent to:
    B(x; y) = Γ(x) · Γ(y) / Γ(x + y)
  • Used in probability distributions, Bayesian statistics, and continuous modeling
  • Forms the normalization constant of the beta distribution

Syntax

B(x; y)

Arguments

  • x:
    A positive real number.

  • y:
    A positive real number.

Basic Examples

Simple beta function

=B(2; 5)
→ 0.033333...

Using cell references

=B(A1; B1)

Symmetry property

=B(3; 4) = B(4; 3)

Advanced Examples

Relationship to the gamma function

=GAMMA(x) * GAMMA(y) / GAMMA(x + y)

Compute normalization constant for a beta distribution

=1 / B(α; β)

Compute beta PDF manually

=x^(α-1) * (1-x)^(β-1) / B(α; β)

Compute log‑beta using BETALN

=EXP(BETALN(x; y))

Use in Bayesian posterior calculations

=B(k+α; n-k+β) / B(α; β)

Edge Cases and Behavior Details

B returns a positive real number

Accepts:

  • x > 0
  • y > 0

Behavior details

  • B(x; y) is symmetric: B(x; y) = B(y; x)
  • Rapidly decreases for large x and y
  • Related to binomial coefficients via:
    B(x; y) = (Γ(x)·Γ(y)) / Γ(x+y)
  • Used as the denominator of the beta distribution PDF

Invalid input → Err:502

B of an error → error propagates

Common Errors and Fixes

Err:502 — Invalid argument

Cause:

  • x ≤ 0 or y ≤ 0
  • Non-numeric input

Fix:

  • Validate x and y
  • Convert text with VALUE

Overflow in gamma-based calculations

Cause:

  • Large x or y values

Fix:

  • Use BETALN for stable log‑space calculations

Best Practices

  • Use B for exact beta‑function values
  • Use BETALN for stable log‑beta calculations
  • Use BETA or BETA.DIST for probability distributions
  • Validate x and y to avoid domain errors
  • Use GAMMA and GAMMALN for related computations
The B function is the mathematical backbone of the beta distribution — essential for advanced probability modeling and Bayesian analysis.

Related Patterns and Alternatives

  • Use BETA for the beta PDF
  • Use BETA.DIST for PDF/CDF
  • Use BETAINV for quantiles
  • Use BETALN for stable log‑beta calculations
  • Use GAMMA and GAMMALN for gamma‑function workflows

By mastering the B function, you gain direct access to one of the most important special functions in statistics and probability theory.

Copyright 2026. All rights reserved.