1 9/8/2015 math 224 – discrete mathematics sequences and sums a sequence of the form ar 0, ar 1,...

14
1 07/18/22 MATH 224 – Discrete Mathematics n i i 1 n j j ar 0 Sequences and Sums A sequence of the form ar 0 , ar 1 , ar 2 , ar 3 , ar 4 , … , ar n , is called a geometric sequence and occurs quite often in computer science applications. Another common sequence is of the form a, 2a, 3a, 4a, … , na is called an arithmetic sequence. We have seen this when examining the number of steps executed by selection sort. In our example, the variable a was equal to 1, so we just had 1, 2, 3, … . N. Often we are interested in the sum of one of these sequences as in the arithmetic sum and the geometric sum. 2 ) 1 ( n n = r r a n 1 ) 1 ( 1 = Arithmetic Sum Geometric Sum (as long as r ≠ 1) What will be the formula for the geometric sum when a = 1. Compare this to the formula on Page 155 from our text. Are they equivalent?

Upload: timothy-melvyn-french

Post on 26-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

104/19/23

MATH 224 – Discrete Mathematics

n

i

i1

n

j

jar0

Sequences and Sums

A sequence of the form ar0, ar1, ar2, ar3, ar4, … , arn, is called a geometric sequence and occurs quite often in computer science applications. Another common sequence is of the form a, 2a, 3a, 4a, … , na is called an arithmetic sequence. We have seen this when examining the number of steps executed by selection sort. In our example, the variable a was equal to 1, so we just had 1, 2, 3, … . N. Often we are interested in the sum of one of these sequences as in the arithmetic sum and the geometric sum.

2)1( nn = r

ra n

1)1( 1

=

Arithmetic Sum Geometric Sum (as long as r ≠ 1)

What will be the formula for the geometric sum when a = 1. Compare this to the formula on Page 155 from our text. Are they equivalent?

Page 2: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

204/19/23

MATH 224 – Discrete Mathematics

)(1

n

i

iaf )(0

n

i

ifa

Basic Properties of Sums

=

n

ki

n

i

k

i

ififif11 1

)()()( From this equality it follows that )()()(1

1

1

nfififn

i

n

i

n

i

nbb1

n

j

nnnj1

2 6/)12)(1(

Page 3: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

304/19/23

MATH 224 – Discrete Mathematics

Mathematical Induction

Mathematical induction is a property of the integers and any well ordered set. It may be used to prove properties hold for an infinite set of values. For example, it may be used to prove something such as

Proofs by induction require two steps: the Basis Step and the Inductive Step. In addition, a proof of the inductive step, makes use of the an Inductive Hypothesis. All three of these elements will be required in your proofs.

n

j

jr0 r

r n

1)1( 1

= when r ≠ 1

Page 4: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

404/19/23

MATH 224 – Discrete MathematicsMathematical Induction

Induction allows us to prove properties that hold over the integers are some infinite subset of the integers. So for example it provides for a way to prove

that X3 – X is a multiple of 3 for all values of X ≥ 0. In this case, there is also a simple proof that doesn’t require induction. Induction can be illustrate by the problem of climbing a ladder. In order to climb a latter, you must be able to get to the first step and then from any step on the ladder to the next.The basis step requires that a property be true for the smallest value.

Basis: Can you reach the first step? Yes

Basis: Can you reach the first step? No

Page 5: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

504/19/23

MATH 224 – Discrete MathematicsMathematical Induction

The inductive step is the heart of an induction proof. Here you must show that from any step on the ladder you can reach the next step. The inductive hypothesis states in this case that you are on an arbitrary step of the ladder. In your proofs you will be expected to explicitly state the, basis, inductive hypothesis and the inductive step.

Inductive Step: Can you always reach the next step? Yes

Inductive Hypothesis: States you are on a step of the ladder.

Inductive Step: Can you always reach the next step? No

Inductive Hypothesis: States you are on a step of the ladder.

Page 6: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

604/19/23

MATH 224 – Discrete Mathematics

Mathematical Induction Basis Step

The Basis Step requires the proof of some property P(x0) for a starting value

x0. P(x) might involve an equation as in the summation above or it might be a

statements such as a C++ function sorts all input arrays from smallest to largest. So for example, the basis step might require one to prove that

Or it might require one to prove that a C++ function such as binary_search works correctly for a sorted array with just one element.

0

0j

jr1

1

1 10

r

r=

Page 7: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

704/19/23

MATH 224 – Discrete MathematicsMathematical Induction Inductive Step

The Inductive Step requires a proof that P(x) → P(x+1) for any x ≥ x0. To do

this you assume that the Inductive Hypothesis P(x) is true for some arbitrary value x ≥ x0. You are not assuming this for all x, but just for some x with no

restrictions. Note that x is greater than or equal to the starting value.

In your proofs, you must state the inductive hypothesis explicitly. So for example, in a proof of the geometric sum, the inductive hypothesis would be something like:

Assume that for some x ≥ 0 the following holds as long as r ≠ 1.

Note the word some. We are only assuming this for one value of x. Also be sure to note the x is set greater than or equal to the starting value. Both of these are critical for a correct proof.

x

j

jr0 r

r x

1)1( 1

=

Page 8: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

804/19/23

MATH 224 – Discrete Mathematics

k

j

jr0

n

j

jr0

Proof Using Induction

The following is a proof of the formula for the Geometric Sum using induction.

rr n

1)1( 1

=

Basis: (Sometimes called the base case.) Consider the sum when n = 0. Then the sum has only one term r0 =1. And the fraction on the right is just

(1–r)/(1–r) since n+1 = 1. Thus the equation is correct for the base case.

Inductive Hypothesis: Assume that for some k ≥ 0 the equation holds. In other words,

when r ≠ 1

rr k

1)1( 1

=

Page 9: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

904/19/23

MATH 224 – Discrete Mathematics

1

0

k

j

jr

r

rr

r

rrr

kkk

k

j

j

1

)1(

1

1 111

0

Proofs Using InductionIt is critical that the inductive hypothesis does not restrict the value of k. In other words it must be possible for k to take on the base value. Why would k > 0 be wrong for the Inductive Hypothesis in this proof?

Inductive Step: Consider the following sum : for some k ≥ 0. By algebra this sum may be written as

The right side of the equality follows from the inductive hypothesis. Why?

Then adding the two fractions and simplifying yields the fraction:

And from this we may conclude that the original equation is correct by induction. If we substitute k+1 for n, what does the original equation give?

r

rk

1

1 2

Page 10: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

1004/19/23

MATH 224 – Discrete Mathematics

n

j

jn

j

jn

j

j rrrr0

1

00)1(

n

j

jr0

Proof for the Geometric Sum without Using Induction

The following is a proof of the formula for the Geometric Sum without using induction.

rr n

1)1( 1

=

Consider

11322 1)...(...1 nnn rrrrrrrr

How do we get the expression on the right?

Then dividing the left and right sides by 1 – r we get the final result.

What is wrong with dividing by 1 – r if r = 1?

when r ≠ 1

Page 11: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

1104/19/23

MATH 224 – Discrete MathematicsProof for the Arithmetic Sum without Using Induction

The following is a proof of the formula for the Arithmetic Sum without using induction.

Consider the sum 1 + 2 +3 + … (n−3) + (n−2) + (n−1) + n. Then note when we add the first and the last pair, the second and second from the last etc., each sum equals n + 1.

If n is even, there are n/2 of these pairs. Thus if all the pairs are added we have the sum is n(n+1)/2.

If n is odd, there are (n−1)/2 of these pairs plus the middle term which is (n+1)/2. Adding these together yields

(n+1)(n−1)/2 + (n+1)/2 = (n+1)(n−1 +1)/2 = (n+1)n/2.

n

i

i1 2

)1( nn =

Page 12: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

1204/19/23

MATH 224 – Discrete MathematicsProof that all Horses are the Same Color

Basis: With just one horse of course they are all the same color.

Inductive Hypothesis: Assume that for some k>1 all of the k horses are the same color.

Inductive step: Consider the figure below.

k+1 horses

k horsesk+1st horse

Page 13: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

1304/19/23

MATH 224 – Discrete MathematicsProof that all Horses are the Same Color

Now remove one of the horses from the group of k.

Then there are k horses in the corral. By the inductive hypothesis they must all be the same color

k─1 horseskth horse

Page 14: 1 9/8/2015 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence

1404/19/23

MATH 224 – Discrete MathematicsProof that all Horses are the Same Color

Now put the horse you removed back in.

Then there are k+1 horses in the corral. And since it was part of the group of k, it must be the same color as the rest of them. Hence all k+1 of them are the same color.

k─1 horseskth horse