Contents
Deep Breakdown
What it tells me (Situation Awareness): The power rule for integration is the most used antiderivative formula. It says: to integrate raised to any constant power (except ), raise the exponent by 1 and divide by the new exponent. The restriction is critical: (handled by the Reciprocal Logarithmic rule). This formula appears constantly in statistics: computing moments for uniform and polynomial distributions, normalizing polynomial density functions, evaluating the integrals that define the beta distribution normalizing constant, and computing areas for polynomial cost/revenue curves. The power rule also works for fractional exponents: .
Flowchart
Real-world use
Where it is used
Whenever an integrand is a monomial or a sum of monomials (polynomial). In statistics: computing moments of the uniform distribution, beta function integrals, normalizing constants of polynomial density models. In ML: integrating polynomial approximations, computing closed-form integrals in Bayesian conjugate models, and evaluating area formulas in regularization.
Problem it solves
Given a polynomial rate or density function, the power rule provides the exact closed-form total accumulation, avoiding numerical integration. Any integral involving (with ) has a clean analytic answer.
How it solves the problem
Reverse the power rule for differentiation: , so . Therefore is the antiderivative. Division by exactly compensates the multiplicative factor that differentiation introduced. When , this would divide by zero, hence the logarithmic exception.
Example in a business
The Beta distribution with has PDF on . Computing involves integrating ; expanding via the binomial theorem gives a sum of monomials, each integrated by the power rule. This produces the closed-form , foundational for Bayesian A/B test posterior mean estimation.
The formula, piece by piece
Each symbol:
- : integration operator
- : the integrand, a power function with variable and constant exponent
- : the exponent, any real number except
- : the base raised to the exponent incremented by one
- : the new exponent, also appears in the denominator as a divisor
- : constant of integration (the family of all antiderivatives differs only by ) Special cases worth memorizing:
- :
- :
- :
- :
- :
The formula in words
"To integrate to the power : increase the exponent by one (from to ), then divide the whole thing by that new exponent. Add the constant for the full family of antiderivatives. This is the exact reverse of the differentiation power rule, which decreases the exponent by one and multiplies by the original exponent."
Critical Concepts
- Why : if , then and we divide by zero. The antiderivative of is , a separate formula.
- Linearity: integrate a polynomial term by term: .
- Verify by differentiating:
- Works for all real : integers, fractions, and negative values.
- Definite version: .
Step-by-step calculation (tiny example)
Compute (indefinite) and (definite).
Step 1: Identify n . Since , the power rule applies.
Step 2: Apply the formula for the indefinite integral . Antiderivative: .
Step 3: Verify by differentiating
Step 4: Evaluate the definite integral using FTC
Step 5: Interpret The area under from to is exactly 4 square units.
Code examples
Beginner example (Python)
import numpy as np
from scipy import integrate
def power_antiderivative(x: float, n: float) -> float:
"""F(x) = x^(n+1) / (n+1). Raises ValueError for n == -1."""
if abs(n + 1) < 1e-12:
raise ValueError("n = -1 is undefined for power rule. Use ln|x|.")
return x ** (n + 1) / (n + 1)
def power_rule_definite(a: float, b: float, n: float) -> float:
"""Definite integral int_a^b x^n dx via FTC: F(b) - F(a)."""
return power_antiderivative(b, n) - power_antiderivative(a, n) # Test several values of n (including fractional and negative)
test_cases = [ (0.0, 2.0, 3.0), # int x^3 dx from 0 to 2 = 4
(1.0, 4.0, 0.5), # int sqrt(x) dx from 1 to 4
(1.0, 3.0, -2.0), # int x^-2 dx from 1 to 3
(0.0, 1.0, 0.0), # int 1 dx from 0 to 1 = 1
]
for a, b, n in test_cases:
analytic = power_rule_definite(a, b, n)
numerical, _ = integrate.quad(lambda x, nn=n: x**nn, a, b)
print(f"n={n:5.1f}, [{a},{b}]: analytic={analytic:.6f}, " f"numerical={numerical:.6f}, match={abs(analytic - numerical) < 1e-8}") # Polynomial: int_0^3 (2x^3 - 5x + 1) dx
# = 2*(81/4) - 5*(9/2) + 3 = 40.5 - 22.5 + 3 = 21.0
poly_analytic = (2 * power_rule_definite(0, 3, 3) - 5 * power_rule_definite(0, 3, 1) + power_rule_definite(0, 3, 0))
poly_numerical, _ = integrate.quad(lambda x: 2 * x**3 - 5 * x + 1, 0, 3)
print(f"\nPolynomial int_0^3 (2x^3-5x+1) dx: " f"analytic={poly_analytic:.4f}, numerical={poly_numerical:.4f}")Beginner example (R)
power_antiderivative <- function(x, n) { if (abs(n + 1) < 1e-12) stop("n = -1 is undefined. Use ln|x| rule.") x^(n + 1) / (n + 1)
}
power_rule_definite <- function(a, b, n) { power_antiderivative(b, n) - power_antiderivative(a, n)
} # Test cases
test_cases <- list(c(0, 2, 3), c(1, 4, 0.5), c(1, 3, -2), c(0, 1, 0))
for (tc in test_cases) { a <- tc[1]; b <- tc[2]; n <- tc[3]
analytic <- power_rule_definite(a, b, n)
numerical <- integrate(function(x) x^n, lower = a, upper = b)$value
cat(sprintf("n=%5.1f, [%g,%g]: analytic=%.6f, numerical=%.6f, match=%s\n", n, a, b, analytic, numerical, isTRUE(all.equal(analytic, numerical, tol = 1e-7))))
} # Polynomial: int_0^3 (2x^3 - 5x + 1)
dx = 21.0
poly_analytic <- (2 * power_rule_definite(0, 3, 3) - 5 * power_rule_definite(0, 3, 1) + power_rule_definite(0, 3, 0))
poly_numerical <- integrate(function(x) 2 * x^3 - 5 * x + 1, 0, 3)$value
cat(sprintf("\nPolynomial: analytic=%.4f, numerical=%.4f\n", poly_analytic, poly_numerical))Professional example (Python)
"""
Power rule for computing Beta distribution moments in Bayesian A/B testing. E[X] for Beta(alpha, beta) = alpha / (alpha + beta).
Derived by applying power rule to the polynomial expansion of
(1-x)^(beta-1) and integrating term by term.
"""
import numpy as np
from scipy import integrate, stats
def beta_posterior_mean(prior_alpha: float, prior_beta: float, conversions: int, non_conversions: int) -> float:
"""E[theta] = alpha / (alpha + beta). Closed-form via power rule."""
alpha = prior_alpha + conversions
beta_param = prior_beta + non_conversions
return alpha / (alpha + beta_param)
def beta_posterior_mean_numerical(prior_alpha: float, prior_beta: float, conversions: int, non_conversions: int) -> float:
"""Numerical check: int_0^1 x * f(x; alpha, beta) dx."""
alpha = prior_alpha + conversions
beta_param = prior_beta + non_conversions
dist = stats.beta(alpha, beta_param)
mean_num, _ = integrate.quad(lambda x: x * dist.pdf(x), 0.0, 1.0)
return mean_num # A/B experiment with non-informative Beta(1,1) prior
PRIOR_ALPHA = 1.0
PRIOR_BETA = 1.0
variants = { "Control A": (420, 80), "Variant B": (450, 50),
}
print(f"{'Variant':<12} {'Analytic E[X]':>14} {'Numerical E[X]':>15} {'Match':>6}")
print("-" * 52)
for name, (conv, non_conv) in variants.items():
analytic = beta_posterior_mean(PRIOR_ALPHA, PRIOR_BETA, conv, non_conv)
numerical = beta_posterior_mean_numerical(PRIOR_ALPHA, PRIOR_BETA, conv, non_conv)
match = abs(analytic - numerical) < 1e-8
print(f"{name:<12} {analytic:>14.6f} {numerical:>15.6f} {str(match):>6}")
for name, (conv, non_conv) in variants.items():
alpha = PRIOR_ALPHA + conv
beta_p = PRIOR_BETA + non_conv
dist = stats.beta(alpha, beta_p)
ci_lo, ci_hi = float(dist.ppf(0.025)), float(dist.ppf(0.975))
mean_val = alpha / (alpha + beta_p)
print(f"\n{name}: mean={mean_val:.4f}, 95% CI=[{ci_lo:.4f}, {ci_hi:.4f}]")
print("\n[Power rule derivation: E[X] = int_0^1 x*sum_k C(k)*x^k dx")
print(" Each x^(alpha+k) integrated by power rule -> closed-form alpha/(alpha+beta)]")Source: 1300 p. 235