Dma 3 Notes
Dma 3 Notes
1 Sequences
We will think of a sequence as an infinite, linearly ordered collection of
numbers. An example would be
1, 4, 9, 16, 25, 36, 49, 64, 81, 100, . . . (1)
or
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, . . . (2)
We will often use the notation (an ) to describe the elements of a sequence
and refer to an as the n’th element of the sequence. The number n is an
index and we often start a sequence at index 0 or 1.
We can succinctly specify a sequence via a function f that is defined on,
say, the positive integers {1, 2, 3, 4 . . . }. In that case, we can write an explicit
expression for a sequence by setting
an = f (n).
For example, the sequence in (1) is defined by the function f (x) = x2 and
we would write the sequence as
bn = n2 for n ≥ 1.
In a similar way, we can explicitly specify sequence (2) as follows:
jnk
cn = n − 2 for n ≥ 0.
2
We can also define sequences recursively. A recursive definition works
by explicitly specifying some of the first elements in a sequence and then
defining the rest by referring back to previous elements one or more indices
away. One example would be to define
c0 = 0
c1 = 1
cn = cn−2 for n ≥ 2
The above recovers the sequence (2) since we can use the rule cn = cn−2 to
convince ourselves that c2 must be equal to c0 = 0 and that c3 must be equal
to c1 = 1 etc.
1
Example 1. We define a sequence fn by setting f0 = 1 and
fn = nfn−1 for n ≥ 1.
sn0 = an0
sn = sn−1 + an for n > n0
to define a series.
A summation formula is the explicit expression of a series.
1, 2, 3, 4, 5, 6, 7, 8, 9, . . .
2
Theorem 3.
n
X n2 + n
k =
k=1
2
n
X
2 2n3 + 3n2 + n
k =
k=1
6
n
X cn+1 − c
ck =
k=1
c−1
When c = 1 in the last summation formula, one can use formula from (3)
instead.
As we will discover in the exercises, one can often go a long way by
combing the four summation formulas above with the general sum rules:
Theorem 4.
n
X n
X n
X
(ak + bk ) = ak + bk
k=1 k=1 k=1
n
X Xn
cak = c ak
k=1 k=1
Xn m−1
X n
X
ak = ak + ak
k=1 k=1 k=m
f (x) = xa
3
• An exponential function is of the form
f (x) = bx
where the base b > 1 is a constant. The expression is well-defined for all
x > 0. Logarithmic functions are the inverse functions of exponential
functions with the same base. Thus,
bx = y ⇐⇒ logb (y) = x
• Floor is the function bxc, which rounds a real number x to the largest
integer less than or equal to x. Thus,
1 1
=0 − = −1 bπc = 3 b7c = 7
2 2
We can define the ceiling function in a similar way; dxe is the smallest
integer larger than or equal to x.
4
Figure 1: Graphs of bxc and |x|
bxc = n ⇐⇒ n ≤ x < n + 1
and
dxe = n ⇐⇒ n − 1 < x ≤ n.
5
Figure 2: The graph of blog2 xc.
We will also apply the above definition for functions that are defined on
some subset of the positive reals. A common choice of such a subset will be
positive integers Z+ or natural numbers N.
6
• We say that f (x) is Θ(g(x)) if f is O(g(x)) and g(x) is O(f (x)). Think
of this as “g and f grow at the same rate asymptotically”.
• We say that f (x) is o(g(x)) if for any constant c > 0 we can find x0
such that
f (x) < cg(x)
for all x ≥ x0 . Think of this as “g grows (strictly) faster than f
asymptotically”.
One can use the definition of big-O to show that big-Θ can equivalently
be defined in the following manner.
for all x ≥ x0 .
One must be careful and only use the above analogy to build intuition as
some properties that hold for comparison of numbers do not carry over for
functions. For instance, if a and b are numbers, then we have that a ≤ b or
b ≤ a. For functions, however, we can have a situation where f is not O(g)
and g is not O(f ). Can you think of such an example?
Both little-o and big-O give upper bounds. Intuitively, little-o gives a
strict upper bound while big-O gives an upper bound that is potentially not
strict. More formally, we have the following.
7
3.2 Collection of rules
Theorem 11. Let f, g, h, p : R+ → R be asymptotically positive functions.
Example 12. Let us use the above rules to show that 2x + x grows asymp-
totically faster than 3x2 + 5x (i.e. 3x2 + 5x is o(2x + x)).
(1) First, use (R2) to conclude that 3x2 + 5x and x2 grow at the same
rate asymptotically (i.e. 3x2 + 5x is Θ(x2 )).
(2) Use (R6) observe that 2x grows faster x2 (i.e. x2 is o(2x )).
(3) Combine1 the bold statements from (1) and (2), to conclude that 2x
grows faster than 3x2 + 5x (i.e. 3x2 + 5x is o(2x )).
1
Note that even though we don’t have a formal rule saying this, we are using the fact
that if f1 grows faster than f2 which grows at the same rate as f3 then f1 grows faster
than f3 . The formal statement is that if f2 is o(f1 ) and f2 is Θ(f3 ) then f3 is o(f1 ).
8
(4) Use (R6) again to observe that 2x grows faster than x (i.e. x is o(2x ))).
By (R3), we can now say that 2x + x grows at the same rate as 2x
(i.e. 2x + x is Θ(2x )).
(5) Finally, combine the bold statements from (3) and (4), to get that 2x +x
grows faster than 3x2 + 5x asymptotically (i.e. 3x2 + 5x is o(2x + x)).