Factorial Created 2026-09-24 Updated 2026-10-13
For a nonnegative integer , the factorial is the product of the positive integers from to , with the empty product equal to :
Thus , , , and . The factorial counts the permutations of distinct objects: arranging gives exactly . The choice tree in permutation shows the three choices for the first position, two for the second, and one for the last.
The value has a counting explanation: the empty set has exactly one ordering, the empty list. Equivalently, it has exactly one bijection to itself, the empty function. There are no choices to make, and one completed outcome. The factorial therefore obeys the recurrence relation
The useful distinction is how many positions are filled. For integers , choosing and ordering distinct objects by sampling without replacement gives the falling factorial, while choosing an unordered -element subset gives the binomial coefficient:
For five people, assigning captain and deputy gives outcomes; choosing a two-person team gives . Every team has exactly assignments of the two roles, explaining the division. When , both counts are one. The factorial is useful here because one count of full orderings yields both formulas by cancellation and by forgetting order. [ref]
Distinctness matters. If the two copies of in are indistinguishable, the visible arrangements are just , numbering . Temporarily labelling them gives six permutations, but exchanging the two labels leaves each visible word unchanged, so every word was counted times.
Proof outline. For , choose the first object in ways, then order the remaining objects in ways. The rule of product gives the recurrence relation; repeated application gives the displayed product, starting from the one empty ordering. This explains why the factorial grows quickly: every additional distinct object introduces another multiplicative factor.
For a real pair of indicial roots at a regular singular point of a second-order linear differential equation, the second local solution is classified by the gap and by the recurrence relation for the smaller indicial root. Case I has and two pure Frobenius solutions. Case II has and an independent Logarithmic Frobenius solution. With a positive integer gap, Case IIIa means the exceptional coefficient equation is inconsistent, so a nonzero multiple of the first Frobenius solution times a logarithm is necessary. Case IIIb means that equation is consistent and leaves a free coefficient, so there are two pure Frobenius solutions. This IIIa/IIIb convention is the one used in the Oxford course notes.[ref]
The free coefficient in Case IIIb adds a multiple of the first Frobenius solution, as explained by the undetermined coefficient at Frobenius resonance. Stating whether the logarithm occurs is useful alongside the case name because other courses may choose different labels.
For , , and a positive integer , consider near . Its indicial roots are . The first Frobenius solution, normalized to leading coefficient one, is , with . If is a positive integer, a second pure Frobenius solution with leading coefficient one would require
Before , induction makes for indices not divisible by . If divides , the coefficient is nonzero, and the exceptional equation is impossible. If does not divide , the right-hand side is zero and is free. Thus, in the Frobenius case classification, a positive integer gap gives Case IIIa exactly when divides , and Case IIIb otherwise.
The coefficient of the necessary logarithm can also be calculated. Let . The product rule gives . Therefore a second solution , with , has
For the preceding recurrence relation gives , so
This proves that the logarithm cannot disappear for a special nonzero value of . For , reduction of order instead produces the repeated-root Logarithmic Frobenius solution directly.
A Frobenius solution has the repeated indicial root . Equating coefficients gives the displayed recurrence relation. The resulting analytic solution is an entire function: its consecutive term ratio has magnitude asymptotic to . For an integer, the recurrence terminates and . The second local solution is independent and has a logarithmic term at zero; repeated indicial roots do not supply two independent analytic series.
Gamma function Created 2026-09-24 Updated 2026-10-20
The Gamma function extends factorials to a continuous argument. Its defining Gamma integral is
where uses the real natural logarithm for . The Gamma function recurrence gives its meromorphic continuation to the complex plane, with simple poles at and no zeros. See Gamma function residue at a nonpositive integer and Gamma function has no zeros for proof outlines.[ref]
For nonnegative integers , the factorial identity has a shift of one:
Thus for positive integers . Half-integer arguments supply a different familiar constant:
The first value follows from the Gaussian integral; the second follows from the Gamma function recurrence.[ref]
Figure 1.
The Gamma function on the positive real axis passes through the factorial values 0! through 5! at arguments 1 through 6
. Details.
The plot shows only positive real arguments; the gamma function also accepts complex numbers away from its poles. Matching the factorials alone does not select a unique interpolation, even if the Gamma function recurrence is imposed: has the same positive-integer values and the same recurrence relation. The Bohr-Mollerup theorem supplies the extra condition that selects the gamma function.
The useful idea is to replace a discrete product of numbers by an integral whose exponent varies continuously. The Gamma integral then evaluates whole families of integrals at once, provides the normalizing constant for the Gamma distribution in probability theory, and appears in physics, for example in the Bose integral. Its large-positive-argument growth reconnects this continuous description to factorials through Stirling's formula.[ref]
Historically, Leonhard Euler studied the interpolation of factorials in his paper E19, written in 1729 and published in 1738. His integral over becomes the Gamma integral after a change of variables, with the same one-step shift in the argument.[ref]
Gamma function recurrence Created 2026-09-24 Updated 2026-10-14
The Gamma function obeys the recurrence relation
Initially, for , integration by parts in the Gamma integral gives the short proof
The boundary term vanishes at zero because , and at infinity because of exponential decay. Together with , the Gamma function recurrence immediately gives for every nonnegative integer .[ref]
Read backwards, the Gamma function recurrence defines
where is a positive integer. These overlapping formulas agree by the Gamma function recurrence, giving the meromorphic continuation. Since , they give a simple pole at zero and then at every negative integer; Gamma function residue at a nonpositive integer records the residues. The recurrence relation therefore holds throughout the continuation as an identity of meromorphic functions.
Gaussian binomial coefficient recurrence Created 2026-10-14 Updated 2026-10-20
For and , the displayed recurrence relation uses and when or . At it becomes Pascal's identity.
An exact weighted-subset formula is
The exponent measures how far the selected positions lie beyond the earliest possible choices . Split the subsets according to whether they contain . Those without it give ; deleting it from those with it removes exactly from their exponent. This gives the displayed recurrence relation, explaining why it builds polynomials with nonnegative integer coefficients.
Generating function Created 2026-10-07 Updated 2026-10-14
A generating function packages a sequence into a series so that operations on objects become operations on their encodings. An ordinary generating function uses the power series ; in counting problems, the coefficient records the number of objects of size . The variable initially marks size: it need not be assigned a numerical value. Coefficient extraction writes this recovery as . One compact expression can therefore answer infinitely many counting questions, while explaining how their answers fit together.
Start with two contributions: choose from and from , with exactly one option at each allowed value. Their individual ordinary generating functions are the polynomials and . To count ordered pairs by total , multiply:
The coefficients count the ways to obtain totals zero through three. For total two, the possibilities are and ; the two corresponding monomials both contribute . There are six ordered pairs altogether, agreeing with .
Figure 1.
Polynomial multiplication groups six ordered choices by their total contribution
. Details.
If the first contribution has two distinguishable choices when , replace by . Its product with becomes . The coefficients now carry multiplicities as well as possible totals; the exponent still records cost. This lets the same construction handle several actions with identical costs without losing their separate identities.
In general, the Cauchy product gives
For each split of the total size, the rule of product counts the choices of the two components; summing over those splits counts all possibilities. This requires each combined object to have a unique decomposition into the two components. The same idea works for costs, lengths, or other additive measures, not just the number of pieces. See MIT 18.310, generating functions, sections 1–2.
Now cover a board of length with tiles of lengths one and two, without gaps or overlaps. Let count these tilings. There is exactly one empty tiling, so , and . Removing the first tile leaves a board shorter by one or two, giving the recurrence relation
These are the Fibonacci numbers shifted by one index: under the convention , . Keeping the empty tiling is essential to both the counting rule and the resulting ordinary generating function.
Figure 2.
Length-one and length-two tiles give five coverings of a length-four board and the Fibonacci recurrence
. Details.
For , the empty board or a first tile followed by a remaining tiling gives
Equivalently, : each factor chooses one tile, and counts pieces while the exponent of records total length. The same ordinary generating function counts ordered histories of two repeatable actions costing one and two units. Histories and differ despite having the same total cost. MIT's notes use dots and dashes with these costs, including the empty message. [ref]
These identities hold in formal power series algebra: each requested coefficient uses only finitely many contributions. The repeated-choice expansion is legitimate because has zero constant term; a zero-cost repeatable action would allow infinitely many histories of the same size. Numerical evaluation separately requires a convergent series. Here the radius of convergence is , the reciprocal of the golden ratio. At , the rational function equals , but the counting series diverges: that value cannot represent its sum.
Other generating functions change the encoding: an exponential generating function divides by factorials, while a Dirichlet series uses . A counting generating function also differs from a probability generating function, whose coefficients must be nonnegative and sum to one.
Global convergence of a square-root iteration Created 2026-10-18 Updated 2026-10-31
For every , this recurrence relation converges to the unique nonnegative fixed point . If , then , since . If , then . Thus the iterates form a monotone bounded sequence, and continuity forces their limit to be . A cobweb plot alternates vertical steps to and horizontal steps to , approaching the same intersection from either side. More quantitatively,
so the error keeps its sign and decreases in absolute value by at least the uniform factor . The asymptotic factor is .
Leonhard Euler's 1751 correspondence already studied triangulations of a convex polygon and gave a closed formula for their counts. Johann Andreas von Segner supplied a combinatorial recurrence relation in a paper written in 1758. Eugène Charles Catalan's nineteenth-century work connected the formula to bracketed products. This history, documented in Igor Pak's account, shows how the same counting structure reappeared through different objects; the modern name alone does not establish discovery priority.[ref]
For the two sequences in bounded monotone sequence theorem,
Their directions and bounds are explicit. One is a succession of lower approximations and the other a succession of upper approximations to the same limit of a sequence. To obtain absolute error strictly below , it suffices to choose an integer , and then every works. For , the first such index is ; at the absolute error equals the tolerance.
A geometric sequence offers a faster example. The recurrence relation , gives . Thus is an increasing bounded sequence with limit of a sequence one and absolute error . For , already works, since , whereas . The bounded monotone sequence theorem guarantees both examples converge; the formulas explain their different speeds.
Kadane's algorithm Created 2026-10-20 Updated 2026-10-24
For input , let be the largest sum of a nonempty contiguous block ending at . The recurrence relation and is exact: an optimal block either starts at or extends an optimal block ending at . The answer is . Keeping only the current and best value gives linear time complexity and constant extra space complexity.
Count a fixed-base digit addition, subtraction, digit copy, or single-digit multiplication as constant cost. Base stays fixed as grows; an entire arbitrary-length integer multiplication is not one constant-cost step. With this model, splitting, sum formation, shifts and recombination require digit operations. Ordinary digit-by-digit multiplication forms digit products for two -position operands. The GMP base-case description uses this rectangular product arrangement.[ref]
The ideal equal-half recurrence relation is
For , level has calls of size . If each internal call incurs exactly times its size in additional digit work, that level contributes . There are leaves. The geometric series of internal work is
Thus fixed positive leaf cost plus this internal work grows on the order of . In Big O notation, . Removing one of four products at every level matters much more than saving just one at the root.
Figure 1.
Karatsuba recursion levels and an explicitly stipulated cost comparison
. Left: the ideal equal-half recursion for , with three children per internal call. Right: model counts for , one unit per leaf and internal overhead for size with . The resulting count is , compared with ordinary digit products. This illustrates the recurrence relation; its constants and crossover are stipulated, rather than measured execution times. Details.
The literal sum-based implementation instead admits the upper bound
for a nondecreasing worst-case cost envelope above a fixed base-case threshold. The extra digit does not change the exponent: since , subtracting three from the size makes each child's adjusted size at most half its parent's. Stop this comparison at any fixed threshold greater than three; its recursion depth is and the level-work sum is bounded by the same geometric series up to constant factors. Exact call counts can depend on carries, zero shortcuts and the threshold, so they need not equal the ideal at each depth.
Kitamasa algorithm 2026-10-20
The Kitamasa algorithm evaluates a term of an order- linear recurrence by reducing powers of modulo its characteristic polynomial of a linear recurrence. If the recurrence relation is , reduce modulo by exponentiation by squaring; the resulting coefficients give as a linear combination of . Straightforward polynomial multiplication gives arithmetic operations.
Logistic map Created 2026-10-03 Updated 2026-10-14
The logistic map repeatedly applies a quadratic function:
The closed interval is a positively invariant set: . An orbit is the entire resulting sequence , not just one application of the formula. For example, with and , the first states are , approaching the fixed point .
As a simple model of population dynamics, is a scaled abundance in generation . When abundance is small, is close to ; increasing abundance reduces this per-capita multiplier. The falling side of the quadratic function represents sufficiently severe crowding reducing the next generation. The scale is not generally the carrying capacity: the positive fixed point is . The logistic map is a discrete-generation model; the continuous-time logistic growth equation has a different evolution rule and does not produce its period-doubling cascade.
The practical question is how abundance behaves after the initial adjustment: does it settle, alternate, or continue varying? The same formula permits all these possibilities. The following figure shows three orbits, their cobweb plots, and a bifurcation diagram. In a cobweb plot, moving vertically to calculates the next state, and moving horizontally to makes that value the input for the next step.
Figure 1. . All three upper examples start at . At , the orbit approaches a fixed point; at and , it approaches periodic orbits of periods two and four. Filled red marks in the cobweb plots indicate an attracting fixed point, while hollow red marks indicate a repelling one. The lower bifurcation diagram retains 240 orbit states per parameter after discarding 2000 initial steps. Each column samples one orbit, rather than all possible orbits; the highlighted period-three window shows why larger parameters need not mean sensitive attracting motion. Details.
The fixed points solve :
The second fixed point is in for and coincides with zero at . The derivative is , so the fixed-point multipliers are at zero and at . The fixed point stability for an iteration test gives an attracting zero for , and a locally asymptotically stable positive fixed point for . A multiplier of modulus one needs a nonlinear argument; the strict derivative test alone settles neither nor .
This derivative test has a direct interpretation. A small error obeys
At , the leading multiplier is : the error changes sign, explaining the alternating approach, while its magnitude eventually shrinks by approximately a factor per step. At , the multiplier is , and the positive fixed point repels nearby states. However, a different outcome has asymptotic stability: the logistic map two-cycle attracts nearby orbits.
For , the attracting period-two orbit has the two values
At they are approximately and , with and . Their periodic-orbit multiplier is , so a small displacement shrinks over two steps even though the fixed point is unstable. The brief algebraic justification is to factor , remove the fixed point factors, and multiply the two derivatives using the chain rule.
At , the positive fixed-point multiplier passes through and a period-doubling bifurcation creates the period-two orbit. At , its periodic-orbit multiplier passes through and an attracting period-four periodic orbit emerges. At , the period-four values are approximately in that order. Further period-doubling bifurcations accumulate near . Beyond that value there are also parameter windows with attracting periodic orbits, including a period-three window near . Neither a crowded numerical plot nor a parameter beyond the accumulation value proves sensitive dependence on initial conditions on the attracting set.
The endpoint supplies an analytically transparent example. The homeomorphism satisfies
where is the full tent map. Thus these maps have topological conjugacy; stretching and folding in the tent map explain sensitive dependence on initial conditions and Devaney chaos for on . This does not make every individual orbit nonperiodic: stays fixed, and follows . Sensitivity means that these exceptional orbits also have arbitrarily close initial states that eventually depart substantially.
Robert M. May's "Simple mathematical models with very complicated dynamics" (1976), Nature 261, pp. 459–467, reviewed how simple deterministic recurrence relations can pass from stable abundances through period-doubling cascades to irregular behaviour. May presented the logistic map as an especially accessible example and discussed the relevance of such models to population dynamics. The paper explicitly describes itself as a review of results found by several researchers, bringing their findings together for a broad scientific audience.[ref]
Longest increasing subsequence Created 2026-09-28 Updated 2026-10-14
A longest increasing subsequence is an increasing subsequence of maximum length. Write that length as , with for the empty sequence; a nonempty input has . Several selections can attain the same maximum. Here uses the weak convention ; write for the maximum length of a strictly increasing subsequence. For , these lengths are three and one respectively; for an input with distinct values they agree.
For , the answer is , attained at indices , while . One useful interpretation is the smallest number of deletions needed to make the surviving sequence nondecreasing:
Indeed, keeping a longest increasing subsequence attains this bound, and any valid remaining sequence is an increasing subsequence, so cannot have more than terms. In this example the answer is . This makes a measure of how much order can be recovered without moving any observation.
A table that ends at each position. Let be the maximum length of an increasing subsequence ending specifically at position . The dynamic programming recurrence relation is
The zero covers a selection consisting only of . Otherwise its penultimate index is an eligible ; append to an optimal selection ending there. Fill entries in increasing index order. For strictly increasing subsequences, change the comparison to . The strict version and reconstruction are developed in University of Toronto, CSC373 tutorial 4 solutions (2018), exercise 2; the weak version follows by allowing equality at the append step.
In the worked input, the weak table is and the strict table is . At the second , equality extends the first in the weak table. The final entry is only one, although the optimum is four: the best increasing subsequence need not finish at the last input position. Record a maximizing predecessor whenever . Following these stored indices from any position maximizing , then reversing them, gives an actual longest increasing subsequence. For the weak example the backward chain is .
Figure 1.
Skipping positions and allowing equal values changes the optimum
. An original toy input, not measured data. The colored selection keeps indices and values . The two dynamic programming rows give the best lengths ending at every position; the backward arrows reconstruct the weak longest increasing subsequence. Details.
Scanning all earlier positions for each uses time complexity and space complexity for lengths and predecessors, using Big O notation and assuming constant-time comparisons and operations on indices.
Keep the easiest ending to extend. The faster algorithm maintains a minimum-tail table for increasing subsequences: is the smallest final value of any length- increasing subsequence in the processed prefix. For equal lengths, a smaller ending permits every future extension allowed by a larger ending. Thus only one best ending per length is needed. The table is nondecreasing, since removing the last term of a length- selection gives . Start with an empty table. On reading , use binary search to find the first entry strictly greater than : replace it by , or append if there is no such entry. Its position is one beyond the longest existing length whose ending is at most . See Liben-Nowell, Vee and Zhu, section 3.1 and Figure 1.
Duplicates determine the binary search rule: weak increase replaces the first , whereas strict increase replaces the first . In Python these positions are returned by bisect_right(T, v) and bisect_left(T, v) respectively, counting positions from zero. Replace an entry or append; do not insert and shift the remaining entries. The documented equality rules are in Python documentation, bisect_left and bisect_right. Each search takes comparisons, giving time complexity , conventionally for , and space complexity for the weak length alone.
Figure 2.
Two binary-search tie rules give different minimum-tail tables
. Original exact traces for the same toy input, not measured data. Each cell shows a tail value and the input index supplying it; the outlined cell was updated in that row. At the second , the weak algorithm appends and the strict algorithm replaces. The final weak table has length four, but its supplier indices are not in increasing order. Details.
A length certificate needs separate reconstruction. The final weak tail values are , but they do not form an increasing subsequence of this input: the zero occurs last. Each table entry certifies a selection of its own length; the entries need not come from one compatible selection. To recover a longest increasing subsequence during the fast algorithm, store a supplier index for each tail and a predecessor index for each input position. Before replacing slot , save , or no predecessor if , then set . Later replacements leave saved unchanged. Follow predecessors from the final and reverse. This uses space complexity and returns indices for the weak trace. The same construction works with the strict comparator; compare the two auxiliary arrays in CP Algorithms contributors, restoring the subsequence after binary search.
Deleting or changing one term. If deletes position , then
Deleting cannot create a longer increasing subsequence; removing position from a previously optimal selection loses at most one term. If instead changes just the value at position , both inputs have the same deleted sequence, so their lengths each lie between its length and its length plus one. Consequently . These bounds also hold for strictly increasing subsequences. In the weak example, deleting either lowers the length to three, while deleting the final zero leaves it four. This is a Lipschitz bound for single-term edits, regardless of the numerical size of a replacement. Insertion has the same bound by reversing deletion, so insertions, deletions or replacements can change by at most .
For historical context, [ref] studies the comparison count for distinct elements of a totally ordered set. Its distinctness assumption makes the weak and strict conventions coincide. No distinctness assumption is needed for the comparator-specific algorithms above.
Lucas closed form 2026-10-25
For and , each power sequence satisfies the recurrence relation , because both bases solve . Their sum starts at , so uniqueness of a recursively defined sequence proves that it is the Lucas number sequence. Alternatively, diagonalize the companion matrix and use . The formula explains the exponential growth governed by the golden ratio and the alternating decaying correction .
Let have matrix dimensions , where are positive integers. For , define as the minimum scalar multiplication cost of the contiguous matrix product . The endpoints of an integer interval identify a dynamic programming state. A single matrix needs no matrix multiplication, giving the base case . At the final matrix multiplication, split after :
The two subproducts have matrix dimensions and , regardless of their internal grouping. The recurrence relation adds their optimal costs and the final scalar multiplication cost.[ref]
Why is this optimal substructure? For a chosen final split , replacing either subproduct's grouping by a cheaper one leaves its matrix dimensions and exact matrix product unchanged, so it decreases the whole cost by the same amount. Therefore an optimal grouping can use optimal groupings on both sides. Conversely, each candidate in the recurrence relation joins two achievable groupings. Mathematical induction on , starting with the single-matrix base case, proves that the minimum is achievable and no grouping is cheaper.
There are also overlapping subproblems: while evaluating the different final splits of , the cases and both request the cost of . Recursion without reuse recomputes this answer; memoization or a dynamic programming table stores it once. Fill the table by increasing length , so both dependencies are ready. Record an attaining split alongside each cost.[ref]
The dynamic programming table has cost entries. For length , there are entries and possible splits, so the exact number of candidate evaluations is
Under the unit-cost assumption that arithmetic operations, comparisons and access to stored costs each take constant time, this gives time complexity and space complexity , using Big O notation. These bounds concern choosing a grouping from the matrix dimensions; they exclude the subsequent matrix multiplication work. If the dimensions or costs require arbitrarily long integers, their arithmetic and storage costs must also be counted.
Under constant-cost lookup and integer addition, Memoized Fibonacci evaluation has time complexity in Big O notation, retaining values. A hash table needs its own lookup-cost assumptions; an array indexed by avoids hash collisions in this example. Memoization removes repeated bodies, but also pays for keys, lookups and retained answers. A workload without reuse can pay those costs without saving evaluations.
The call stack remains. Left-first recursion descends through arguments before returning, giving simultaneously active frames for . Therefore the auxiliary space complexity includes frames as well as table entries in the constant-size-value model. An iterative bottom-up dynamic programming calculation removes these recursive frames; retaining only the two previous Fibonacci numbers suffices when only the final value is wanted, but discards the table useful for later requests.
Exact Fibonacci numbers do not remain constant-size values. For , the recurrence relation gives , so the representation of as a binary number has order bits. With ordinary addition costing order bit operations on such operands, the additions cost order bit operations in total. Retaining all values also requires order bits of value storage, before keys and frame overhead. The linear bound counts additions under its stated cost model; it is not a linear bound on exact integer arithmetic in bits.[ref]
The Fibonacci numbers give an exact example. For a nonnegative integer , their recurrence relation is
To obtain by direct recursion, evaluate and separately; computing also evaluates . The full call tree has 15 occurrences but just six distinct arguments, . Shared dependencies form a Directed acyclic graph because every directed edge goes to a strictly smaller argument. Memoization evaluates a distinct argument on first demand; filling values in increasing argument order is the corresponding bottom-up dynamic programming calculation.[ref]
Figure 1.
Repeated calls for Fibonacci numbers and their shared Directed acyclic graph of dependencies
. The call tree contains 15 occurrences for . The dependency graph contains six distinct arguments and eight directed edges. Equal labels have equal colors; arrows in the right panel point from a caller to the value it requires. Details.
Use an initially empty hash table memo, shared by every recursive call. Count even the first evaluations of the two base cases, store only completed results, evaluate the left term first, and retain all entries. The following original procedure assumes a nonnegative integer argument:
def cached_fib(n, memo):
    if n in memo:
        return memo[n]
    if n < 2:
        value = n
    else:
        value = cached_fib(n - 1, memo) + cached_fib(n - 2, memo)
    memo[n] = value
    return value
Every self-call must pass through the memoization lookup. Wrapping only the outer call while leaving inner calls uncached retains the repeated work. Test membership rather than whether the stored value is nonzero: is a valid completed result.
For cold , the lookup arguments are . The first six are absent; the last three reuse completed answers. Results are stored on return in argument order , with values . Thus there are nine wrapper calls, six body evaluations and four additions. Repeating with the same table takes one wrapper call and no body evaluation. Requesting next evaluates only its body, reuses and , and stores : three wrapper calls, one body evaluation and two hits.
Figure 2.
An exact memoization lookup trace and the effect of retaining or clearing its table
. The first row records cold lookup order. The table records successive requests with one retained table; clearing it before the final request restores the cold counts. Calls include lookups that immediately return stored values; bodies count only first evaluations. Details.
The direct-call count satisfies and . Its exact solution is , as substitution into this recurrence relation verifies. With the specified memoization procedure, a cold call at evaluates distinct bodies, makes additions and makes wrapper calls. There are hits: each of the nonbase bodies issues two recursive calls, in addition to the initial call. The difference is between the number of occurrences and the number of distinct subproblems.