Volume C1 · Basic concepts · TAOCP Section 1.2.11.1
The O-notation
Draft. This chapter is written and checked by the tools of the project, and a person has not reviewed it yet. Read it with care.
Read it next to Section 1.2.11.1 of the book. The nodes and the exercises of the section.
Contents
The O-notation
Overview
Section 1.2.11.1 of TAOCP introduces the symbol . It stands for an unnamed quantity whose size is at most a fixed multiple of once is large. With it, an approximation carries its own error bound: the formula replaces the sign by the sign and says how good the approximation is. The section fixes the meaning of the symbol and states the rules for sums, products and nested uses. It uses for functions of a complex variable near and lists the main power series with their error terms. It shows that an asymptotic formula can be right even when the series behind it diverges (the factorial powers and for real , expanded in powers of ). A worked case, the quantity , ties the rules together. The section ends with the symbols and .
The ideas
names a set of functions. The symbol is the set of all functions with for some constant and all . An equation says . This is why the equation is a one-way equation: is true and is false.
The constants are hidden, and they are fixed. The constants and may differ at each use of the symbol. They may not depend on . This is the source of most errors. A sum of terms that are each is not by this argument, since the constants of the terms need not stay bounded (exercise 1.2.11.1-6).
The rules are the rules of set algebra. Eqs. (5) to (10) say that a function lies in its own set, that constants, sums, products and nested sets stay in the set. Each proof takes one line.
A convergent power series gives its error term free. If converges at one point , then the tail after is near (eqs. (11) to (15)).
An asymptotic series need not converge. For real the factorial powers and have expansions in powers of , with Stirling numbers of a real argument as coefficients. Each truncation is correct with an error of the next order, yet the full series can diverge, for example for . The notation speaks of one truncation at a time, so it fits.
and close the gap. People read as " has the order of ", but may be much smaller. is the lower bound, and gives both bounds.
C1 follows the order of the section. It proves each of the 21 equations and the two definitions. It adds the small facts that the proofs need: a polynomial is of its top power, the Stirling numbers have polynomial extensions, and the ratio of two gamma values has an expansion in powers of . Each result has a number check.
Definitions, results and proofs
Definition C1.1.2.11.1.1 (the symbol , TAOCP Section 1.2.11.1). Let be a real or complex function on the positive integers. A function belongs to the set when two positive numbers and exist such that
A formula that contains symbols and ordinary functions stands for a set of functions, formed by the operations of the formula (see the next definition). An equation between two such formulas means that each function of the set is also in the set . If is one ordinary function , then means .
Node: TAEGH4HAH4 · Lean: TAOCP.BigOWith · status: not stated yet
Explanation. The definition has three parts. The constant says that the bound is about large only, so the first few values of do not matter. The constant says that the ratio stays below a number. The formula is the set of all functions with . The sign is read as , since the symbol hides a different function at each use. Both sides of are sets, and the left set is inside the right set. The sets are not equal, so the reverse equation is false. The convention keeps the familiar chain from left to right, and each step is true by itself.
In Lean the definition is TAOCP.BigOWith M n₀ f g, which says for , with the constants written out. The bridge TAOCP.BigOWith.isBigO gives the statement f =O[atTop] g of Mathlib.
Example. Let and . For it holds that , so . Hence with and . The constants are not unique: and also work, since for . Each works with a large enough , but fails for every , since . So the good constants are the numbers above the limit of , and the limit itself is not one of them. For the smallest is , the value at . A function that is not in is : for each the bound fails when .
Proof that the definition is consistent. A formula is built from sets by sums, products and similar operations, so each formula is a set. The sign between two formulas is then the relation , which is reflexive and transitive. So a chain gives , which is the statement that one expects from a chain. If has no symbol, then is a set with one element, and is the membership of this element.
Definition C1.1.2.11.1.2 (operations on sets of functions, TAOCP Section 1.2.11.1). Let and be sets of functions of , and let be a constant and a function. A single function stands for the set , and , , and every other operation are formed in the same way. Then
Node: none
Explanation. This is the dictionary that turns a formula with into a set. The formula means , the set of all with . The formula is the set of all products with and .
Example. Let and . The function is in and is in . So the function is in , and is in .
Theorem C1.1.2.11.1.3 (the harmonic numbers, TAOCP eq. 1.2.11.1(1)). Let be the constant of Euler. Then for all
Node: TAHEVEXMDH · Lean: TAOCP.S1_2_11.eq1 (partial) · status: not stated yet
Explanation. The sum grows like , and the difference tends to a constant. The statement says how fast the difference approaches its limit: the error is positive and it is less than . The true size of the error is close to , but the bound with is easy to prove and it is enough for the form with and .
Example. The next table has from Section 1.2.7 and the error with .
| 1 | 1 | 0.5772157 | 0.4227843 | 0.4228 |
| 5 | 2.2833333 | 2.1866536 | 0.0966798 | 0.4834 |
| 10 | 2.9289683 | 2.8798008 | 0.0491675 | 0.4917 |
| 1000 | 7.4854709 | 7.4849709 | 0.0004999 | 0.4999 |
The product stays below , as the theorem says, and it tends to .
Proof. Let . Then . Two facts about the logarithm are used. First, for , so . Second, , since the integrand is larger than on the interval. So
The sequence decreases, and it is bounded below, since the sum of the differences from to is at most . So has a limit , and . This sum has positive terms, so it is positive, and it is at most . The inequality is strict because the first inequality is strict for .
Theorem C1.1.2.11.1.4 (a polynomial is of its top power, TAOCP Section 1.2.11.1). If is a polynomial of degree at most , then . In detail, for all .
Node: none · Lean: TAOCP.S1_2_11.poly_isBigO
Explanation. The top power of dominates all lower powers, once . The constant is the sum of the sizes of the coefficients, and .
Example. Take and . Then . At it holds that , and the bound is . The bound is far from tight, but it holds.
Proof. For and it holds that . So .
Example C1.1.2.11.1.5 (a true bound that is weak, TAOCP eq. 1.2.11.1(2)). For the sum of squares,
Node: TA543H17GK · Lean: TAOCP.S1_2_11.eq2 · status: not stated yet
Explanation. The sum of squares is (Section 1.2.3). It is a polynomial of degree , so it is by Theorem C1.1.2.11.1.4, and it is also , since . The statement is true, but it is weak: it gives an upper bound that is larger than the truth by a factor of . An bound never says that the bound is close to the truth.
Example. For the sum is and . For the sum is and . The ratio is and at these two points and it tends to . So the constant is far larger than needed for large .
Proof. By Theorem C1.1.2.11.1.4 with and the coefficients , it holds that for . So and .
Example C1.1.2.11.1.6 (a stronger bound, TAOCP eq. 1.2.11.1(3)). For the same sum,
Node: TA5DHAEJHJ · Lean: TAOCP.S1_2_11.eq3 · status: not stated yet
Explanation. This is the sharp order of growth. The sum is a polynomial of degree , so the exponent cannot be lowered.
Example. At the ratio is . At it is . It tends to . A constant that works is , and it is tight at where .
Proof. The proof needs for . The left side is , and for . Hence with and .
Example C1.1.2.11.1.7 (the leading term and an error, TAOCP eq. 1.2.11.1(4)). For the same sum,
Node: TAM5S69K8G · Lean: TAOCP.S1_2_11.eq4 · status: not stated yet
Explanation. This is the strongest of the three statements. It gives the main term exactly and bounds the rest. The rest is , which is by Theorem C1.1.2.11.1.4.
Example. At the difference is , and , so the ratio is . At the ratio is . It tends to , so the best constant for large is a little over .
Proof. It holds that for . So and .
Theorem C1.1.2.11.1.8 (a function is of itself, TAOCP eq. 1.2.11.1(5)). For each function ,
Node: TAPPCTBPSY · Lean: TAOCP.S1_2_11.eq5 · status: not stated yet
Explanation. This is the equation that lets a plain function enter a formula with .
Example. Let . Then for all . So and , and the bound is an equality.
Proof. The bound is true for each .
Theorem C1.1.2.11.1.9 (a constant factor, TAOCP eq. 1.2.11.1(6)). If is a constant, then
Node: TASP3P3WPA · Lean: TAOCP.S1_2_11.eq6 · status: not stated yet
Explanation. A constant factor is absorbed into the hidden constant . The statement holds also for . For the reverse inclusion is true too, since .
Example. Let , which lies in with and . Then has . So it lies in with .
Proof. Let with constants and . Then for . The constant is positive if (use any positive constant if ). So .
Theorem C1.1.2.11.1.10 (the sum of two terms of the same order, TAOCP eq. 1.2.11.1(7)).
Node: TAZEJMRFX0 · Lean: TAOCP.S1_2_11.eq7 · status: not stated yet
Explanation. The two hidden functions may differ and they have different constants. The sum has the larger and the sum of the two constants .
Example. Let and , both in . The first has , so . The second has , so . The sum is , and for . So the sum lies in with . The proof below gives the larger constant , which is valid but not the best.
Proof. Let have the constants and the constants . For it holds that .
Theorem C1.1.2.11.1.11 (an of an , TAOCP eq. 1.2.11.1(8)).
Node: TAQD01BT8E · Lean: TAOCP.S1_2_11.eq8 · status: not stated yet
Explanation. The left side is the set of all for which some has . A chain of two bounds is a bound by the product of the two constants.
Example. Let , which lies in with and . Let . Then , so with . Also , so , and with the product of the constants, .
Proof. Let with the constants , and let with the constants . For it holds that . So .
Theorem C1.1.2.11.1.12 (a product, TAOCP eq. 1.2.11.1(9)).
Node: TAEMBJPWG8 · Lean: TAOCP.S1_2_11.eq9 · status: not stated yet
Explanation. The product of two bounded errors is bounded by the product of the bounds. This is the tool for the product of two formulas with errors.
Example. Let with and , and let with and . The product satisfies . At : and .
Proof. Let with and with . For it holds that .
Theorem C1.1.2.11.1.13 (a factor comes out, TAOCP eq. 1.2.11.1(10)).
Node: TAXVEXFG67 · Lean: TAOCP.S1_2_11.eq10, TAOCP.S1_2_11.eq10_rev · status: not stated yet
Explanation. Here is a fixed function, not an symbol, and both inclusions hold. The proof needs a convention for the places where : there every element of the left set is for .
Example. Let and . A function in is for (since then, ). Write with , and . So , and . In the other direction lies in with .
Proof. The inclusion from right to left: let with . For , . So . The inclusion from left to right: let with . Define if and if . For , if then . If then , so , and . So and .
Definition C1.1.2.11.1.14 (the symbol for a complex variable near zero, TAOCP Section 1.2.11.1). Let be a function of a complex variable . Sums, products and equations with the symbol are read as in Definition C1.1.2.11.1.1. Here a function belongs to when two positive numbers and exist such that
Node: none
Explanation. This is the same idea with a different limit. Now goes to , and the bound holds inside a disc of radius . All the rules of eqs. (5) to (10) hold in the same form, with the same proofs: replace "" by "" and take the smaller of two radii where a proof takes the larger of two . A third form, with over the real numbers, is used in Lemma C1.1.2.11.1.21.
Example. The function is in . For the series gives . So and work.
Theorem C1.1.2.11.1.15 (a convergent power series, TAOCP eq. 1.2.11.1(11)). Let be a power series that converges at one point . Then for each integer
Node: TAXX69HR0S · Lean: TAOCP.S1_2_11.eq11 · status: not stated yet
Explanation. The tail of the series is small. Convergence at one point makes the terms bounded, and the bound controls the tail inside the disc of radius . If the series converges at a point far from , then can be large.
Example. Take , and . Then . The proof below gives and . At : , the partial sum is , the tail is , and the bound is .
Proof. The terms of a convergent series tend to , so there is a number with for all . Let and put . Then
(The sum converges at , since the comparison with the geometric series shows that it converges absolutely.) So the tail is in with and .
Theorem C1.1.2.11.1.16 (the exponential, TAOCP eq. 1.2.11.1(12)). For each ,
Node: TAJ9YJDR17 · Lean: TAOCP.S1_2_11.eq12, TAOCP.S1_2_11.eq12_real · status: not stated yet
Explanation. The exponential series converges for all , so Theorem C1.1.2.11.1.15 applies with any . For real there is a sharper bound: , since .
Example. Let and . The partial sum is . The value is . The error is , and the next term of the series is close to it, as the sharper bound predicts: the bound is .
Proof. Take and in Theorem C1.1.2.11.1.15. The series converges by the ratio test, since .
Theorem C1.1.2.11.1.17 (the logarithm, TAOCP eq. 1.2.11.1(13)). For each ,
Node: TA92HN8ZFR · Lean: TAOCP.S1_2_11.eq13, TAOCP.S1_2_11.eq13_real · status: not stated yet
Explanation. The series of converges for and it converges also at . The point is used, where the terms are easy to bound. The statement is about in a disc around , so stays near and the logarithm is the principal one.
Example. Let and . The partial sum is and . The error is , which is close to the next term .
Proof. It holds that for , as the integral of from to (Section 1.2.9). The series converges at . Theorem C1.1.2.11.1.15 gives the claim.
Theorem C1.1.2.11.1.18 (the binomial series, TAOCP eq. 1.2.11.1(14)). For each real or complex and each ,
Node: TA9RPN3V4M · Lean: TAOCP.S1_2_11.eq14 (partial) · status: not stated yet
Explanation. The binomial series is the Taylor series of , and it converges for . The coefficients are defined for each (Section 1.2.6). When is a nonnegative integer, the series stops at and the error is for .
Example. Take , and . The coefficients are and . The partial sum is and . The error is , close to the next term .
Proof. The series has the ratio of consecutive coefficients, so it converges for and in particular at . Its sum is for (Section 1.2.9). Theorem C1.1.2.11.1.15 gives the claim.
Theorem C1.1.2.11.1.19 (the series of the harmonic numbers, TAOCP eq. 1.2.11.1(15)). For each , with ,
Node: TAC9CS23R1 · status: not stated yet
Explanation. The left side is the generating function of the harmonic numbers (Section 1.2.9). The statement is that the first harmonic numbers are the first coefficients, with an error of the order of the next power. Since , the first term is and not written out.
Example. Take and . The partial sum is . The left side is . The error is , and the next term is of the same size.
Proof. The product of and has the coefficient of equal to , since pairs with . Both series converge for , so the product converges there and equals the left side. At the terms tend to because . Theorem C1.1.2.11.1.15 gives the claim.
Lemma C1.1.2.11.1.20 (the Stirling numbers of a real argument, TAOCP Section 1.2.11.1). For each integer there are polynomials and in , of degree at most , with for all integers and for all integers . For real the book writes and for and . The first ones are
Node: none
Explanation. The Stirling numbers are defined for integers. When the lower index is the upper index minus a fixed , the number is a polynomial in the upper index, and this gives the meaning for real . The polynomials are unique, since a polynomial is fixed by its values at infinitely many integers. Note that for integers , and the polynomial takes the value there too.
Example. The values , , and agree with Section 1.2.6. At the values are , , , and .
Proof. First kind. The product has the coefficient of equal to the elementary symmetric sum . By Section 1.2.6 this coefficient is . Newton's identities with the power sums express as a polynomial in , each term of which has the form with . The sum is a polynomial in of degree (Section 1.2.11.2 below, or induction on with the difference of ). A product of of them has degree . So is a polynomial of degree at most , and the identity holds for all integers (the Newton identities are identities of polynomials in the variables, so they also give when there are fewer than variables).
Second kind. The recursion is also the recursion of the complete symmetric sum in the variable and the degree : with , which splits the monomials by the power of . The start values agree: for both sides are unless , and for both sides are . So . Newton's identities for , , with , give a polynomial in of degree at most by the same count. This holds for all integers .
The table is the result of this computation for . Each entry was checked against the integer values of the Stirling numbers.
Lemma C1.1.2.11.1.21 (the ratio of two gamma values, a tool of C1 for TAOCP eqs. 1.2.11.1(16) and (17)). Let be real and an integer. As through the real numbers,
Node: none
Explanation. This is the form of eq. (16) for real . For the integer the left side is , the rising power of with a real exponent (Section 1.2.5 defines ). The lemma has two steps. The first step uses the series of Stirling to show that an expansion exists, with coefficients that are polynomials in . The second step shows that by a comparison with integer .
Example. Take . Then , and the coefficients are . The polynomials give and . For the coefficients are (Lemma C1.1.2.11.1.20), and a numeric check at gives against .
Proof. Step 1. The series of Stirling holds also with a shift. The book proves the case of in eqs. 1.2.11.2(18) and (19), and Euler's summation formula of Section 1.2.11.2, used on for , gives the shifted form in the same way. For fixed real ,
where is the Bernoulli polynomial. Subtract the same formula for . Since , the difference is
Each is a polynomial in of degree . Since , eq. (12) gives . Expand the powers of the sum in and drop the terms of order and higher. This gives . Each is a sum of products with , so it is a polynomial in of degree at most . Multiply by .
Step 2. Let be an integer with . Then exactly, by Lemma C1.1.2.11.1.20. So , with for (which the lemma gives). A sum that is has all : if is the first nonzero one, multiply by and let to get . Hence for every integer . Two polynomials in that agree at all nonnegative integers are equal, so .
Theorem C1.1.2.11.1.22 (the rising power by powers, TAOCP eq. 1.2.11.1(16)). Let be the rising power of Section 1.2.5, and let be the polynomial of Lemma C1.1.2.11.1.20. For each real and each integer , as ,
Node: TAY1623TM5 · status: not stated yet
Explanation. For a nonnegative integer the rising power is a polynomial, and its coefficients are the Stirling numbers of the first kind. The formula says that the same coefficients, extended to real by Lemma C1.1.2.11.1.20, give the correct expansion of in powers of , even when is not an integer. If is an integer, the sum stops at , and the error is for . For a negative integer the full series converges once exceeds . For it holds that , and for all .
The sum is not a convergent series in general. For the coefficients become large. Exact fractions give the terms at : for , for , for and for , which is the smallest. After that the terms rise: for and for . So the series diverges, as the book says for each , and exercise 1.2.11.1-12 proves it. Each truncation is still right.
Example. Take and : , with and . Take and : the exact value is . The partial sums and their errors are
| partial sum | exact minus sum | error | |
|---|---|---|---|
| 0 | 10 | ||
| 1 | 9.9875 | ||
| 2 | 9.9875078125 | ||
| 3 | 9.98750786132812 |
The last column tends to the next coefficient , which is , , and for . So the error is the next term, up to a factor that tends to .
Proof. Put and in Lemma C1.1.2.11.1.21 and multiply the sum by term by term. The remainder is already.
Theorem C1.1.2.11.1.23 (the falling power by powers, TAOCP eq. 1.2.11.1(17)). Let be the falling power for real (it is for a nonnegative integer ), and let be the polynomial of Lemma C1.1.2.11.1.20. For each real and each integer , as ,
Node: TAGS7CH2PT · status: not stated yet
Explanation. This is the companion of eq. (16) for the falling power. The coefficients are the same polynomials , now with the alternating sign . For a nonnegative integer the sum stops at , the error is for , and the formula is eq. 1.2.6(44), the expansion of in powers of with the Stirling numbers of the first kind. For other the sum is an asymptotic series in the same sense as eq. (16): for its terms are, up to sign, the terms of the divergent series of eq. (16).
Example. Take and : , with and . Take and : the exact value is . The partial sums and their errors are
| partial sum | exact minus sum | error | |
|---|---|---|---|
| 0 | 10 | ||
| 1 | 10.0125 | ||
| 2 | 10.0125078125 | ||
| 3 | 10.0125077636719 |
The last column tends to the next coefficient , which is , , and for .
Proof. Put . Then , and Lemma C1.1.2.11.1.21 gives . Write and expand by eq. (14): . Collect the powers of . This gives with , a polynomial in . For an integer the falling power is the polynomial by eq. 1.2.6(44), so at all integers by the uniqueness of the coefficients (see the proof of Lemma C1.1.2.11.1.21). Two polynomials that agree at all nonnegative integers are equal. So for all real .
The inverse expansion. The same method expands the power in falling powers: for each real and each integer ,
For a nonnegative integer this is eq. 1.2.6(45). A check at and : , with and . A check at and , with : the partial sums are , , and for . The errors divided by are , , and . They tend to , which is , , and .
Proof of the inverse expansion. Insert the theorem with in place of into the right side:
with , a polynomial in . Claim: and for . It holds that . Let be an integer. Then exactly by eq. 1.2.6(45), and each falling power is the polynomial of eq. 1.2.6(44). The coefficient of on the right is , and on the left it is for . So vanishes at all integers , and it is the zero polynomial. Therefore the sum is .
Theorem C1.1.2.11.1.24 (the th root of , TAOCP eq. 1.2.11.1(18)). For all integers , with ,
Node: TAC0KQZM1W · Lean: TAOCP.S1_2_11.eq18 · status: not stated yet
Explanation. Taking the th root pushes a number toward , but the number grows, and it is not clear at first which effect wins. The theorem shows that tends to and tells how fast. Write the root as with and use eq. (12) with . The only fact needed about is that it is small: for all .
Example. The values of are
| 1 | 2 | 3 | 4 | 5 | 10 | 100 | |
|---|---|---|---|---|---|---|---|
| 1 | 1.41421 | 1.44225 | 1.41421 | 1.37973 | 1.25893 | 1.04713 |
The sequence has its maximum at and decreases to from there on. At it holds that , , and the error is , below . The ratio of the error to is , so the best constant for large is close to .
Proof. Let . The series gives , because for and . The function has the derivative , so it has its maximum at . Hence for , and the bound applies with . So and . The same derivative is negative for , so decreases for , and so does . It tends to because (exercise 1.2.11.1-8).
Theorem C1.1.2.11.1.25 (the size of , TAOCP eq. 1.2.11.1(19)). For all integers ,
Node: TAMV62YZHH · Lean: TAOCP.S1_2_11.eq19 · status: not stated yet
Explanation. The quantity is the difference quotient of at with step , and the derivative of this function at is . So is the natural guess, and the theorem bounds the error of the guess. The proof multiplies eq. (18) by : by eqs. (6) and (10).
Example. At : , , and the difference is against the bound . At the value is , and the difference is against the bound . At the ratio of the difference to the bound is .
Proof. Multiply the inequality of Theorem C1.1.2.11.1.24 by : .
Definition C1.1.2.11.1.26 (lower bound and exact order, TAOCP Section 1.2.11.1). Let and be functions of . Write when two positive numbers and exist with the lower bound at every . Write if both and .
Node: TAKKBTFWYX · Lean: TAOCP.BigOmegaWith, TAOCP.S1_2_11.IsOmega · status: not stated yet
Explanation. The symbol gives an upper bound only. A reader who sees may think that is the true order of , but can be much smaller, for example . The symbol is the lower bound: the function is at least a fixed multiple of for large . The symbol states both bounds at once, so that and have the same order of growth up to constant factors. In Lean the three are TAOCP.BigOWith, TAOCP.BigOmegaWith and TAOCP.ThetaWith, each with the constants written out.
Example. The function is with and , since . It is also with , since . So it is . It is not , since the ratio tends to . For the function and the harmonic numbers it holds that with , and : at the ratio is , and at it is .
Proof that the example is correct. For it holds that , since . Also , since . (Theorem C1.1.2.11.1.3 alone gives only , which is larger than at .) Further for , so .
Theorem C1.1.2.11.1.27 (the lower bound, TAOCP eq. 1.2.11.1(20)). Let and be functions of . The statement below is true exactly when some and some give from on:
Node: TAP9PXM23T · Lean: TAOCP.BigOmegaWith, TAOCP.S1_2_11.IsOmega · status: not stated yet
Explanation. This is the equation that names the lower bound. The condition has the shape of the definition of with the inequality turned around. The Lean predicate TAOCP.BigOmegaWith L n₀ f g says for , so its first function is the larger one. The condition of eq. (20) is therefore TAOCP.BigOmegaWith L n₀ g f, with first, and for the bridge TAOCP.BigOmegaWith.isBigO turns it into f =O[atTop] g of Mathlib.
Example. Let . Then when , since exactly when . So with and . For the bound can fail: at it holds that , while . This is why the definition has .
Proof. The statement is the definition of in Definition C1.1.2.11.1.26, so the "if and only if" is immediate.
Theorem C1.1.2.11.1.28 (the exact order, TAOCP eq. 1.2.11.1(21)). For functions and the equivalence below holds. Each side of it is true exactly when some , and give from on.
Node: TAE0Z4VBP3 · Lean: TAOCP.ThetaWith, TAOCP.S1_2_11.eq21 · status: not stated yet
Explanation. The equivalence is the definition of as a conjunction. The second form uses one common , the larger of the two. In Lean, TAOCP.ThetaWith L M n₀ g f is the conjunction of TAOCP.BigOmegaWith L n₀ g f and TAOCP.BigOWith M n₀ g f with a common , and for the bridge TAOCP.ThetaWith.isTheta gives g =Θ[atTop] f, which is Asymptotics.IsTheta of Mathlib.
Example. Take and . For : . So with , and . The ratio falls from at toward . So is the best lower constant, and for large the upper constant can be any number above , but never itself.
Proof. If with and with , then for both and hold. Conversely the two bounds with a common give the two statements.
Theorem C1.1.2.11.1.29 (the lower bound and the upper bound are dual, TAOCP exercise 1.2.11.1-13). The statements and are equivalent. As a consequence, holds exactly when both and hold.
Node: none · Lean: TAOCP.S1_2_11.isOmega_iff
Explanation. A lower bound on by is the same as an upper bound on by . The constant changes from to . The proof uses that the constants of the definitions are positive; if were allowed, then each function would be of every other function, and the equivalence would fail, for example for and .
Example. For and : for , so with . And , so with . For the constants are in the first and in the second.
Proof. If for with , then , so with . If with , then , so with . The second sentence follows from the definition of .
Algorithms and programs
Section 1.2.11.1 has no algorithm and no program. Each formula of it can be checked by machine with exact fractions for the polynomial parts, and with a 30-digit float for the gamma function and the logarithm. The numbers of this chapter were found in that way: the table of , the partial sums of eqs. (16) and (17), and the values of .
The exercises
The table has the exercises of Section 1.2.11.1. The kind is the class of spec 06.3, and the indexer of S0 fixes it in the map.
| Exercise | Rating | Markers | Kind | Lean | Solution |
|---|---|---|---|---|---|
| 1.2.11.1-1 | 01 | HM | K3 | not yet stated | X1, 1.2.11.1-1 |
| 1.2.11.1-2 | 10 | M | K3 | not yet stated | X1, 1.2.11.1-2 |
| 1.2.11.1-3 | 15 | M | K4 | not yet stated | X1, 1.2.11.1-3 |
| 1.2.11.1-4 | 15 | M | K4 | not yet stated | X1, 1.2.11.1-4 |
| 1.2.11.1-5 | 20 | M | K2 | not yet stated | X1, 1.2.11.1-5 |
| 1.2.11.1-6 | 20 | M | K2 | not yet stated | X1, 1.2.11.1-6 |
| 1.2.11.1-7 | 15 | HM | K1 | not yet stated | X1, 1.2.11.1-7 |
| 1.2.11.1-8 | 20 | HM | K1 | not yet stated | X1, 1.2.11.1-8 |
| 1.2.11.1-9 | 20 | HM | K1 | not yet stated | X1, 1.2.11.1-9 |
| 1.2.11.1-10 | 22 | HM | K4 | not yet stated | X1, 1.2.11.1-10 |
| 1.2.11.1-11 | 11 | M | K1 | not yet stated | X1, 1.2.11.1-11 |
| 1.2.11.1-12 | 25 | HM | K1 | not yet stated | X1, 1.2.11.1-12 |
| 1.2.11.1-13 | 10 | M | K2 | not yet stated | X1, 1.2.11.1-13 |
The order to do them: start with 1.2.11.1-1 and 2, which test the meaning of as a set. Then do 1.2.11.1-3 and 4, which apply eqs. (6) to (10) and (12). Exercises 1.2.11.1-5 and 6 ask for a counterexample and for the error in an argument, and the constants of the definition decide both. Exercises 1.2.11.1-7 and 8 are the limits behind eq. (18), and exercise 1.2.11.1-11 is its proof. Exercises 1.2.11.1-9 and 10 extend eqs. (12) and (13) to an error that is itself an . Exercise 1.2.11.1-12 proves the divergence that Theorem C1.1.2.11.1.22 shows by numbers. Exercise 1.2.11.1-13 is Theorem C1.1.2.11.1.29.
Check for exercise 1.2.11.1-4 with : the value of at agrees with , and the error times is , close to .
Lean
The Lean code of tamnd/taocp-lean at main has the file TAOCP/V1/S1_2_11.lean, in the namespace TAOCP.S1_2_11, and the definitions in TAOCP/Notation/BigO.lean. The Node lines name the declarations. Where the Lean statement differs from the handbook, the Node line says "partial".
TAOCP.BigOWith,TAOCP.BigOmegaWithandTAOCP.ThetaWithgive the bounds with the constants written out. The bridgesTAOCP.BigOWith.isBigO,TAOCP.BigOmegaWith.isBigOandTAOCP.ThetaWith.isThetaconnect them to=O[atTop]and=Θ[atTop]of Mathlib.- Eqs. (1) to (4) are
TAOCP.S1_2_11.eq1,eq2,eq3andeq4, with the closed formTAOCP.S1_2_11.sum_squares. The polynomial rule isTAOCP.S1_2_11.poly_isBigO. - Eqs. (5) to (10) are
TAOCP.S1_2_11.eq5toeq10, andTAOCP.S1_2_11.eq10_revis the reverse inclusion of eq. (10). - Eqs. (11) to (14) are
TAOCP.S1_2_11.eq11toeq14. Eqs. (12) and (13) also have the real formsTAOCP.S1_2_11.eq12_realandeq13_real. Eqs. (18) and (19) areTAOCP.S1_2_11.eq18andeq19. - Eq. (20) is
TAOCP.S1_2_11.IsOmega, the duality of and isTAOCP.S1_2_11.isOmega_iff, and eq. (21) isTAOCP.S1_2_11.eq21.
The Lean statement differs from the handbook in two places. Eq. (1) states only. The strict bounds are not stated. Eq. (14) states real and real only.
Not yet stated: the Node lines that say "Lean: not yet stated", which include the asymptotic series with the coefficients and and the results on the gamma function.
Notes and history
The symbol comes from P. Bachmann, in the second volume of his Analytische Zahlentheorie (1894). E. Landau made it common in number theory in his Handbuch der Lehre von der Verteilung der Primzahlen (1909), where he added the symbol . G. H. Hardy and J. E. Littlewood introduced in 1914, and in that literature means "not ", a weaker statement than the lower bound of the section. Knuth proposed the present meaning of and the symbol for computer science in "Big Omicron and big Omega and big Theta", SIGACT News 8, 2 (1976).
The series of eq. (16) is a case of the asymptotic series of H. Poincaré (1886): a series that need not converge, whose partial sums have the right error order. The coefficients and are polynomials in . Graham, Knuth and Patashnik, Concrete Mathematics (1989), Section 6.2, write them with the help of the Stirling polynomials, which are not the of this chapter.
Eqs. (16) and (17) both expand a factorial power in ordinary powers, and both use the numbers of the first kind. The inverse expansion of Theorem C1.1.2.11.1.23, with the numbers of the second kind, is not in the section. A reader who mixes the two should note that the sign belongs to the expansion of : for the form would give on the right.
The proofs of eqs. (16) and (17) in this chapter use the series of Stirling from Section 1.2.11.2. No result of Section 1.2.11.2 uses eq. (16) or (17), so there is no circle.
The project has no errata of Section 1.2.11.1 to report.
Section 1.2.11.1 of TAOCP gives a short way to write an approximation together with the size of its error. The statement says that the error is at most a fixed multiple of for all large , and it does so without any value for the multiple. The section defines the notation, lists the rules that let a reader compute with it, applies it to power series and to the powers of Section 1.2.6, and ends with the lower bound and the exact order . This chapter of C1 explains each item of the section, proves each rule, and checks each formula on numbers.
The source of this page. Something is wrong? Report it.