The binomial theorem gives . The required binomial coefficients are thereforeHere denotes the coefficient of in the polynomial.
Choose the unordered pair of letters in the second bin; the first bin is then determined. The binomial coefficient givesThe first and second bins are distinguished, so their roles are not interchangeable.
For first-bin size , choose its contents in ways. Each choice arises from permutations, obtained by ordering the two bins internally. The seven ordered size choices giveHere . Each row expresses the same binomial coefficient identity . Even for the bins retain their first/second labels, so the number is twenty rather than ten; the braces denote bin sizes in the question's convention, not interchangeable bins.
Use the generalized binomial theorem with exponent , choosing the analytic branch of a square root that equals at . For ,The signs cancel in each binomial coefficient. For ,The same expression equals for , using the empty-product convention. Consequently the power series isIts coefficients are the normalized central binomial coefficients. As a convergence check, the ratio of successive absolute terms tends to , so the ratio test gives absolute convergence inside the unit disc. Applying the Cauchy coefficient formula to the holomorphic function now immediately yieldsThis value is independent of the chosen radius because the contour integral extracts the same coefficient on every such circle.
In field characteristic , the binomial theorem gives , since the intermediate binomial coefficients are divisible by the prime number . If is a root of , then , and hence
In field characteristic , the binomial theorem gives , since the intermediate binomial coefficients are divisible by the prime number . If is a root of , then , and hence
Represent Pascal's triangle by an infinite outer lazy list, each of whose elements is one finite row. Pad the preceding row with zero on its left and on its right, then add corresponding entries:
pascal :: [[Integer]]
pascal = iterate next [1]
where
-- Padding supplies the two boundary entries as well as the interior sums.
next :: [Integer] -> [Integer]
next row = zipWith (+) (0 : row) (row ++ [0])Here
iterate next [1] begins [[1],[1,1],[1,2,1],[1,3,3,1],...]. Every call to next receives a finite row, so its final zero is reachable. Lazy evaluation produces any requested finite prefix without trying to finish the infinite outer list.Indexing rows and columns from zero, Pascal's rule saysTake out-of-range binomial coefficients to be zero. The seed is the zeroth row, and the padded addition implements this identity at every position, including the two boundaries. Mathematical induction therefore proves every generated row correct. Using unbounded integers prevents overflow. Generating rows zero through takes arithmetic operations, with additional bit costs as the binomial coefficients grow.
There are ordered selections of distinct elements. Every size- subset appears in exactly orders, giving the binomial coefficientFor , both the empty selection and contribute one.
For and , the factorial formula for a binomial coefficient givesThis proves Pascal's identity. The boundary cases follow for using the usual extension for or . The recurrence itself requires .
Apply the factorial formula for the binomial coefficients:For or , the same equality holds with the conventional zero value when the lower index exceeds the upper index.
There are ordered selections without replacement. Each unordered -element subset occurs in exactly orders, so the binomial coefficient isOne precise specification of its domain, codomain, and map isHere , and includes the single empty selection. The actual values on are positive, so is also a valid codomain. For fixed , one can instead use the function with .
In the intended range , division by the positive binomial coefficient givesConsequently the intended remainder isThere is a necessary qualification to the printed unrestricted domain. If binomial coefficients outside are extended by zero, then every satisfies , regardless of . For example, satisfies the literal equality but has . Thus the literal extended-domain premise alone does not determine a remainder; the boxed conclusion requires , or equivalently here .
For , the adjacent binomial coefficients obeySince and , the sign is determined by the numerator:The printed codomain is inconsistent with the displayed map: , and when is odd, . With the usual extension for , is a function , and for ; the positive range above remains unchanged. Without that extension, the natural domain is .[ref]
For adjacent binomial coefficients, the ratiois greater than when , equal to at , and less than afterwards. For odd , the row is therefore increasing up to its two equal central entries and decreasing after them. The maximum is attained exactly atThey are distinct, including when , so is not unique. This is the unimodality of binomial coefficients.
Put ; the other summands in the printed sum vanish. The initial values are and . For , Pascal's identity givesFor the first sum, when is even its final term is zero; otherwise its range already agrees with . In the second sum put , obtaining for . Thus both range identifications hold without negative upper arguments in a binomial coefficient.
Fix , using the convention for binomial coefficients that when . At , both and equal if and otherwise.
For the successor step, apply the induction hypothesis, then Pascal's rule:Thus mathematical induction proves the hockey-stick identityThe zero convention also covers the case , without a separate starting index.
Write and . Partition an -element set into distinguished pairs, and let interchange the two elements of every pair. It induces an involution on the -element subsets. Every nonfixed subset is paired with its distinct image, so nonfixed subsets contribute an even number to the binomial coefficient .
The stated identity has an even right side because is even. Its left side is an odd integer times the integer binomial coefficient . An odd multiplier preserves integer parity, so that coefficient must be even. Equivalently, reducing the identity in modular arithmetic gives
Generate each row of Pascal's triangle from its predecessor, padding at opposite ends before adding corresponding entries:
pascal :: Num a => [[a]]
pascal = iterate next [1]
where
next :: Num a => [a] -> [a]
next row = zipWith (+) (0:row) (row ++ [0])The boundary sums are the old endpoint plus zero, and the interior sums satisfy Pascal's rule. Induction on the iteration number therefore gives the rows of binomial coefficients. The outer lazy list is infinite, with each finite row available on demand. Instantiate
a as Integer for exact arbitrarily large entries; bounded machine integers eventually overflow.First prove for every nonnegative integer by mathematical induction. The case is immediate. If it holds at , the binomial theorem and the stated divisibility of the middle binomial coefficients giveThis establishes the induction. For an arbitrary integer , take a nonnegative representative of its residue class; then . When , part (b) supplies a multiplicative inverse modulo . Multiplying the congruence by that inverse proves Fermat's little theorem: