Cmsc 180 Discrete Mathematics

Total Page:16

File Type:pdf, Size:1020Kb

Cmsc 180 Discrete Mathematics

CmSc 180 Discrete Mathematics Homework 08, due 04/03

Part 1: Problems

Prove by Mathematical Induction 1. 12 + 32 + 52 + …. + (2n-1) 2 = n(2n+1)(2n-1)/3, n ≥1 2. 1*2 + 2*3 + 3*4 + …. + n(n+1) = n(n+1)(n+2)/3

Part 2: Programming

Write a program that reads a relation R on a set A as a sequence of pairs of natural numbers, represents the relation as a matrix and a) finds the composition R o R and prints it as a set of pairs b) determines whether R is transitive or not transitive

The input to the program should be number of elements in A, number of pairs in R list of pairs, entered one by one, each pair on a separate line

The output should be - matrix representation of the relation - a statement about the transitivity of the relation - the composition R * R as a set of pairs - matrix representation of R * R

Sample transcript of program run: (underlined text is user input)

This program reads a relation on a finite set of natural numbers and determines the reflexivity and the symmetry of the relation

Please enter the number of the elements in the set: 4 Please enter the number of pairs in the relation: 4 Please enter the pairs, each pair on a separate line 1 2 1 3 1 4 2 3

Matrix representation: 1 2 3 4 1 0 1 1 1 2 0 0 1 0 3 0 0 0 0 4 0 0 0 0

1 The relation is transitive.

Composition R * R: {(1,3)}

Matrix representation of R * R: 1 2 3 4 1 0 0 1 0 2 0 0 0 0 3 0 0 0 0 4 0 0 0 0

Turn in the problems in Part 1 as a Word document, and the source code of your Java program sent as e-mail attachments

2

Recommended publications