Series truncation error 2026-10-14
For a convergent series with sum , the error from keeping only the first terms is the remaining sum . This truncation error exists even with exact arithmetic. The zeta series truncation error gives explicit bounds for positive reciprocal-power terms.
Set partition Created 2026-09-24 Updated 2026-10-13
A set partition of a finite set is a set of nonempty subsets, called blocks of a set partition, withThus every set element of belongs to exactly one block of a set partition. This is the finite counting version of a partition of a set. The blocks of a set partition are unlabelled: their subscripts help describe them, but give them no roles or order. Stanley uses this definition in his classification of counting problems.[ref]
Enumerative Combinatorics, Volume 1 (second-edition draft) by Richard Stanley. section 1.9: set partitions and their blocks
All possibilities for three elements. The set has exactly five set partitions:For two blocks of a set partition, one must have size two and the other size one; the three choices of the lone element give the middle row. One block of a set partition forces the whole set, and three blocks of a set partition force three singleton sets. This proves the enumeration complete, with counts by number of blocks of a set partition. Their sum is the Bell number .
Exact enumeration of the five set partitions of : outlines show blocks of a set partition, whose positions and colours carry no labels
. Details. What information is kept? Exchanging the two blocks of a set partition in leaves the same set partition; writing the tuple instead makes an ordered list, different from . Exchanging elements within a block of a set partition also changes nothing. In contrast, is a different set partition, because the actual memberships differ. Both have the same integer partition of sizes. An integer partition, or its Ferrers diagram, forgets which distinct objects were grouped together.
For four named people, and therefore describe different ways of making two unnamed teams, although both have sizes . If every team must have exactly two people, only three set partitions qualify; if any nonempty team sizes are permitted, the Stirling number of the second kind counts them. Naming the teams changes the counting problem again.
A set partition is useful whenever membership matters but category names do not. Define when and belong to the same block of a set partition. This is an equivalence relation, and its equivalence classes recover the set partition. Conversely, an equivalence relation supplies its set partition of equivalence classes. The beautiful simplification is that one grouping can be described by whole subsets or by a rule comparing two elements. Additional distinctions are organized by refinement of a set partition.
The empty set has one set partition, the empty collection , with zero blocks of a set partition. This differs from , which is forbidden because its proposed block of a set partition is empty.
Shapley value axioms Created 2026-10-25 Updated 2026-10-31
Cooperative-game efficiency, cooperative-game symmetry, the null player axiom and cooperative-game additivity characterize the Shapley value. The ordering-average definition satisfies all four: marginal totals telescope, relabelling players preserves the ordering average, zero marginals average to zero and marginal contributions add pointwise. The original work gives an equivalent axiomatization combining some of these requirements.[ref]
A Value for N-Person Games by Lloyd Shapley (RAND paper). RAND P-295, 1952, abstract: a value deduced from three axioms
For uniqueness, write for the unanimity game of a nonempty coalition . Recursively define in increasing order of . Then , so . Apply the axioms to every scaled unanimity game . Players outside receive zero; cooperative-game symmetry and cooperative-game efficiency give each player inside the amount . Every game is a finite sum of such scaled unanimity games, and cooperative-game additivity therefore determines every allocation uniquely. Applying the axioms directly to the scaled games avoids assuming real homogeneity from additivity alone.
Shared face flux cancellation 2026-10-14
Sliding-window algorithm 2026-10-20
An algorithm that maintains information about a contiguous part of a sequence while moving its endpoints. Updating a fixed-length window sum needs subtraction of the outgoing term and addition of the incoming term. A window product can be updated by division only when the outgoing factor is nonzero; zero counts or zero-free segments handle that exception.
Special sum set Created 2026-10-20 Updated 2026-10-25
A finite set of positive integers such that nonempty disjoint sets contained in have different sums, and the larger subset has the larger sum when their sizes differ. For , the size condition is equivalent to for : the left side is the smallest possible sum of elements and the right side the largest sum of elements.
Square pyramidal number Created 2026-10-20 Updated 2026-10-31
The sum of squares of the first positive integers: . It counts a square-based stack with layers containing objects. Differences give sums over consecutive squares.
The number of objects in a square-based pyramid with successive square layers of sizes . If , direct algebra gives and . Mathematical induction therefore proves the displayed summation formula. Its leading term is , so this sum grows cubically, even though its largest individual summand grows quadratically.
Stars and bars (combinatorics) 2026-10-13
Stars and bars counts tuples of nonnegative integers with a prescribed sum. For integers and , its statement isSuch a tuple is a weak composition of an integer. Think of labelled bins: counts identical objects in the first bin, in the second, and so on. Bin names distinguish positions even when counts agree. Stars and bars counts these count tuples; assigning individually distinct objects requires additional information. [ref]
https://math.mit.edu/~fgotti/docs/Courses/C.%20Combinatorial%20Analysis/6.%20Compositions/Compositions.pdf. Felix Gotti, MIT 18.211, Lecture 6: Compositions, Proposition 1 and Example 3
Computed example. With and , the number of weak compositions of an integer is . The string
••|•|•• encodes : two dots before the first bar, one between the bars, and two after the second. For a fixed first-bin count , the second-bin count can be any integer from to and the third is forced. Thus the direct count is .Stars and bars for five identical objects and three labelled bins: ordinary splits, adjacent bars, and bars at either end
. Details. Adjacent bars encode an empty middle bin:
••||••• gives . A bar at the left end encodes an empty first bin, as in |••|••• for ; a bar at the right end encodes an empty third bin, as in ••|•••| for . These are valid weak compositions of an integer. For every count is zero, and for the unique tuple is , consistent with .Proof outline. Replace each count by that many dots and separate successive groups with bars. Reading the group sizes reverses this construction, so it is a bijection between weak compositions of an integer and strings of dots and bars. Choose the bar positions among positions; the binomial coefficient counts the choices. The beauty is that empty bins need no separate cases: end bars and adjacent bars encode them automatically.
If every bin must be nonempty, the tuples are compositions of an integer, and their count is for ; for there are none. Subtract one from every count, setting . This is a bijection to weak compositions of an integer of , so stars and bars gives . For five objects and three bins, this is , with the six positive tuplesFor instance, shifts to , whose sum is . Sorting the six positive tuples collapses them to just two integer partitions, and . Thus named bins and unordered summands answer different questions.
Stars and bars is useful for allocating identical resources or enumerating integer solutions without listing them individually. Prescribed lower bounds can be subtracted just like the nonempty-bin requirement. Upper bounds require removing forbidden tuples; the existing bounded weak compositions article applies the inclusion-exclusion principle to those violations.
Step cost 2026-10-25
A step cost is the cost of one action or transition in a search problem. The accumulated path cost is the sum of the step costs along its action history. A uniform positive lower bound on step costs makes every bounded-cost action history have bounded search depth; positivity of each individual term alone does not establish such a bound.
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
Summation loop verification Created 2026-10-18 Updated 2026-10-31
Compute , the triangular number , for a nonnegative integer . The empty sum gives zero when . Use exact mathematical integers and keep the input unchanged; every comparison and variable assignment is a terminating operation. The original sequential procedure isThe order of the two variable assignments matters: the addition uses the newly incremented . For , the pairs at successive condition checks are . At the last check, is false, and the returned sum is .
require n is an integer and n >= 0
i = 0
s = 0
while i < n:
i = i + 1
s = s + i
return sThe precondition is with , under the exact-arithmetic model just stated. The postcondition for returned value is , with still equal to its starting value. At each condition check use the loop invariantand the loop variant . The equation says that the accumulator is the triangular number for precisely the processed prefix ; the inequalities connect that prefix to the loop's condition.
The summation loop restores its invariant before each condition check
. Original sequential control flow for the summation loop verification. The blue loop head carries the loop invariant; the orange body increments before adding it to . A false condition leads to the postcondition. The loop variant decreases on the return arrow. All values are mathematical integers and remains unchanged. Details.Initialization gives , so holds, including when . For preservation, let the old values satisfy and . Write and for the values after both variable assignments. Since are integers, gives , andThus the completed body restores . Between the two variable assignments, the equation can be false; the loop invariant is required at the loop head. This preservation step is mathematical induction on the number of completed iterations.
At exit, the false condition gives , while gives . Hence , so : this proves partial correctness. For algorithm termination, gives the nonnegative integer . When the condition is true, ; the terminating body gives . Therefore the loop cannot repeat forever. Together these arguments prove total correctness for every permitted input, including .
Two changes expose what the proof checks. Swapping the two body instructions computes , returning rather than for . Leaving unchanged can preserve an initial equation forever without producing any answer. The first change breaks the intended postcondition; the second breaks algorithm termination. A trace can reveal these failures, while the two proof obligations explain them.
The exact-arithmetic assumption has a concrete boundary. In a stipulated unsigned eight-bit model where each addition wraps modulo , fits in the input representation, but its intended triangular number is . The stored accumulator instead finishes at , so the mathematical postcondition fails. This is integer overflow, and the proof above does not apply to that altered model. Restricting the same implementation to prevents overflow in its stored loop values, since ; alternatively use a representation supporting the required exact integer arithmetic. The equations in the proof are mathematical statements, not instructions to evaluate products in eight bits.
Sum of an eventually periodic sequence 2026-10-20
Suppose a numerical sequence has period from index , and let . For with , split the required sum into complete periods and a tail of length . Every complete period contributes , proving the formula in the title. Precomputed prefix sums of one period make the tail lookup constant time. If this periodic sequence consists of the first differences of another sequence, the same formula extrapolates that original sequence by adding the initial value at .
Sum-of-divisors function Created 2026-10-03 Updated 2026-10-20
The sum-of-divisors function adds all positive integer divisors of a positive integer, including the number itself:It is the divisor sum of the identity arithmetic function , so under Dirichlet convolution. Both factors are multiplicative functions, hence so is the sum-of-divisors function. The notation distinguishes it from other weighted divisor sums. [ref]
https://darijgrinberg.gitlab.io/floor.pdf. Darij Grinberg, MIT 18.781 notes, Definition 2.1.2 and Proposition 2.2.2(e)
For a prime number and a nonnegative exponent , the positive integer divisors of the prime power are precisely . Their finite geometric series givesFor example, . For a prime factorization with distinct prime numbers and positive exponents , multiplicativity givesFor , this is an empty product, equal to . [ref]
https://darijgrinberg.gitlab.io/floor.pdf. Darij Grinberg, MIT 18.781 notes, Theorem 2.1.8 with k equal to one
The distributive property makes the formula especially beautiful: choosing one term from each factor produces each positive integer divisor exactly once, by the fundamental theorem of arithmetic. For , the choices form a three-by-two grid with entries , where and . Adding its rows givesThe divisor function counts six cells; the sum-of-divisors function adds their six values. Once the prime factorization is known, the product formula avoids testing every candidate integer divisor. Shared prime factors require care: , so the sum-of-divisors function is not a completely multiplicative function.
The sum-of-divisors function for : each grid entry is a positive integer divisor, and the weighted total is
. Details. Subtracting the number itself gives the proper-divisor sum . Comparing with distinguishes perfect numbers, deficient numbers, and abundant numbers. For , ; for , . Both are perfect numbers. The calculation makes a deficient number, while makes an abundant number. These comparisons turn the sizes of integer divisors into a classification of positive integers. [ref]
The proper-divisor sum for : perfect numbers lie on , deficient numbers below it, and abundant numbers above it
. Details. This connection is ancient: Euclid's Elements, Book IX, Proposition 36, constructs a perfect number by multiplying the last term of by their sum, when that sum is a prime number. In modern notation, put and , with and a prime number. The sum-of-divisors function proves the construction immediately:Consequently the proper-divisor sum is . Taking produces the perfect numbers . [ref]
Book IX, Proposition 36. Euclid, Elements IX.36, translated text and commentary by David Joyce
Symmetry of divided differences 2026-10-18
A divided difference depends on the chosen interpolation nodes and their data, but is unchanged by any permutation of those same interpolation nodes. The explicit sum in divided difference makes this visible: a permutation merely rearranges its summands.[ref]
There is also a short explanation using Lagrange cardinal polynomials. The coefficient of in the th Lagrange cardinal polynomial is . Taking that coefficient in their weighted sum gives exactly the explicit divided difference formula. Since polynomial interpolation has a unique answer for a fixed set of distinct interpolation nodes, this coefficient cannot depend on their ordering. If the interpolation polynomial has polynomial degree below , the coefficient is zero.
For the four-point example in divided difference table, every ordering gives third divided difference . This does not make every Newton polynomial coefficient invariant: whereas , because these use different pairs of interpolation nodes. Even at second order, and use different triples. The node order in Newton interpolation determines which subsets occur along the top row.
Tail of a telescoping reciprocal series 2026-10-14
For the telescoping series , the remainder after the first terms is exactlyThus , , and . This supplies an exact stopping rule: to make the absolute error at most , 999 terms suffice. Requiring strictly less than instead needs at least 1000 terms.
The next term, , is smaller than the full remaining sum by a factor of . For example, after 99 terms the next term is , while the remainder is . The term test for divergence concerns individual terms; a reliable numerical approximation needs a bound on the whole remaining sum.
Tail-sum formula Created 2026-09-24 Updated 2026-10-18
The tail-sum formula expresses an expected value as the area under a survival function. For every nonnegative random variable ,This Lebesgue integral and the expected value may both be ; a probability density function is unnecessary. For a random variable taking values in the nonnegative integers, the corresponding sum isThe events and coincide because takes integer values. Thus the strict sum starts at zero, while the inclusive sum starts at one.[ref]
Random: Probability, Mathematical Statistics, Stochastic Processes by Kyle Siegrist. Expected Value, §2 Additional Properties, Right Distribution Function: nonnegative tail integral and integer-valued tail sums
For an original example, let the probability mass function of beIts expected value computed directly is . The strict tail probabilities at thresholds are : their sum is again . There is no probability mass at two, yet the event still has probability . The survival function has heights on the successive intervals ; each interval has length one, so its integral is the same sum.
The same expected value from probability masses and survival columns
. The exact constructed probability mass function assigns to . The contribution appears in one survival column, while the contribution appears in three. Filled endpoints give the strict survival function at its jumps; open endpoints show the preceding height. The shaded area is . Details.The indexing matters numerically. Starting the inclusive sum at zero adds , giving for this example. Starting the strict sum at one omits , giving . For a general nonnegative random variable, replacing with inside the integral is harmless: the difference is , nonzero at only a countable set of thresholds. For each positive integer , at most thresholds can have probability mass at least ; their countable union contains all thresholds with positive probability mass and has Lebesgue measure zero. This reasoning concerns an integral, not equality of the two survival function conventions at every point.
For a continuous original example, take the uniform distribution on the interval . Its survival function is for and zero for . The area is a triangle of base four and height one:Directly integrating against the probability density function gives the same expected value, . The integral of the probability density function alone is one; it is the survival function whose area is the expected value.
The proof counts layers of each outcome. For a realized value , the indicator function equals one over an interval of length , soTonelli theorem permits the interchange because the indicator function is nonnegative; no finite expected value is assumed. Similarly, an outcome contributes one indicator random variable for each of the events that occur:Again Tonelli theorem applies to the nonnegative sum, or equivalently the monotone convergence theorem applies to its partial sums. This exchanges counting layers within each outcome with averaging across outcomes. The existing integer-valued hypothesis in the tail-sum formula explains what changes when the values are not integers; the tail integral formula for moments weights the layers to obtain higher moments.
For an integrable random variable that can have either sign, apply the nonnegative formula separately to its positive part and negative part :Integrability makes both integrals finite. More generally the difference defines an extended expected value when at least one is finite; if both are infinite, subtraction does not define an expected value.[ref]
Random: Probability, Mathematical Statistics, Stochastic Processes by Kyle Siegrist. Expected Value, §2 Additional Properties, A General Definition: positive and negative parts and the condition on their expectations
Tail probabilities are often easier to measure or bound than a whole probability density function. For a device's survival time, the survival function records the probability of still operating at each threshold; its integral gives the mean operating time. A finite observation window naturally gives the expected value of a capped nonnegative random variable. For a mathematical bound, for all implies . The tail-sum formula turns control of a whole family of events into control of an average.
Telescoping sum Created 2026-10-14 Updated 2026-10-20
A telescoping sum cancels intermediate sequence terms, leaving boundary terms. For a finite sequence of real numbers , the displayed identity follows because every occurs once with each sign. Applying it to an infinite series also requires checking the limit of the boundary terms; finite cancellation alone does not prove that the series is a convergent series.[ref]
5.2 Infinite Series. Calculus Volume 2, §5.2 Infinite Series: Telescoping Series definition and successive partial-sum identities
For , expanding the finite sum givesNo monotone sequence assumption is required. Consider the original sequence . Its successive finite differences are , soThe large intermediate rise and fall disappear from the net change. This is useful whenever one knows successive changes rather than every absolute value: adding the changes reconstructs the final value from the initial one. It also checks a cumulative-update calculation without requiring all increments to be positive.
Opposite signs cancel the intermediate sequence terms, leaving the final value minus the initial value
. Original nonmonotone sequence . Linked green entries have the same magnitude and opposite signs; the unmatched entries are and . The increments are , whose sum is one. Details.A finite difference measures one discrete change. The identity is the discrete counterpart of the fundamental theorem of calculus: accumulation of changes returns the endpoint difference. The related summation by parts transfers a finite difference from one factor of a product to another, with explicit boundary terms.
Total correctness 2026-10-18
Total correctness requires partial correctness and algorithm termination for every program state allowed by the precondition. For a deterministic sequential program, every permitted start must reach a final program state satisfying the postcondition after finitely many steps. Thus an infinite execution can satisfy partial correctness, but refutes total correctness for a permitted start.
In the summation loop verification, the loop invariant establishes the answer conditional on exit, and the loop variant establishes exit. Both parts matter: replacing the body by a step that never returns would defeat total correctness even if every completed iteration preserved the loop invariant. Likewise, a terminating loop with the wrong sum fails partial correctness and therefore fails total correctness.
These obligations depend on the formal specification. A program that rejects every input might correctly implement a rejection service, but does not meet a contract promising a sum for every nonnegative integer. A proof of total correctness also gives no particular physical response-time guarantee: time complexity and the execution environment require their own assumptions.
Triangular number Created 2026-10-14 Updated 2026-10-20
A triangular number counts rows of objects, with a nonnegative integer:The first values are . The empty arrangement contributes zero, by the empty sum convention. Adding one more row gives the triangular number recurrence for . The row lengths form an arithmetic progression, while their running totals are triangular numbers.
Pair the rows with a reversed copy: . There are such pairs, so two copies contain dots. Dividing by two proves the formula. This rectangle picture explains the factor one-half without requiring a formula for a long summation. For example, one hundred rows contain dots.
The same count appears whenever every pair of different objects must be considered once. Five participants make ten possible handshakes; five sensors have ten different pairwise comparisons; a complete graph on five vertices has ten edges. These are the triangular number pair-counting identity, with one fewer row than objects. The distinction prevents a common error: counts all pairs from six objects, whereas five objects give .
The triangular number square-complement identity says that two neighboring triangular numbers fill a square. Combining that identity with the one-row difference makes the difference of squares equal to . It leads to Nicomachus's theorem: the sum of the first cubes of numbers is the square of a number . A change in the way one groups objects exposes a relation between summation, multiplication and geometry.
This geometric view is already visible in Nicomachus's Introduction to Arithmetic by Nicomachus (Hahn teacher edition): Book II, Chapter 8 describes growing triangular rows, Chapter 12 combines successive triangular counts into squares, and Chapter 20 groups successive odd integers into cubes of numbers.[ref]
Introduction to Arithmetic by Nicomachus (Hahn teacher edition). Book II, Chapters 8, 12 and 20, printed pp. 63–64, 70 and 75
The linked edition uses Martin Luther D'Ooge's translation, revised with modern teaching material by Nathanael Hahn. Our empty-row index is a modern convention; the historical passage starts from unity and calls three the first actual triangle. Ultrametric inequality Created 2026-09-24 Updated 2026-10-14
The ultrametric inequality, also called the strong triangle inequality, bounds a direct distance by the larger of the two distances through an intermediate point:A metric space satisfying this rule is an ultrametric space. For a Non-Archimedean absolute value, the corresponding inequality is , and the associated metric is . The ordinary triangle inequality follows because the maximum of two nonnegative real numbers is at most their sum.
For example, the 2-adic absolute value gives the three points distancesEach distance is bounded by the maximum of the other two. The two largest distances are equal: every triangle in an ultrametric space has this property. Otherwise its unique longest side would exceed the maximum of the other two, contradicting the ultrametric inequality. The drawn lengths of a triangle on paper need not represent these distances.
The ultrametric inequality gives a useful exact rule when :To see why, suppose . The upper bound is ; applying the ultrametric inequality to forces the reverse bound. Equal sizes can instead cancel: , but . This makes a uniquely largest term decisive in a sum, a principle used in the Newton polygon and in arguments about roots of a polynomial.












