Anda di halaman 1dari 5

1 A Master Theorem for Recurrences

Akra and Bazzi [AB98] recently gave a closed form solution for a large class of recurrences.
Theorem 1 Let
f (x) =
_
h(x) for 1 x x
0
a f (
x
b
) +g(x) for x > x
0
(1)
where
1. a > 0, b > 1, and x
0
b are constants,
2. x 1 is a real number,
3. d
1
h(x) d
2
for some positive constants d
1
and d
2
and all x with 1 x x
0
, and
4. g is a nonnegative function satisfying the polynomial growth condition, i.e., there are pos-
itive constants c
1
and c
2
such that
c
1
g(x) g(u) c
2
g(x) for all x > x
0
and u [x/b, x] .
5. (technical condition)
I :=
_
x
0
1
g(u)
u
p+1
du <
Let p be the unique real number for which a/b
p
= 1. Then
f (x) =
_
x
p
_
1+
_
x
1
g(u)
u
p+1
du
__
.
Before we enter the proof, we give some examples.
If f (x) = 2 f (x/2) +x, then p = 1 and
f (x) =
_
x(1+
_
x
1
u
u
2
du)
_
=(xlogx) .
If f (x) = 3 f (x/2) +x
2
, then p = log3 and
f (x) =
_
x
log3
(1+
_
x
1
u
2
u
1+log3
du)
_
=(x
log3
(1+x
2log3
)) =(x
2
) .
If f (x) = f (x/2) +logx, then p = 0 and
f (x) =
_
x
0
(1+
_
x
1
logu
u
1
du)
_
=(1+log
2
x) =(log
2
x) .
1
Proof: For any x > x
0
, we have x/b < x and x/b > x
0
/b 1. Thus f (x) is well-dened. We
need to prove
C x
p
_
1+
_
x
1
g(u)
u
p+1
du
_
f (x) D x
p
_
1+
_
x
1
g(u)
u
p+1
du
_
(2)
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/b
k
x
0
.
Assume rst that 1 x x
0
. Then
f (x) = h(x) d
2
d
2
x
p
min(1, x
p
0
)
d
2
x
p
_
1+
_
x
1
g(u)
u
p+1
du
_
min(1, x
p
0
)
,
since x
p
assumes its minimum in [1, x
0
] at either x = 1 (if p 0) or x = x
0
(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 d
2
/min(1, x
p
0
).
Assume next that x > x
0
. 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:
f (x) = a f (
x
b
) +g(x) denition of f
a D
_
_
x
b
_
p
_
1+
_
x/b
1
g(u)
u
p+1
du
__
+g(x) induction hypothesis
= D x
p
_
1+
_
x/b
1
g(u)
u
p+1
du
_
+g(x) since a/b
p
= 1
D x
p
_
1+
_
x
1
g(u)
u
p+1
du
_
provided we can establish the inequality
g(x) D x
p
_
x
x/b
g(u)
u
p+1
du .
The inequality is a simple consequence of the polynomial-growth assumption. Observe that
g(u) c
1
g(x) for x/b u x and u
p+1
max((x/b)
p+1
, x
p+1
) and hence
D x
p
_
x
x/b
g(u)
u
p+1
du D x
p
(x x/b)
c
1
g(x)
max((x/b)
p+1
, x
p+1
)
= D
c
1
(11/b)
max((1/b)
p+1
, 1)
g(x)
g(x)
provided that D max((1/b)
p+1
, 1)/(c
1
(11/b)). This completes the induction step.
2
We satisfy both constraints on D by setting D = max(d
2
, d
2
/x
p
0
, b/(c
1
(b 1)), 1/(c
1
(b
1)b
p
)).
How does the value I :=x
p
_
x
1
g(u)/u
p+1
du depend on the relation of g and p? Inspection of
a table of integrals
1
yields:
_
x
1
1
u
1+
du =
_
1
u

x
1
= (1) > 0
_
x
1
ln
k
u
u
du =
_
ln
k+1
u
k+1
_
x
1
= (ln
k+1
x) k 0
_
x
1
u

ln
k
u
du =
__
u

ln
k
u
_
x
1
_
= (x

ln
k
x) > 0 and k 0
Thus
f (x) =(x
p
), if g(x) = O(x
p
) for some > 0,
f (x) =(g(x)log
k+1
x) if g(x) =(x
p
log
k
) for some k 0, and
f (x) =(g(x)) if g(x) =(x
p+
log
k
) for some > 0 and k 0.
It is instructive to inspect the value I

:=x
p
_
x/b
i1
x/b
i
g(u)/u
p+1
du. For g(x) = x
p
, we have
I

= x
p
_
x/b
i1
x/b
i
g(u)
u
p+1
du = x
p
_
x/b
i1
x/b
i
1
u
du = x
p
[lnu]
x/b
i1
x/b
i
= x
p
lnb ,
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 =log
b
x)
contributes most.
Exercise 1 Prove the lower bound of Theorem 1.
Let us see a second proof. We rst express f (x) as a sum.
Lemma 1 Let k be the minimal integer with x/b
k
x
0
. Then
f (x) = a
k
f (x/b
k
) +

0i<k
a
i
g(x/b
i
) = a
k
h(x/b
k
) +

0ik
a
i
g(x/b
i
) .
Proof: Either by repeated substitution or by induction on k.
Let us next study the two terms in the expression for f (x). Since 1 x/b
k
x
0
, we have
d
1
h(x/b
k
) d
2
and hence
a
k
h(x/b
k
) =(a
k
) =(x
p
)
1
See for example, the Wikipedia entry on lists of integrals.
3
where the last equality can be established by taking logarithms on both sides and observing that
kloga = (logx)/(logb)loga and plogx = (loga)/(logb)logx.
We turn to the sum S :=
0i<k
a
i
g(x/b
i
) Dene x

as x/b
k
. Then x/b
i
= x

b
ki
and hence
S = a
k

0i<k
g(x

b
ki
)
a
ki
= x
p

1jk
g(x

b
j
)
a
j
= x
p

1jk
g(x

b
j
)
(b
p
)
j
==: x
p
S

where the second equality uses the substitution j =ki 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
j1
to x

b
j
. The
length of this integral is x

(b
j
b
j1
) = x

b
j
(11/b). Thus
g(x

b
j
)
(b
j
)
p
=
(x

)
p
g(x

b
j
)
(x

b
j
)
p
= (x

)
p
b
b1
_
x

b
j
x

b
j1
g(x

b
j
)
(x

b
j
)
p
(x

b
j
)
du = (x

)
p
b
b1
_
x

b
j
x

b
j1
g(x

b
j
)
(x

b
j
)
p+1
du .
With
h(u) :=
g(x

b
j
)
(x

b
j
)
p+1
for x

b
j1
< u x

b
j
, we have S

= (x

)
p
b
b1
_
x
x

h(u) du .
For x

b
j1
< u x

b
j
, we have
h(u)
g(u)/u
p+1
=
g(x

b
j
)
g(u)

(x

b
j
)
p+1
u
p+1
=(1) (1) =(1) .
For the rst fraction, this follows from the polynomial growth property of g, and for the second
fraction, this follows from the polynomial growth property of x
1+p
. Thus
S

= (x

)
p
b
b1
_
x
x

h(u) du =
_
_
x
x

g(u)
u
p+1
du
_
.
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 dened as a times the value of f at x/b. More
generally, we can dene f (x) as a linear combination of smaller values.
f (x) =
_
h(x) for 1 x x
0

k
i=1
a
i
f (
x
b
i
) +g(x) for x > x
0
(3)
where k is an integer constant and a
i
> 0 and b
i
> 1 are real constants. In order to make f well
dened, we require x
0
max
i
b
i
. Then 1 x/b
i
< x for all x x
0
and all i. We dene p as the
unique real number for which
i
a
i
(1/b
i
)
p
= 1.
Theorem 2 (Akra-Bazzi) Under the assumptions stated above,
f (x) =
_
x
p
_
1+
_
x
1
g(u)
u
p+1
du
__
.
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/(min
i
b
i
)
k
x
0
.
Exercise 2 Prove Theorem 2
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 Karatsubas algorithm, we reduced T
K
(n) to T
K
(n/2 +1). The following extension of
Theorem 2 deals with these variations. Consider
f (x) =
_
h(x) for 1 x x
0

k
i=1
a
i
f (
x
b
i
+h
i
(x)) +g(x) for x > x
0
(4)
where k is an integer constant and a
i
> 0 and b
i
> 1 are real constants. The h
i
are functions with
|h
i
(x)| x/(log
1+
x) for some > 0 and all x > x
0
. In order to make f well dened, we require
1 x/b
i
+h
i
(x) < x/b for all i and x > x
0
and some b > 1. As before, we dene p as the unique
real number for which
i
a
i
(1/b
i
)
p
= 1.
Theorem 3 (Leighton) Under the assumptions stated above and some more technical condi-
tions on x
0
(see [Lei])
f (x) =
_
x
p
_
1+
_
x
1
g(u)
u
p+1
du
__
.
Proof: See [Lei]
For the Karatsuba recurrence we would use k = 3, a
i
= 1, b
i
= 2 and h
i
(x) = x/2+1x/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):195210, 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.
5

Anda mungkin juga menyukai