Professional Documents
Culture Documents
NewMasterTheorem PDF
NewMasterTheorem PDF
Akra and Bazzi [AB98] recently gave a closed form solution for a large class of recurrences.
Theorem 1 Let (
h(x) for 1 ≤ x ≤ x0
f (x) = x (1)
a f ( b ) + g(x) for x > x0
where
2. x ≥ 1 is a real number,
3. d1 ≤ h(x) ≤ d2 for some positive constants d1 and d2 and all x with 1 ≤ x ≤ x0 , and
4. g is a nonnegative function satisfying the polynomial growth condition, i.e., there are pos-
itive constants c1 and c2 such that
5. (technical condition) Z x0
g(u)
I := du < ∞
1 u p+1
Let p be the unique real number for which a/b p = 1. Then
Z x
g(u)
f (x) = Θ x 1 +
p
p+1
du .
1 u
u2
Z x
f (x) = Θ x (1 +
log 3
1+log 3
du) = Θ(xlog 3 (1 + x2−log 3 )) = Θ(x2 ) .
1 u
1
Proof: For any x > x0 , we have x/b < x and x/b > x0 /b ≥ 1. Thus f (x) is well-defined. We
need to prove
Z x Z x
p g(u) p g(u)
C·x 1+ p+1
du ≤ f (x) ≤ D · x 1 + p+1
du (2)
1 u 1 u
for positive constants C and D. We prove the upper bound and leave the lower bound to exer-
cise 1. The proof of the upper bound is by induction on the index of x, the smallest integer k such
that x/bk ≤ x0 .
Assume first that 1 ≤ x ≤ x0 . Then
p 1 + x g(u) du
R
x p x 1 u p+1
f (x) = h(x) ≤ d2 ≤ d2 p ≤ d2 p ,
min(1, x0 ) min(1, x0 )
since x p assumes its minimum in [1, x0 ] at either x = 1 (if p ≥ 0) or x = x0 (if p < 0) and since
the value of the integral is nonnegative. Thus the upper bound in equation (2) holds for any D
for which D ≥ d2 / min(1, x0p ).
Assume next that x > x0 . The index of x/b is one smaller than the index of x and hence we
may use the upper bound in equation (2) for x/b. We obtain:
x
f (x) = a f ( ) + g(x) definition of f
b
x p Z x/b
g(u)
≤ a·D· 1+ du + g(x) induction hypothesis
b 1 u p+1
Z x/b
p g(u)
= D·x 1+ du + g(x) since a/b p = 1
1 u p+1
Z x
p g(u)
≤ D·x 1+ p+1
du
1 u
provided that D ≥ max((1/b) p+1, 1)/(c1(1 − 1/b)). This completes the induction step.
2
p
We satisfy both constraints on D by setting D = max(d2 , d2 /x0 , b/(c1 (b − 1)), 1/(c1(b −
1)b p)).
Rx
How does the value I := x p 1 g(u)/u p+1 du depend on the relation of g and p? Inspection of
a table of integrals1 yields:
1 x
= Θ(1) ε >0
Rx 1
1 u1+ε du = − ε uε i1
R x lnk u h k+1 x
1 u du = ln u
k+1 = Θ(lnk+1 x) k≥0
1
ix
R x uδ lnk h
1 u du = Θ uδ lnk u = Θ(xδ lnk x) δ > 0 and k ≥ 0
1
Thus
• f (x) = Θ(g(x)) if g(x) = Θ(x p+δ logk ) for some δ > 0 and k ≥ 0.
R x/bi−1
It is instructive to inspect the value I∆ := x p x/bi
g(u)/u p+1 du. For g(x) = x p , we have
Z x/bi−1 Z x/bi−1
g(u) 1 x/bi−1
I∆ = x p du = x p du = x p [ln u]x/bi = x p ln b ,
x/bi u p+1 x/bi u
i.e., all levels of the recursion contribute essentially the same amount to f (x). If g(x) = ω (x p ),
the outermost level (i = 0) contributes most, and if g(x) = o(x p ), the bottommost level (i = logb x)
contributes most.
Let us next study the two terms in the expression for f (x). Since 1 ≤ x/bk ≤ x0 , we have
d1 ≤ h(x/bk ) ≤ d2 and hence
3
where the last equality can be established by taking logarithms on both sides and observing that
k log a = (log x)/(log b) log a and p log x = (log a)/(log b) log x.
We turn to the sum S := ∑0≤i<k ai g(x/bi ) Define x∗ as x/bk . Then x/bi = x∗ bk−i and hence
where the second equality uses the substitution j = k − i and the third equality uses a = b p . Since
sums are harder to evaluate than integrals, we want to turn the sum into a integral. Consider a
single term g(x∗ b j )/(b j ) p . We want it to be the value of an integral from x∗ b j−1 to x∗ b j . The
length of this integral is x∗ (b j − b j−1 ) = x∗ b j (1 − 1/b). Thus
Z x∗ b j Z x∗ b j
g(x∗ b j ) (x∗ ) p g(x∗ b j ) ∗ p b g(x∗ b j ) ∗ p b g(x∗ b j )
= = (x ) du = (x ) du .
(b j ) p (x∗ b j ) p b−1 x∗ b j−1 (x∗ b j ) p · (x∗ b j ) b−1 x∗ b j−1 (x∗ b j ) p+1
With
g(x∗ b j )
Z x
∗ j−1 ∗ j b′ ∗ p
h(u) := ∗ j p+1 for x b < u ≤ x b , we have S = (x ) h(u) du .
(x b ) b−1 x∗
and we completed the alternative proof of the AB-theorem. We should remark that the alternative
proof does not generalize.
We come to extensions. In Theorem 1, f (x) is defined as a times the value of f at x/b. More
generally, we can define f (x) as a linear combination of smaller values.
(
h(x) for 1 ≤ x ≤ x0
f (x) = (3)
∑i=1 ai f ( bi ) + g(x) for x > x0
k x
where k is an integer constant and ai > 0 and bi > 1 are real constants. In order to make f well
defined, we require x0 ≥ maxi bi . Then 1 ≤ x/bi < x for all x ≥ x0 and all i. We define p as the
unique real number for which ∑i ai (1/bi ) p = 1.
4
Proof: The proof is analogous to the proof of Theorem 1 and delegated to the exercises. It
again uses induction on the index of x, the smallest integer k such that x/(mini bi )k ≤ x0 .
Although Theorem 2 handles a broad class of recurrences, it does not cover a common form
of recurrence arising in the analysis of algorithms. For example, in the recurrence for the running
time of Karatsuba’s algorithm, we reduced TK (n) to TK (⌈n/2⌉ + 1). The following extension of
Theorem 2 deals with these variations. Consider
(
h(x) for 1 ≤ x ≤ x0
f (x) = (4)
∑ki=1 ai f ( bxi + hi (x)) + g(x) for x > x0
where k is an integer constant and ai > 0 and bi > 1 are real constants. The hi are functions with
|hi (x)| ≤ x/(log1+ε x) for some ε > 0 and all x > x0 . In order to make f well defined, we require
1 ≤ x/bi + hi (x) < x/b for all i and x > x0 and some b > 1. As before, we define p as the unique
real number for which ∑i ai (1/bi ) p = 1.
Theorem 3 (Leighton) Under the assumptions stated above and some more technical condi-
tions on x0 (see [Lei]) Z x
g(u)
f (x) = Θ x 1 +
p
p+1
du .
1 u
For the Karatsuba recurrence we would use k = 3, ai = 1, bi = 2 and hi (x) = ⌈x/2⌉ + 1 − x/2
for 1 ≤ i ≤ k.
References
[AB98] M. Akra and L. Bazzi. On the solution of linear recurrence equations. Computational
Optimization and Applications, 10(2):195–210, 1998.
[Lei] T. Leighton. Notes on better master theorems for divide and conquer recur-
rences. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.
1.1.39.1636.