For b>1 and n>0, log_b n is the unique exponent x with bˣ=n. For n≥1 and b>1, exactly ⌈log_b n⌉ repeated divisions by b are needed to first obtain a value at most 1. Halving specifically uses b=2 and log₂ n.
Name the unit being counted. Sequential blocks add their work. Nested loops multiply only when the inner count is the same on every outer iteration; otherwise sum the varying counts. Include work inside each body.
For eventually nonnegative functions f(n) and eventually positive g(n) on integer inputs: O(g) means f(n)≤C g(n) for all n≥n₀; Ω(g) means c g(n)≤f(n) for all n≥n₀; Θ(g) requires both bounds. Suitable constants c,C>0 and a threshold n₀ must exist and be independent of n.
Big O alone is an upper bound, not necessarily a tight order. The common shorthand f=O(g) means membership in a class of bounds, not equality with one function. Ω(g) is unrelated to the sample-space name Ω.
Separate glossary example
For n≥1, 3n²≤3n²+2n+1≤6n², so 3n²+2n+1∈Θ(n²), using c=3,C=6,n₀=1.
T(n) counts a specified kind of operation for inputs of size n. State the operation and whether the model describes a particular case, worst case or average case.
This is an exact count under that model; Θ(n²) describes its growth. It is not automatically a time in seconds or the count of every machine instruction.
Separate glossary example
If iteration i makes i−1 comparisons, for i=1,…,n, then T(n)=∑_{i=1}^{n}(i−1)=n(n−1)/2. For n=4 there are 6 comparisons.
For real b>0, b≠1 and x>0, log_b x is the exponent y for which b^y=x. In growth analysis the base is usually a fixed b>1.
Changing between fixed bases greater than 1 multiplies the logarithm by a positive constant. Actual algorithms may round sizes; include that rounding in an exact operation count.
Separate glossary example
log₂8=3. For n≥1, n/2^k≤1 exactly when k≥log₂n, so the least nonnegative integer k is ⌈log₂n⌉.
How to build an argument: methods and reasonsBefore writing: assumptions, goals and established facts (§4.2)
Assumption: a stated hypothesis or an explicitly temporary premise. Identify its domain.
Goal: what remains to be shown. It is not available as a reason for a later step.
Established: a statement derived from hypotheses, definitions, earlier steps or an applicable theorem. Name that reason.
Introduce witnesses when their existence is justified; give different arbitrary quantities different variables. Finish by matching the result to the original goal.
When to choose: Use it when the negation creates incompatible established facts.
Assume the hypotheses and the negation of the desired conclusion; derive a contradiction.
Start: State exactly what is temporarily assumed for contradiction.
Finish: Name the conflicting statements and discharge the assumption.
Worked example with reasons
Goal
2∣n2⇒2∣n
Prove the statement for every integer n.
Reason: This is Proposition 4.7.4.
Assumption
2∣n2,2∤n
Assume a counterexample: n² is even but n is not even.
Reason: Negating the universal conditional gives one integer satisfying the hypothesis and negating the conclusion. Every integer is either even or odd.
Established
n=2k+1,k∈Z
Introduce an integer k.
Reason: Definition of odd.
Established
n2=(2k+1)2=4k2+4k+1=2(2k2+2k)+1
The square is odd.
Reason: Algebra and closure of integers show 2k²+2k is an integer; then use the definition of odd.
Established
2∣n2∧2∤n2
This is impossible; the assumed counterexample cannot exist.
Reason: No integer is both even and odd (Theorem 4.7.2). Discharging the contradictory assumption proves the original claim.
When to choose: Use it to identify precisely what would make a quantified claim false, especially before a counterexample or contradiction.
Negate one outer quantifier at a time, preserving variable order, domains and the scope of the predicate.
Start: Mark the scope of each quantifier; move the negation inward one rule at a time.
Finish: Read the final statement and check that it describes failure of the original claim. Equivalence does not by itself prove either statement true.
Worked example with reasons
Goal
¬∀x∈D∃y∈EP(x,y)
Rewrite the negation without changing its meaning.
Reason: The domains D and E remain fixed throughout.
Established
∃x∈D¬∃y∈EP(x,y)
There is an x for which the inner existential statement fails.
Reason: Negation of a universal quantifier: ¬∀x R(x) ⇔ ∃x ¬R(x).
Established
∃x∈D∀y∈E¬P(x,y)
For that same x, every y fails P.
Reason: Negation of an existential quantifier: ¬∃y P(x,y) ⇔ ∀y ¬P(x,y). The order ∃x∀y is preserved.
Both are statements established by proof. The name often signals how a text organizes or emphasizes a result, not a different degree of truth.
Lemma
A proved auxiliary result used in another argument. For example, −|r|≤r≤|r| for real r supports later bounds. If r≥0, |r|=r and −r≤r; if r<0, |r|=−r and r≤−r. These cases cover every real r.
Lemma 4.5.4, printed p. 207 / PDF 231
Corollary
A result derived from an established theorem. If r is rational, r+r is rational by closure of rational numbers under addition (Theorem 4.3.2); because 2r=r+r, its double is rational.
Example 4.3.4, printed p. 187 / PDF 211; printed box: Corollary 4.2.3
Keep the domain conditions
With Epp’s definition, d divides 0 for every nonzero integer d: 0=d·0. Do not omit d≠0.
Prime and composite classifications here concern integers n>1. “Not prime” alone does not make 0, 1 or a negative integer composite.
§11.5 · A doubling loopLevel 1
Start with x=1. While x<20, execute x←2x. How many times is the assignment executed?
Enter an integer result. Put any explanation in the reasoning field below.
Symbols
Check answer checks the result above. Your reasoning is saved, not automatically graded; compare it with the walkthrough.