Stirling formula Created 2026-09-24 Updated 2026-10-14
Stirling's formula turns the long product defining a factorial into a short expression. For positive integers , putThen as . This is asymptotic equivalence: , so the relative error tends to zero. It does not say that the absolute error tends to zero, and the formula is not an equality for finite . The Gamma function extends this approximation beyond integer inputs. [ref]
https://dlmf.nist.gov/5.11. NIST Digital Library of Mathematical Functions, §5.11: Gamma-function asymptotic expansions
For ,The leading estimate is about low. Multiplying by the first correction factor giveswhich is about low. The Stirling correction by Gaussian moments explains why this factor is rather than an arbitrary numerical adjustment.
The usefulness is in ratios as well as in enormous numbers. Applying Stirling's formula to the three factorials in a central binomial coefficient givesThis counts the ways to choose exactly half of objects. Equivalently, for independent fair coin tosses, the binomial distribution assigns probability to exactly heads. An exponentially large count becomes a simple probability scale after cancellation.
For numerical calculations, taking the natural logarithm yieldswhere . Computing a logarithm of a large factorial avoids representing the factorial itself. The Robbins bounds for Stirling's formula give a finite- interval for this logarithmic remainder, rather than only a limiting statement.
The factor is beautiful because a Gaussian integral lies behind a discrete product. The Gaussian peak behind Stirling's formula displays this connection through the Gamma integral and Laplace's method. A rigorous proof must also control the tails of the integral; the local expansion explains the geometry but is not by itself a complete proof.
James Stirling published Methodus differentialis in 1730, a treatise on summation and interpolation of infinite series. This setting connects the formula with a practical calculation problem: taking logarithms turns a long product into a sum, whose growth can be approximated. [ref]
https://commons.wikimedia.org/wiki/File:Methodus_differentialis,_sive_tractatus_de_summatione_et_interpolatione_serierum_infinitarum_(IA_10053880bsb).pdf. James Stirling, Methodus differentialis (1730), digitized original and bibliographic record
Stirling numbers of the second kind 2026-10-14
For nonnegative integers , the Stirling number of the second kindcounts the set partitions of an -element finite set into exactly unlabelled blocks of a set partition. Set , for , and for . Also for . Grassl and Levin develop these counts through explicit set partitions and a recurrence relation. [ref]
https://discrete.openmathbooks.org/more/mdm/sec_adv-partitions.html. Grassl and Levin, More Discrete Mathematics via Graph Theory, section 3.1: counting partitions
Insert one distinguished element. For and , the Stirling numbers of the second kind obeyProof outline. Inspect the block of a set partition containing . If it contains another element, removing leaves a set partition into blocks of a set partition; conversely, insert into any of those blocks of a set partition. If is alone, remove its singleton set and obtain a set partition into blocks of a set partition. The cases cannot overlap, and deletion reverses each construction. This explains the factor even though the blocks of a set partition have no names. [ref]
https://discrete.openmathbooks.org/more/mdm/sec_adv-stirling.html. Grassl and Levin, More Discrete Mathematics via Graph Theory, section 3.4: Stirling recurrence
For , start with the three two-block set partitions of . Inserting into either block of a set partition gives six possibilities. The remaining possibility is , obtained by making a singleton set. Hence . The seven set partitions in the diagram comprise four with sizes and three with sizes ; this grouping by sizes independently gives .
Exact construction of all seven two-block set partitions of : six insert into an existing block of a set partition, and one creates a singleton set
. Details. Three different counting questions. The binomial coefficient selects one -element subset. The Stirling number of the second kind groups all distinct elements into nonempty unnamed blocks of a set partition. The power counts all functions to a specified -element finite set, allowing some destination labels to go unused. At , these counts are respectively , , and . Choosing two people, making two unnamed nonempty teams, and assigning each person a red or blue label are different tasks.
When the destinations have labels. For fixed finite sets of sizes , respectively, the number of surjective functions isHere every element of must be used. Each surjective function gives a set partition of into its nonempty preimages . Conversely, assign the distinct destination labels to the blocks of a set partition in ways, where is a factorial. For two labelled teams of four people this gives : of the assignments, exactly two use only one label. Dividing arbitrary function counts by fails in general because unused labels can be permuted without changing a function. For example, cannot count set partitions. The empty-to-empty function is a surjection, consistent with . Stanley gives the bijection underlying this qualification.[ref]
For example, the inclusion-exclusion principle counts the surjections from four elements to three labelled destinations as . Thus . An independent check chooses the only two-element block of a set partition in ways; the other two elements form singleton sets.
Why these numbers also occur in algebra. Classifying all functions to an -element finite set by the size of their image givesFor a fixed set partition, the falling factorial counts assignments of distinct labels to its blocks of a set partition, and is zero when . At , this reads . Replacing by yields a polynomial identity: both sides agree at every nonnegative integer. Thus the Stirling numbers of the second kind translate powers into falling factorials. Grouping by equal values turns a counting rule into an algebraic change of coordinates. Summing without destination labels instead gives the Bell number.
Taylor polynomial Created 2026-09-24 Updated 2026-10-14
A Taylor polynomial replaces a function near a chosen point by a polynomial with matching derivatives. If has derivatives through order at , defineThe factorial denominator makes for . This determines a unique polynomial of degree of a polynomial at most . Order zero matches the value, order one also matches the tangent line, and order two also incorporates the second derivative. Matching more local information is useful because polynomials are easy to evaluate, differentiate, and integrate. The distinction between the finite Taylor polynomial and the infinite Taylor series is developed in OpenStax, Taylor and Maclaurin series.
For a computed example, let and expand at zero. Its first three derivatives giveAt , the linear approximation is and the quadratic approximation is , compared with . The quadratic correction captures the downward bending of the square root and reduces the absolute difference from about to .
Matching more derivatives improves a local square-root approximation, and the third derivative supplies an error bound
. Details. The Taylor remainder turns this convenient approximation into a controlled calculation. On , is positive and at most . The Taylor theorem with Lagrange remainder therefore givesConsequently follows without using the displayed decimal evaluation as evidence. The Taylor polynomial and the Taylor remainder play different roles: the former supplies an answer that is easy to compute, while the latter specifies what accuracy is justified. Farther from the expansion point, the same low-degree polynomial need not remain accurate.
Taylor series Created 2026-09-24 Updated 2026-10-14
For a function with derivatives of every order at , its Taylor series is the power seriesIts partial sums are Taylor polynomials. At it is called a Maclaurin series. Forming the coefficients, proving that its partial sums form a convergent sequence, and proving that their limit equals are separate tasks. A smooth function provides all the coefficients, but a real analytic function is additionally represented locally by the resulting power series.
For the exponential function, every derivative of at zero equals one, givingHere equality holds for every real : the Taylor remainder is bounded by , which tends to zero for each fixed . At , the degree-five Taylor polynomial is , and the absolute difference from is less than . The factorial denominator eventually overwhelms every fixed power, allowing local derivative information to reconstruct this function throughout the real line.
The geometric series shows why the region of validity matters. For , the Taylor series at zero is , with radius of convergence one. For , its finite Taylor polynomial satisfies the exact identityAt and , the remainder is . At , the same degree-five polynomial has value and remainder , although the Taylor series still converges to there. Convergence of the infinite expression does not guarantee accuracy from a particular small number of terms. For , even the terms fail to tend to zero, so this power series cannot represent the function. The standard expansions and the conditions for convergent series are discussed in OpenStax, working with Taylor series.
Geometric partial sums converge slowly near their convergence boundary, while a smooth flat function has an identically zero Taylor series
. Details. A stronger caution comes from the flat functionIt is a smooth function with for every , so every Taylor polynomial at zero is zero and its Taylor series converges everywhere to zero. Nevertheless . Off zero, repeated differentiation produces a polynomial in times ; the exponential decay makes each required limit at zero vanish. This explains how all the local coefficients can miss a positive function arbitrarily close to the centre. Real analyticity supplies the additional condition that rules out this behavior.
Uniform order statistic Created 2026-09-28 Updated 2026-10-14
For independent and identically distributed random variables with the continuous uniform distribution on , the th order statistic has Beta distributionIts probability density function, mean, and variance areThe probability density function is zero outside ; values assigned to its endpoints do not change any probability. Peter Kempthorne's MIT lecture notes derive the uniform order statistic law and these moments. [ref]
https://ocw.mit.edu/courses/18-443-statistics-for-applications-spring-2015/06daf6d78e7eb0465d6bb53e8f96b2ff_MIT18_443S15_LEC11.pdf. Peter Kempthorne, MIT 18.443, Lecture 11, slides 12–14
.For , the minimum, sample median, and sample maximum correspond to . Their probability density functions are , , and , respectively. The sample median therefore has Beta distribution , mean , and variance . Its cumulative distribution function isFor instance, . The mean of the minimum is , and the mean of the sample maximum is . The fixed observed sample median in the order statistic example is one possible outcome; is the average over repeated statistical samples from this uniform distribution.
Each curve has area one. The extreme order statistics favor the ends, while the sample median favors the center. The endpoint density height is legitimate: the probability density function gives area per unit length, rather than point probability. In particular, a continuous uniform distribution has zero probability of producing an endpoint.
For a short proof, the binomial distribution counting identity under order statistic gives . Taking its derivative cancels consecutive terms, leaving the displayed probability density function. Recognize its normalizing factorial coefficient as that of the Beta distribution, then substitute , into the Beta distribution mean and variance formulas. Although the original observations are independent, their order statistics generally are dependent; see the positive covariance of two uniform order statistics.
Wilson's theorem 2026-10-14
For an integer , Wilson's theorem characterizes prime numbers by a factorial:The right side is an integer congruence, so the least nonnegative remainder is . For example, certifies that five is a prime number, whereas rules out six. [ref]
For an odd prime number , each nonzero congruence class has a unique modular multiplicative inverse. Pair each class with its inverse: each distinct pair contributes one. A class is its own inverse exactly when ; since , Euclid's lemma leaves only . Their product is . The prime number two needs a separate check: . Conversely, a proper divisor divides both and , so the displayed integer congruence would force , a contradiction. [ref]
The composite numbers have an even sharper pattern: for every composite number , but . To check the zero claim, write with . If , both occur as different factors in the factorial. If , the different factors and both occur since , and their product is divisible by . The only excluded case is . Thus four is an exception to the zero pattern, but still fails Wilson's theorem: its required remainder would be three.
This is an exact primality testing criterion, but direct evaluation is expensive: even reducing modulo after every multiplication still takes a number of multiplications proportional to , which grows exponentially with the number of binary digits of . The problem is not merely storing a huge factorial. The more useful role of Wilson's theorem is simplifying factorial expressions in modular arithmetic. For instance, if is a prime number, then gives by a modular multiplicative inverse.





