theoretical models computing book

121
Theoretical Models in Computing and Applications Nguyen V.M. Man, Ph.D. in Statistics 15th September 2011 Email: [email protected] or [email protected]

Upload: le-thanh

Post on 20-Feb-2015

162 views

Category:

Documents


3 download

TRANSCRIPT

Theoretical Models inComputing and ApplicationsNguyen V.M. Man,Ph.D. in Statistics15th September 2011Email: [email protected] [email protected] Basic Logic 51.1 Propositional logic . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.1.1 Theory- Content of Propositional Logic . . . . . . . . . . . 61.1.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.1.3 Problems- Solving Hints . . . . . . . . . . . . . . . . . . . . 141.1.4 Practical projects (Optional) . . . . . . . . . . . . . . . . . 141.2 Predicate logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171.2.1 What topics will we learn? . . . . . . . . . . . . . . . . . . 171.2.2 Problems- Solving Hints . . . . . . . . . . . . . . . . . . . . 212 Set Theory 232.1 Sets- Ways of describing things . . . . . . . . . . . . . . . . . . . . 232.1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.1.2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.1.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.1.4 Key Mathematical Symbols . . . . . . . . . . . . . . . . . . 252.2 Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.2.1 Equivalence Relation . . . . . . . . . . . . . . . . . . . . . . 262.2.2 Partial orders . . . . . . . . . . . . . . . . . . . . . . . . . . 272.2.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.2.4 Problems- Solving Hints . . . . . . . . . . . . . . . . . . . . 272.2.5 Practical projects (Optional) . . . . . . . . . . . . . . . . . 282.3 Functions- Ways of tranforming things . . . . . . . . . . . . . . . . 292.3.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.3.2 Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.3.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302.3.4 Problems- Solving Hints . . . . . . . . . . . . . . . . . . . . 302.3.5 Practical projects (Optional) . . . . . . . . . . . . . . . . . 312.4 Integers and Algorithms on Integers . . . . . . . . . . . . . . . . . 322.4.1 Review- Motivation . . . . . . . . . . . . . . . . . . . . . . 322.4.2 Introduction to Algorithms . . . . . . . . . . . . . . . . . . 332.4.3 Basic Integer Theory . . . . . . . . . . . . . . . . . . . . . . 3334 CONTENTS2.4.4 Application of Integers in Cryptology . . . . . . . . . . . . 362.4.5 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382.4.6 Problems- Solving Hints . . . . . . . . . . . . . . . . . . . . 382.4.7 Practical projects (Optional) . . . . . . . . . . . . . . . . . 383 Counting Techniques. 393.1 Basic counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.1.2 Theory on Countability . . . . . . . . . . . . . . . . . . . . 403.1.3 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413.2 Problems- Solving Hints . . . . . . . . . . . . . . . . . . . . . . . . 413.2.1 Basic problems . . . . . . . . . . . . . . . . . . . . . . . . . 413.2.2 Practical projects (Optional) . . . . . . . . . . . . . . . . . 424 Induction and Recursion 454.1 Inductively Dened Sets . . . . . . . . . . . . . . . . . . . . . . . . 454.1.1 How to do? . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.1.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.2 Recursively Dened Functions and Procedures . . . . . . . . . . . 464.3 Inductive Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.4 Problems- Solving Hints . . . . . . . . . . . . . . . . . . . . . . . . 485 Graph Theory and Models 515.1 Undirected Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . 515.1.1 Basic concepts and basic operations . . . . . . . . . . . . . 515.1.2 Simple Graphs and Connectivity . . . . . . . . . . . . . . . 535.1.3 Bipartite Graph . . . . . . . . . . . . . . . . . . . . . . . . 575.1.4 Graph Isomorphism . . . . . . . . . . . . . . . . . . . . . . 585.2 Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595.2.1 Binary Trees . . . . . . . . . . . . . . . . . . . . . . . . . . 605.2.2 Spanning Trees . . . . . . . . . . . . . . . . . . . . . . . . . 615.3 Digraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625.3.1 Path Problem in Directed Graphs . . . . . . . . . . . . . . 625.3.2 Directed Graphs- The reachability matrix M . . . . . . . . 635.4 Problems- Solving Hints . . . . . . . . . . . . . . . . . . . . . . . . 655.4.1 Problem 1: Basic concepts and operations . . . . . . . . . . 655.4.2 Problem 2: Representations of Graph Connectivity . . . . 655.4.3 Problem 3: Isomorphism Graph Invariants . . . . . . . . . 675.4.4 Problem 4: Bipartite graphs . . . . . . . . . . . . . . . . . . 695.4.5 Problem 5: Directed graphs . . . . . . . . . . . . . . . . . . 705.4.6 Problem 6: Trees . . . . . . . . . . . . . . . . . . . . . . . . 725.5 Algorithms on Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 735.5.1 Shortest paths and Dijkstra Algorithm . . . . . . . . . . . . 73CONTENTS 15.5.2 Max-ow Min-cut algorithm by Ford-Fulkerson . . . . . . . 796 Algebraic Model and Polynomial Equations 816.1 Linear polynomial equations . . . . . . . . . . . . . . . . . . . . . . 816.1.1 Gauss Elimination - Contents . . . . . . . . . . . . . . . . . 826.1.2 Gauss Elimination- Technique . . . . . . . . . . . . . . . . . 876.1.3 Matlab section . . . . . . . . . . . . . . . . . . . . . . . . . 896.1.4 Practical projects (Optional) . . . . . . . . . . . . . . . . . 916.2 Symbolic computation for nding roots of nonlinear equations . . . 916.3 Algebraic Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . 936.3.1 In Industrial Statistics . . . . . . . . . . . . . . . . . . . . . 936.3.2 In Business Intelligence . . . . . . . . . . . . . . . . . . . . 997 Probabilistic Models 1017.1 Practical Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . 1017.2 Concepts and Definitions . . . . . . . . . . . . . . . . . . . . . . . 1037.2.1 Random Variable and Probability Distribution . . . . . . . 1047.2.2 Why study Probability Distributions? . . . . . . . . . . . . 1067.3 Discrete Probability Distributions . . . . . . . . . . . . . . . . . . . 1077.4 Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1102 CONTENTSIntroductionThis course provides a challenging introduction to some of the central ideas ofTheoretical Computer Science. It attempts to present a vision of computerscience beyond computers: that is, CS as a set of mathematical tools forunderstanding complex systems such as universes and minds.A. COURSE OVERVIEW: No. of Credits: 41. Course Objective: To provide undergraduate students with mathematicalreasoning, combinatorial analysis, and algorithmic thinking and modeling.2. Prerequisite: None3. Major Contents: Logic, Set, Algorithms, Mathematical Reasoning, Induction,and Recursion, Counting, Graph Models and Algorithms on Graphs, Roots ofPolynomial Equations.4. Assessment:Assignments and Class Attendance: 30%Midterm Test: 20%; Final Exam: 50%5. Documents:Main lecture note: yesReferences:a/ DISCRETE MATHEMATICS, Norman L. BIGGS, Oxford University Press,Second Edition, 2009.b/ ELEMENTARY METHODS IN NUMBER THEORY, Melvyn B.Nathanson, Springer 2000B. COURSE STRUCTUREPart I: Discrete Structures, including logic, sets, counting techniques.Part II provides Graph Models, together relavant structures.Part III: (Chapter 7) Algebraic methods and modeling for nding rootsof equations, both linear and nonlinear equations.Part IV (Chapter 8) Advanced: Probabilistic Modeling. How to dealwith uncertainty in daily life?34 CONTENTSC. Key remarks and Philosophy of LearningI/ This subject covers many mathematical topics that are essential in ComputerScience but are not covered in the standard calculus curriculum. In addition,the subject teaches students about careful mathematics:- precisely stating assertions about well-dened mathematical objects and- verifying these assertions using mathematically sound proofs.II/ Students are encouraged to collaborate on problem sets (counting for 30% ofthe nal grade) as on teams in class. Study groups can be a big help inmastering course material, besides being fun and a good way to make friends.However, students must write up solutions on their own,neither copying solutions nor providing solutions to be copied.The last page of each problem set has a collaboration statement to becompleted and attached as the rst page of a problem set submission: I worked alone and only with course materialsor I collaborated on this assignment with (students in class).III/ Philosophy1. Amount learned is proportional to time put in.2. Best way to learn: to gure out ideas yourself or teach them to someone else.3. Second best: to do so with hints from others (friends or us).4. Third best: to get the ideas from reading; but pause in your reading tothink about them.5. The object of a lecture: not so much to inform you of important facts, butrather to stimulate you to try to learn about new concepts.6. The object of the course: to empower you to use the concepts of DiscreteMathematics and Theoretical Computation in any context.Chapter 1Basic LogicWe study logic from the mathematical point of view. This introductory chapteris about mathematical logic, covers two key topics:1. Propositions Propositional logic2. Predicate logicWe begin the course by looking at examples involving everyday Englishsentences. This is followed by an introduction to the more formal mathematicalapproach used in propositional and predicate logic.1.1 Propositional logicMotivationThe fundamental objects we work with in arithmetic are numbers. In a similarway, the fundamental objects in logic are propositions. Here are some examplesof English sentences that are propositions: Canberra is the capital of Australia. There are 8 days in a week. Isaac Newton was born in 1642. 5 is greater than 7. Every even number greater than 2 can be expressed as the sum of twoprime numbers.Propositions truth values. The rst and third of these propositions are true,and the second and fourth are false. It is not known at present whether thefth proposition is true or false.56 CHAPTER 1. BASIC LOGICThe following sentences are not propositions:Where are you going?Come here!How about these?Anne is tall.Ice cream is delicious.x > 5.The last of the three sentences given above is an example of a predicate.1.1.1 Theory- Content of Propositional Logic Propositions- Connectives and truth tables Compound propositions- Writing compound propositions Tautology Contradiction Logical equivalence Decomposing complicated proposition Provable equivalence- Rule of InferenceDenition 1. A proposition is a statement that is either true or false.Whichever of these (true or false) is the case is called the truth value of theproposition.a/ Connectives and truth tablesLogic is not concerned with determining the truth values of propositions of thekind we have seen so far.E.g. the truth value of Canberra is the capital of Australiais a question of geography, not logic. The next example is dierent, however:If Brian and Angela are not both happy, then either Brian is not happy orAngela is not happy.The sentence about Brian and Angela is an example of a compound proposition.It is built up from the atomic propositions Brian is happy, and Angela is happyusing the words and, or, not (also written ) and if-then. These words areknown as connectives. As we will see, the role of connectives in logic isanalogous to the role played by operations such as + and in algebra.1.1. PROPOSITIONAL LOGIC 7The study of the structure of compound propositions is made easier by the useof symbols for atomic propositions and connectives. We will use lower-case letters such as p, q and r to denote atomicpropositions. There are ve connectives that we will use in our work; they arelisted in Table 1.1.1, together with their symbols.Connective Symboland or not if-then if-and-only-if Table 1.1: Connectives and associated symbolsThe propositional connectives are: negation ( ), conjunction disjunction implication or biimplication They are read as not, and, or, if-then, if and only if respectively.The connectives , , , are designated as binary,while is designated as unary. r: the negation of r p q: the conjunction of p and q p q: ? p q or p q: the implication of q by p c d: logical equivalence8 CHAPTER 1. BASIC LOGICConventionsLet p, q be arbitrary statements. We notationally distinguish few cases: The relationship between and p q: the implication of q by p, or p implies qp q: logical implication, p logically implies q.We understand that:if p q is a tautology, then we sayp logically implies q, and write p q. The relationship between and p q: bi-implication of p and q, p if and only if qp q: logical equivalence, p is logically equivalent to qWe understand that:if p q is a tautology, then we sayp is logically equivalent to q, and write p q.b/ Compound propositionsWith the exception of not, the symbols for these connectives are writtenbetween the two operands (the propositions they connect).For example, ifp denotes the proposition Today is Monday, andq denotes the proposition It is raining,then we can write the symbol p, p or not p before the proposition to which it applies; thus,p means Today is not Monday. the symbol p q to denote the propositionToday is Monday and it is raining.Table 1.1.1 shows how to form the true value of p qCan we form compound propositions p q, p q similarly?1.1. PROPOSITIONAL LOGIC 9p q p qT T TT F FF T FF F FTable 1.2: Connective and Notice that each column is obtained using the truth table for the principalconnective in the expression at the top of the column. If an expression contains three variables (p, q and r, say), then the tablewill have eight lines instead of four (there are 23= 8 dierent ways ofallocating truth values to three expressions), but the method is the same.Writing compound propositions in symbolic formWe now have the notation we need in order to be able to write compoundpropositions in symbolic form. Express the proposition, e.g.Either my program runs and it contains no bugs, or my program containsbugs in symbolic form.c/ Tautology ContradictionDenition 2. You should know two following basic concepts to make rightreasoning.- An expression that is always true, regardless of the truth values of thevariables it contains, is called a tautology.- An expression that is always false, regardless of the truth values of thevariables it contains, is called a contradiction. Mathematically contradictionsare expressions of the form or where is any proposition (simple or compound).Below examples shows how these concepts are used.10 CHAPTER 1. BASIC LOGIC1.1.2 ExamplesExample 1. Express the propositionEither my program runs and it contains no bugs,or my program contains bugs in symbolic form.Example 2. Construct the truth table for the expression (p q) q.Example 3. Now look again at the proposition we introduced at the beginningof this sectionIf Brian and Angela are not both happy,then either Brian is not happy or Angela is not happya/ Write this compound proposition in symbolic form andb/ provide its truth table.d/ Logical equivalenceDenition 3. Two expressions (composed of the same variables) are logicallyequivalent if they have the same truth values for every combination of the truthvalues of the variables.Informally, we could say that two expressions are logically equivalent if theyyield the same truth table. Formally,A(p, q, r, ...) is logically equivalent to B(p, q, r, ...), writeA(p, q, r, ...) B(p, q, r, ...) if we haveA(p, q, ...) = B(p, q, ...) for every choice of boolean values of p, q, ...Logical equivalence and connective if-and-only-ifThere is a subtle but important distinction between the connective if-and-only-if or and the concept of logical equivalence .1.1. PROPOSITIONAL LOGIC 11When we write A B, we are writing a single logical expression.(A B) (B A).Logical equivalence, A B, on the other hand, is a relationship between twological expressions A and B. The connection of the two concepts is:A and B are logically equivalentif and only if the expression A B is a tautology.e/ Converse and ContrapositiveDenition 4. We have Expressions of the form p q are called implications. The converse of p q is q p The contrapositive of p q is q pExample 4. Write down English sentences for the converse and thecontrapositive of:If 250 is divisible by 4 then 250 is an even number.Quiz 1. (5 min) Prove thatp q is not logically equivalent to its converse, but that it is logicallyequivalent to its contrapositive. That isp q q pf/ Conditionals A BGiven that if A then B (or A implies B= A B) is a conditionalstatement with hypothesis A and conclusion B.Denition 5. Its contrapositive is: if not B then not A andits converse is: if B then A.Since statements with the same truth table are said to be equivalent; the tableshows that a conditional and its contrapositive are equivalent, we writeif A then B = if not B then not A12 CHAPTER 1. BASIC LOGICProof Techniques for P = Q. To prove a generic proposition P = Q, youcould use one of the following methods: a direct argument or Conditional Proof:to carry out the implication P = Q directly, know P is true. a contrapositive argument: to use the identityP = Q Q = P(Prove this equality!) a contradiction argument means that, provided P is true,we assume Q is false and try to derive a contradictionP Q = falseProof By ContradictionA false statement is called a contradiction.For example, S and not S is a contradiction for any statement S.A truth table will show us thatif A then B, is equivalent to [ A and (not B) ] implies false.or in mathematical symbolsA B [(A notB) false]So to prove if A then B, it suces to assume A and also to assume not B, and then to argue toward a false statement.This technique is called proof by contradiction.1.1. PROPOSITIONAL LOGIC 13g/ Decomposing complicated propositionWe began this section with an example of a complicated proposition that weshowed to be logically equivalent to a simpler one.Occasions often arise in practice where it is desirable to replace a logicalexpression with a simpler expression that is logically equivalent to it.For example, we have seen how logical expressions representing propositions canoccur in algorithms and computer programs. By writing these expressions assimply as possible, we can make a program more ecient and reduce thechance of error.How do we do?In order to be able to simplify logical expressions eectively, we need toestablish a list of pairs of expressions that are logically equivalent.We will use the symbol or placed between two expressions to indicate thatthey are equivalent. A statement of the formP QorP Qwhere P and Q are logical expressions is called a law of logic.A list of the most important laws of logic is given as follows.De Morgan (p q) p qContrapositive p q q pEquivalence law p q (p q) (q p)Implication law p q p qDouble negation law (p) pIdempotent laws p p pp p pTable 1.3: Most important logic laws14 CHAPTER 1. BASIC LOGIC1.1.3 Problems- Solving Hints1. Using important laws to simplify logical expressionsQuiz a. (10 min) Use the laws of logic to simplify the expression:p (p q)Quiz b. (10 min)An algorithm contains the following line:If not (x > 5 and x 10) then...How could this be written more simply?2. Determine whether the following argument is valid:The le is either a binary le or a text le. If it is a binary le then myprogram wont accept it. My program will accept the le. Therefore the leis a text le.3. Prove thata/ (p q) (p q) pb/ p q p q1.1.4 Practical projects (Optional)Rules of inference. Consider an implication of the form1, 2, . . . , n Valid arguments. This implication is understood as1 2 . . . n When all the premises 1, 2, . . . , n have true value T, and nd that underthese circumtances also has the value T, then the implication1 2 . . . n is tautology, and we have a valid argument.1.1. PROPOSITIONAL LOGIC 15Usages of Rules of inference. Rules of inference1. enable us to consider only the cases wherein all the premises 1, 2, . . . , nare true;2. used in the development of step-by-step validation of how the conclusion logically follows from the premises 1, 2, . . . , n in the implication of theform1, 2, . . . , n A few well known valid arguments are summaried next.I: Rule of Modus Ponensp (p q) qModus Ponens is also called the Rule of Detachment.Quiz : Can you check p (p q) q is a valid argument?In the tabular form:pp q qwhere the stands for therefore, indicating that q is the conclusion of twopremises p and p q above the line.Example 5. Consider the following statements.1/ Barack Obama is a human being.2/ If x is a human being then x will die.3/ Barack Obama will die.II: Rule of Syllogism(p q) (q r) (p r)where p, q and r are any statement. In the tabular form, it is writtenp qq r p r16 CHAPTER 1. BASIC LOGICIII: Rule of Modus TollensIn the tabular form:p qq pModus Tollens is a method of denying.Quiz: Use Modus Tollens to prove the follwing schemep rr st st uu pfor any propositions p, r, s, t, uIV: Rule of Disjunctive Syllogism[(p q) p] qThis can be derived from Modus Ponens and the logical equivalencep q p qorp q p qIn the tabular form:p qp qThis rule of inference arises when there are exactly two possibilities to consider,and we are able to elliminate one of them as being true, i.e. it is false. Then theother possibility must be true.1.2. PREDICATE LOGIC 17V: Rule of ContradictionDenote F0 to be a contradiction. You can prove that(p F0) pis a tautology! This called the Rule of Contradiction, written as:p F0 pThe Rule of Contradiction is a key method of establishing the validity of anargument, the method Proof by Contradiction.Moreover we can employ this to the case when we wish to prove(p1 p2 . . . pn) qthen we can form the validity of the argument(p1 p2 . . . pn) q F0WHY?1.2 Predicate logic1.2.1 What topics will we learn? A: Predicate logic- concepts of predicate B: Quantifying a Predicate C: Quantifying a Predicate- two propositions D (*): Negating a predicate with many variables and quantiersA. Propositions versus predicateDenition 6. A predicate is a statement containing one or more variables; itcannot be assigned a truth value until the values of the variables are specied.We will investigate predicate logic later.Statements containing variables commonly occur in algorithms and computerprograms.For example, an algorithm might contain the statement x > 5. as the conditionin a control structure such as an If-then.18 CHAPTER 1. BASIC LOGICIn this case, however, the truth value of the statement is determined when theline is executed while the program is being run with a particular set of inputs,so statements of this type can be treated as propositions.We now introduce a notation that will allow us to write predicates andquantiers symbolically. We will use capital letters to denote predicates. A predicate P containing a variable x can be symbolically written as P(x). A predicate can contain more than one variable; a predicate P with twovariables, x and y for example, can be written P(x, y). In general, a predicate with n variables, x1, x2, . . . , xn, can be writtenP(x1, x2, . . . , xn). Predicates are often named with a letter. Furthermore, a functionlikenotation is used to denote a predicate supplied with specic variablevalues.Example 6. n is a perfect squareis a predicate whose truth depends on the value of n.The predicate is true for n = 4 since 4 is a prefect square [4 = 22],but false for n = 5 since 5 is not a perfect square [no x Z : 5 = x2].A functionlike notation is used to denote a predicate, e.g. we might name ourearlier predicate P :P(n) = n is a perfect squareNow P(4) is true, and P(5) is false.B/ Quantiers- Quantifying a PredicateThere are a couple kinds of assertion one commonly makes about a predicate:that it is sometimes true and that it is always true. For example, the predicateExample 7. x2 0 is always true when x is a real number. On the otherhand, the predicate 5x27 = 0 is only sometimes true; specically, when x =?.There are several ways to express the notions of always true and sometimes true1.2. PREDICATE LOGIC 19in English. The tables below give some general formats on the left and specicexamples using those formats on the right.Always True we use symbol Example(L1) For all n, P(n) is true. For all x, x2 0. n, P(n) is trueor P(n) is true for every n x2 0 for every xSometimes True we use symbol (L2) There exists an n such that There exists an xP(n) is true. such that 5x27 = 0n: P(n) is true The expressions for all and there exists are called quantiers. The process of applying a quantier to a variable is called quantifying thevariable.(L1) For all n, P(n) is truecan be reduced ton, P(n)(L2) There exists an n such that P(n) is truecan be reduced ton, P(n)Quiz. (1 min)Write in symbols: There exists an x R such that x < 4.C/ Quantifying a Predicate- two propositionsFor two predicates (i.e. open statements) p(x), q(x) dened for a prescribeduniverse U, consider the universally quantied statementx U [ p(x) q(x) ]20 CHAPTER 1. BASIC LOGICor in shortx[ p(x) q(x) ].We haveDenition 7. if the implication p(a) q(a) is true for each a in the universeU then we say that p(x) logically implies q(x), and can writex[ p(x) q(x) ].We similarly dene the logically equivalent statementx U [ p(x) q(x) ].D. Practicce: Negating a predicate with many variables andquantiersWe can see that forming the negation corresponds to negating the predicateand changing the quantier. We can express this observation as a law ofpredicate logic:Rules for negating a predicate.Rule 1 : [ xP(x) ] x[ P(x) ]There is a second law, be seen of as the dual of the rst, for negating aproposition containing there exists. It also corresponds to negating thepredicate and changing the quantier:Rule 2 : [ xP(x) ] x[ P(x) ]Practice 1: we want to apply the connective not to the following proposition:All swans are black.Applying not to a proposition is called negating the proposition.Hint: The original proposition can be written in symbols:x, P(x)where P(x) is the predicate Swan x is black.Suggested Solutions:1.2. PREDICATE LOGIC 21- Here is one way of forming the negation:It is not true that all swans are black.- Or, more simply:Not all swans are black. There is a swan that is not black.Practice 2: Write down the negation of the following proposition:For every number x there is a number y such that y < x.SummaryRule 1 : [ xP(x) ] x[ P(x) ]Rule 2 : [ xP(x) ] x[ P(x) ]Rule 3 : [ xy P(x, y) ] xy [ P(x, y) ]Rule 4 : [ x(P(x) Q(x)) ] x[ P(x) Q(x) ]1.2.2 Problems- Solving HintsI) Quantiers with many variablesA variable which has been quantied is said to be bound. A variable thatappears in a predicate but is not bound is said to be free.Mixing Quantiers. Many mathematical statements involve severalquantiers.Example 8. Write the following two propositions in symbols: For every number x there is a number y such that y = x + 1. There is a number y such that, for every number x, y = x + 1.Can you symbolize the statement in two ways:Every American has a dream.Hint: let A be the set of Americans, let D be the set of dreams, and dene thepredicateH(a, d) to be American a has dream d..II) Predicate with many variables.22 CHAPTER 1. BASIC LOGICIn the specication of a system for booking theatre seats, B(p, s) denotes thepredicate person p has booked seat s. Write the following sentences insymbolic form:1. Seat s has been booked.2. Person p has booked a (that is, at least one) seat.3. All the seats are booked.4. No seat is booked by more than one person.III) If And Only If (I) ProofsA statement of the form A if and only if (i) B meansA implies B and B implies A or in mathematical symbols(A B) (B A) = (A B)So there are actually two proofs to give.The proofs can also be written as a single proof of the form A i C i D i i B, where each i statement is clear from previous information. Practice 1: x is even if and only if x22x + 1 is odd. Practice 2: x2is odd if and only if x is odd.IV) Symbolically proof.Consider the following statements Nguyen is playing a game. If Nguyen is playing a game then he is not solving his home works. If Nguyen is not solving his home works then his father will not buy him amotorbike.Can you prove thatTherefore, Nguyens father will not buy him a motorbike.symbolically?Chapter 2Set Theory2.1 Sets- Ways of describing things2.1.1 MotivationHow could you write or represent all national soccer teams s taking part worldsoccer matches in South Africa in the year 2010?2.1.2 ConceptsA Set is a collection of some things. Set is a fundamental notion.For instance,1/ set A = {shirt, pull}, set B = {jean, trouser, sport}.set of naturals N = {1, 2, 3, . . .},We write shirt A, trouser B, but must write trouser N!2/ For ex., to the example of world soccer matches in South Africa writeS = {s : a property P(s) is fullled, that s satises}where P(s) = national soccer teams s taking part matches in South Africa.Notation. If S is a set and x is a member or element of S we write x S. Othewisewe write x S. The set with elements x1, , xn is denoted {x1, , xn}. The empty set with no elements is denoted {} or . A set with one element is called a singleton. e.g., {a} is a singleton.2324 CHAPTER 2. SET THEORY A sequence u, an ordered set made by elements a, b, c..., is written byu = (a, b, c, . . .), e.g. u = (s1, s2, . . . , s80) is a sequence. If an ordered set has only two elements it is called a pair.Example 1: a daily outt (pull, jean) is such a pair. A sequence is not a set, although they are made from the same elements.Example 2: Hence, the sequence(An, Binh, Cuong) = {An, Binh, Cuong}, which is a set.Operation on Sets.Forming new set from two sets intersectionThe intersection E F, of sets E and F, consists of their common elements:E F = {x : x E and x F}Forming new set from two sets Cartesian productThe Cartesian product of two sets A and B, denoted by AB, consists of allpairs (a, b) where a A and b B.Set equality and subsets Subsets. The set A is a subset of B, denoted A B, means every elementof A is an element of B, i.e. [ for all s, if s A then s B ] The power set of a set S, denoted power(S) or P(S) is the set of allsubsets of S. Two sets A, B are equal, denoted A = B if they have the same elements.2.1.3 ExamplesExample 0/ Well-known number sets arethe natural numbers {0, 1, } by N, the set of integers is denoted by Z,the rational numbers by Q, and the real numbers by R.Q =_mn : m, n Z, n = 0_1/ Could you nd the intersection E F whenE = [1; 4] := {x R : 1 x 4},2.1. SETS- WAYS OF DESCRIBING THINGS 25i) F = [2; 6),ii) F = (0; 10), andiii) F = [0; )?2/ List all members (elements) of AB if given A = {shirt, pull},B = {jean, trouser, sport}3/ Quiz. Determine the set P(X) P(Y ) if you knowX = {a, b, 1} and Y = {u, a, b},where P(S) is the set consisting all subsets of S.2.1.4 Key Mathematical SymbolsSYMBOL MEANING Note Belong to relation Not belong to relation imply; it follows that logic operator Implied by logic operator Equivalent to; if and only if logic operatorN Natural numbers set notationQ Rational numbers set notationZ Integer numbers set notationR Real numbers set notation For every quantier There exists quantier26 CHAPTER 2. SET THEORY2.2 Relations* A binary relation R between A and B is a rule that associate someelements a A with certain elements b B.Equivalently, it is a subset R of the product AB; that meansR = {some (a, b) : a and b satisfy some condition} AB* Inx Notation: If R is binary, we can use inx to represent pairs in R.For example, call R the is square of relation on N.R = {(0, 0), (1, 1), (4, 2), (9, 3), . . . , (n2, n), . . .} = {(n2, n)|n N}.In this example, we have (9, 3) R. So we can also writeR(9, 3) or 9R3 or 9 is square of 3.-* In general if xi Ai, for all i = 1..n, the set of all n-tuples (x1, , xn) isdenotedA = A1 A2 An = {(x1, , xn)}A n-ary relation R is a subset of A = A1 A2 AnIf R is a relation and (x1, , xn) R, we write R(x1, , xn).n-ary relations Application in CS: Relational Databases. Arelational database is a relation where the indexes of a tuple have associatednames called attributes.Example. Set n = 3,A1 a set of names, A2 a set of majors, A3 a set of credits,and let Students be a ternary relation between the sets A1, A2, A3Students = {(x, y, z) | x is a Name, y is a Major, and z is Credits}.Students is also called a relational database with 3 elds A1 of strings, A2 ofstrings, and A3 of natural numbers.2.2.1 Equivalence RelationConsider a binary relation R on A (between A and A), it is just a subset R ofthe product AA, i.e.R = {some pairs (a, b) AA : a A b A}.R is called an equivalence relation on A if it is reexive, symmetric andtransitive, due to the below meanings.2.2. RELATIONS 271. Reexive property: aRa for all a A.2. Symmetric property: For all a, b A, if aRb then bRa.3. Transitive property: For all a, b, c A, if aRb and bRc then aRc.Theorem 8. An equivalence relation R provides a partition of the set A, thatpartition is formed by the set of all equivalence classes of R.2.2.2 Partial ordersConsider a binary relation R on A (between A and A), it is just a subset R ofthe product AA, i.e.R = {some pairs (a, b) AA : a A b A}.R is called a partial ordering relation on A if it is reexive, anti-symmetricand transitive, due to the below meanings.1. Reexive property: aRa for all a A.2. Anti-symmetric property: For all a, b A, if aRb and bRa then a = b.3. Transitive property: For all a, b, c A, if aRb and bRc then aRc.If we could determine a partial ordering relation R on A then (A, R) is called aposet.2.2.3 ExampleRelation of weekly approriate outt (for IU students from Monday till Saturday)R = {(a, b) : a and b make a right outt}, i.e.R = {Monday, Tuesday, . . . , Friday} ={(shirt, jean), (shirt, trouser), (pull, jean), (pull, trouser), (pull, sport)}Is R an equivalence relation? a partial ordering relation R on A? Why?2.2.4 Problems- Solving HintsA) Extract infomation from Relational Databases.Recall that A1 a set of names, A2 a set of majors, A3 a set of credits,and let Students be a ternary relation between the sets A1, A2, A3Students = {(x, y, z) | x is a Name, y is a Major, and z is Credits}.1/ Who are the student majoring in CS in senior class (4-th year)?28 CHAPTER 2. SET THEORYSet y = CS (constant string), and set z 90 for 4-th year students, thensenior-Students = {(x, CS, z) Students such that z 90}2/ What is the history department database of names and their credits?History-Students = {(x, z) | (x, His, z) Students } A1 A3In Relational Databases theory, History-Students is called a projection onA1 A3 with respect to the direction y = His.B) Poset Diagram (Hasse Diagram): A graph representing a poset but withonly immediate predecessor edges, and the edges are oriented up from x to ywhen x < y.Quiz: can you show the Hasse Diagram of ({2, 3, 4, 8, 12, 15}, |)?2.2.5 Practical projects (Optional)Let A be a set of nine team of students, in a Green Summer Actions atHCMUS, where the performance of team ti is denoted by pi Q+, for i = 1..9.Suppose that the performances are distinct and sorted in increasing order, thatis p1 < p2 < p3 < . . . < p8 < p9, and the corresponding teams in A are denotedas A = {t1, t2, t3, . . . , t8, t9}. We dene a binary relation on A byti tj pi pj.Could you determinea) whether (A, ) is a partial order set? Total order set? Explain why?b) how many subsets B of A that have precisely 5 elements (teams), consistthe worst team t1, and not consist teams t2, t3?c) how many subsets C of A having precisely 5 elements and the weakestteam of C is t4?2.3. FUNCTIONS- WAYS OF TRANFORMING THINGS 292.3 Functions- Ways of tranforming things2.3.1 MotivationA) The idea of function is one of the most fundamental concepts in modernmathematics. A function expresses the hypothesis of one quantity depending on(or being determined by) another quantity. For example:(i) bone mass is dependent on age of subject;(ii) height is dependent on races etc.If a function f assigns a value y in the range to a certain x in the domain, thenwe write: y = f(x) wherex is called independent variable and y is dependent variable (although thisterminology is sometimes controversial).B) When HCMCs Environmental Protection Agency (EPA) found a certaincompany C (paper mill or cleaning chemical factory) dumping contaminatedliquid into Saigon River,it ned the company C $12500 plus $100 per dayuntil the company compiled with national pollution rules.Request: express the total ne as a function of the number x of days the rmC continued to violate the national rules. Determine the slope and give yourremark about it.2.3.2 TheoryDomain and range.In general, given two sets A (domain) and B (contains range), function f fromset A to set B, is a special rule, such that each value a A gives rise a uniquevalue f(a) = b. We describe functions by few ways:1. use an algebraic formula: function f : A B is given by a formulaf(a) = b,2. by relation notation:f = {(a, b) : each value a A gives a unique image b B}orf = {(a, f(a)) : a A and !f(a) B}* The domain of f is A, denoted by Dom(f), consists of all a such that f(a) iscomputable,* b = f(a) is the image of a under f. The set of values b is called its range orimage, written Range(f).30 CHAPTER 2. SET THEORYComposite function.Suppose that f, g are real-valued function with domains Dom(f) and Dom(g)respectively. The function h := f g given byh(x) := (f g)(x) = f[g(x)]is called the composite of f with g. The domain of f g is the set of all x Dom(g) such that g(x) Dom(f). Note that it can happen that f g = g f. [why? try visualize thediagram]2.3.3 ExamplesEx 1: A = {1, 4, 7, 8, 10}, B = {2, 8, 14, 16, 17, 20, 35} N,the doubling function is dened1. by algebraic formula, can be written shortly byf(a) = 2a, a A2. by relation notation f = {(1, 2), (4, 8), (7, 14), (8, 16), (10, 20)},Remark that graphing/sketching a function f on 2-dimensionalplane Oxy (2D-plane) means representing f by relation notation.2.3.4 Problems- Solving HintsA/ Number Theory- basic conceptsDivision algorithm. For a, b Z with b = 0, there are unique pair ofintegers q, r Z such thata = bq +r with 0 r < |b|Euclids algorithm for nding gcd(x, y) [try it on Maple!]Example. Find gcd(189, 33)The mod Function. For a, b Z with b > 0, apply the divisionalgorithm to get a = bq +r with 0 r < b. The remainder r is the valueof the mod function applied to a and b:r = a mod b2.3. FUNCTIONS- WAYS OF TRANFORMING THINGS 31How to get a formula for r in terms of a and b?Hint: we solve the equation for q = a/b r/b, employing the fact that0 r < bB/ Constructing Function A function f : R R given by f(x) = x2, afunction g : R R given by g(x) = 4x + 3 The composite function go f is determined by the formula ?? The composite function fo g is determined by the formula ??C/ Specic properties of functions Let f : A B be a function.Injective (also called one-to-one): Distinct elements in A map to distinctelements in B; formalizing asa = b f(a) = f(b)Is f : N8 N, be dened by f(x) = 2x mod 8an injective function?Surjective (also called onto): The range is the codomain. That is eachb B has the form b = f(a) for some a A.Bijective (also called one-to-one and onto): Both injective and surjective.That isany b B has the form b = f(a) for a unique a A.Prove: the function f : (0, 1) (2, 5) dened by f(x) = 3x + 2 is abijection.2.3.5 Practical projects (Optional)1. Piecewise functions are functions of the formy =_ f1(x) when x I1, (a real interval)f2(x) when x I2, (another interval)Sketching the graph of the piecewise functiony =_ 52x 12 if 1 x 1x2+ 4x + 5 if x > 12. Basic graphs and how to nd their intersection.Given two graphs G : y = f(x) . . . () and H : y = g(x) . . . (), theirintersection G H can be determined by solving the system of equations32 CHAPTER 2. SET THEORYf(x) = g(x) . . .to nd solutions xi.The intersection G H = {M(xi, yi) : M G and M H}, that isG H = {M(xi, yi) : f(xi) = g(xi) and yi = f(xi)}Application of intersecting graphs: Break-even points: A cabletelevision company estimates that with t thousand subscribers, itsmonthly revenue and cost (in thousands of dollars) areR(t) = t2+ 3t 2 . . . (G) andC(t), be given by 4t + 8s 6 = 0 . . . (H).Find the intersection of the curve G and the line H on the Ots-plane?Notation: The companys break-even points are the number ofsubscribers t0 at which R(t0) = C(t0).3. Inverses: If f : A B, b = f(a) is a bijection, then there is an inversefunction g : B A dened by (an inverse action)g(b) = a i f(a) = bThe inverse of f is denoted by f1.E.g., the function f : (0, 1) (2, 5) dened by f(x) = 3x + 2 =: y is abijection, so the inverse of f is denoted by f1= g : (2, 5) (0, 1) denedby ??2.4 Integers and Algorithms on Integers2.4.1 Review- MotivationWe start with the basic concept of a number. The Natural Numbers, denoted as N, are the numbers 1,2,3,... Theseare closed under addition (e.g., 3 + 29 = 32 N) .Introducing the notion of subtraction makes us enlarge N to get theIntegers, denoted as Z, positive or negative or 0, so that our numbers areclosed under the operation of substraction.2.4. INTEGERS AND ALGORITHMS ON INTEGERS 33 Z is closed under multiplication as well; which is to say that the productof two integers is an integer (e.g., 3.(9) = 27 Z) . To obtain a set of numbers closed under division:we must enlarge Z to get the Rational Numbers Q, which are fractionsof the form a/b where a is in Z and b is in N.We then have the extension diagramN Z QThe numbers between 0 and 1 can each be represented as a decimal pointfollowed by an innite string of digits, each digit being one of 1, 2, 3, ..., 9, 0.Rational numbers in Q repeat themselves endlessly after some point: forexample 1 / 4 is .250*(where the star means that you repeat the starred digit endlessly)1 / 3 is .3*, 57 / 100 = .570*.1 / 7 = .(142857)*,Hence, we have the extension diagramN Z Q RIrrational numbers (not in Q, but still in R) do not do so, for examplee = 1.27... the Nepe base number of logarithm = 1.414... = 2.90othe unit of measuring angle2.4.2 Introduction to AlgorithmsLearn chapter 14, key text by BIGGS, on Algorithms and Eciency, pages 159 171.2.4.3 Basic Integer Theory Divisibility algorithms Counting systems- Arithmetic operations Congruences linear congruences, the additive group Zn Greatest common divisors The Euclidean algorithm Decompsing an integer by relatively prime numbers34 CHAPTER 2. SET THEORYDivisibility algorithmsMinimum principle: In a total ordering set (S, ), for any subset = A Sand A is bounded below, then there exists a smallest element of A, that is:b S, a A : b a = a0 A : a0 a.Divisibility: for a, d Z, we say d is a divisor of a i:q Z : a = qdDivision algorithm: Let a, d Z with d 1. Then!(q, r) Z2: a = qd +r where 0 r < d.q is called the quotient andr is called the remainder in the division of a and d.Counting systems- m-adic representationFix an m Z and m 2, any n Z can be represented uniquely in the form:n = [a0a1 ak], means thatn = a0 +a1m+a2m2+. . . +akmk=ki=0aimi, where k Nsuch that mk n < mk+1, 1 ak m1, and ai N, 0 ai m1, for i = 1..k 1.This is called the m-adic representation of n, ai the digits of n to base m.For example, m = 2, our counting system is said to be binary,n = 14 = 0 + 1.21+ 1.22+ 1.23then k = 3 and the 2-adic representation of 15 is[0111].Group. Let = G, and G2= GG.A binary operation : G2 G is a map, we write x y := (x, y)(G, ) is called a group if satises three axioms:- associativity,- there exists identity element and- there exist inverses in G with respect to .2.4. INTEGERS AND ALGORITHMS ON INTEGERS 35Moreover, (G, ) is called abelian or commutative if x y = y x.Ex1: (G, ) = (Z, +) is an abelian group, additively writen..Ex2: (Q, ), (R, ), (C, ) also abelian, but multiplicative ones.Subgroup. H G is a subgroup of (G, ) if H also is a group under the samebinary operation as G. We write H G.Theorem 9 (subgroup of (Z, +) is cyclic). Let H (Z, +), then!d Z : H = d := dZ.Greatest common divisor- The Euclidean algorithmTheorem 10. Let = A (Z, +), then1. A has a unique greatest common divisor, denoted gcd(A)2. a1, a2, . . . , ak A and x1, x2, . . . , xk Z such that:gcd(A) = a1x1 +a2x2 +. . . +akxk.Proof. Put H := {a1x1 +a2x2 +. . . +akxk : ai A and xi Z}.Greatest common divisor- specic cases. If = A = {a1, a2, . . . , ak} Z is nite, then we writegcd(A) = (a1, a2, . . . , ak).For instance, A = {12, 15} then gcd(A) = (12, 15) = 3. Integers a1, a2, . . . , ak are called relatively prime i (a1, a2, . . . , ak) = 1,and pairwise relatively prime i(ai, aj) = 1 for i = j.For instance, 2, 4, 5 are called relatively prime since gcd(A) = (2, 4, 5) = 1.But 2, 5, 7 are called pairwise relatively prime since (2, 5) = (2, 7) = (5, 7) = 1.The Euclidean algorithm computes gcd.Given a, b Z and b 1.The Euclidean algorithm aims at constructing a sequence ri, where(a, b) = (r0, r1) = (r1, r2) = . . . = (rn1, rn) = (rn, rn+1) = rnand ri1 = riqi1 +ri+1, 0 ri+1 < ri, 1 i n.For e.g. try (30, 12) = (12, 6) = (6, 0) = 6.Ex 3: let apply the Euclidean algorithm to nd (574, 252).36 CHAPTER 2. SET THEORYCongruences linear congruences- Chinese remainder theorem Introduce the concept of ring (R, +, ). Introduce Zm := Z/mZ Fact: (Zm, +, ) is a commutative ring for every integer m 2.The Chinese remainder theorem is very popular in the sense that it is found inmany applications. In particular, we can use it1. when factorizing polynomials over nite elds and over the integers Z,employed in Cryptography;2. in computing balanced factorial designs in Industrial Statistics andManufacturing,3. in many other applications that require a decomposition of a big ring R interms of its components ...Application 1: Public Key Cryptography: See page 77 of Nathanson foran introduction. Read RSA cryptosystem. See next section for background.2.4.4 Application of Integers in CryptologyWrite Nn := {1, 2, 3, , n}. As a result N26 := {1, 2, 3, , 26}Ciphers and the mod function. Let the letters from a to z be represented by0, 1, ..., 25, respectively. Any bijection f : N26 N26 can act as a cipher and itsinverse f1(also a bijection) can act as a decipher.Well-known ciphers: additive, multiplicative and ane.Example (additive cipher).f(x) = (x + 2) mod 26 and f1(x) = (x + 24) mod 26.Example (ane cipher).f(x) = (5x + 1) mod 26 and f1(x) = (5x + 5) mod 26.Hash Functions setting. Why we know this? Due toTheorem 11 (Mod and Inverses). Let n > 1 and f : Nn Nn be dened byf(x) = (ax +b) mod n.Then2.4. INTEGERS AND ALGORITHMS ON INTEGERS 37 f is bijective i gcd(a, n) = 1. If so, then f1(x) = (kx +c) mod n where f(c) = 0 and 1 = ak +nm.Some ciphers keep one or more letters xed. For example, the multiplicativecipher f(x) = 3x mod 26 has f(0) = 0, so it sends the letter a to itself. Lettera is named xed letter or xed point of the cipher f(x) = 3x mod 26.The below theorem can be used to construct ciphers with no xed letters.Mod and Fixed Points. Let n > 0 and f : Nn Nn be dened byf(x) = (ax +b) mod n.Then f has no xed points i gcd(a 1, n) does not divide b.In other words, f has xed points i gcd(a 1, n) divides b.Hash FunctionsA hash function maps a set S of keys into a nite set Nn of table indexes:h : S NnThe table is called a hash table.Collisions occur if the function is not injective.If there are no collisions, then any key in S is mapped to the index where theinformation is stored without any searching.Example. Let S be the students in a class and let h : S N366 be dened byletting h(x) be the birthday of x. If two people have the same birthday, then acollision occurs.Resolving Collisions by Linear ProbingIf a collision occurs at index k, then some key is placed in location k and theother colliding keys must be located elsewhere.Linear probing is a technique to search/probe for an open place in the tableby looking linearly at the following places, where g is a xed gap:(k +g) mod n, (k + 2g) mod n, , (k + (n 1)g) mod n.38 CHAPTER 2. SET THEORY2.4.5 ExamplesExample 1. Let S = {jan, feb, mar, apr, may, jun} and let h : S N6 bedened by h(xyz) = p(x) mod 6, where p(x) is the position of x in the alphabet(p(a) = 1, , p(z) = 26).Place the keys from S into a hash table by rst placing jan, then feb, and so on.h(jan) = p(j) mod 6 = 10 mod 6 = 4.So place jan in position 4 of the table. Continue the process to geth(mar) = 1, h(apr) = 1 (collision with mar).Find the table showing the result of resolving collisions by linear probing with agap of 1.2.4.6 Problems- Solving HintsWrite Nn := {1, 2, 3, , n}1. Is f : N5 N5 be dened by f(x) = (4x + 1) mod 5 a bijection? If yes,nd its inverse.2. The additive cipher f(x) = (x + 2) mod 26 and the ane cipherf(x) = (5x + 1) mod 26 both have or dont have xed points?2.4.7 Practical projects (Optional)For a group of max 4 students: Conduct a small research on RSA encryption-How to keep your information on computer nets from eardropers?Chapter 3Counting Techniques.3.1 Basic countingWe can compare the cardinalities of two sets by using- functions as injection, surjection and bijection;- other set-based methods as inclusion- exclusion or Union Rule;- Pigeonhole rule and others ...3.1.1 MotivationPractical questions that you could face in your daily life are:1. Suppose that you wish to take two fruits for your lunch when go to school.Known that you have three bananas, four apples and two mangos, what isthe number of ways that you can select two pieces of fruit of dierenttypes?2. Ten soccer teams are competing in a V-league. In how many dierentways can the rst three places be lled?3. A customer surveyor at your rm asked respondents to indicate theirhighest level of education. The only three choices in the survey are highschool, college, and other. If 31% indicated high school and 49% indicatedcollege, then how much the percentage of respondents who chose the othercategory is?4. A security key word w of length 10 is formed by two sub-strings wA andwB of length 3 and 7, that is w = wAwB (concatenating two sub-strings).Known that repetition is allowed, wA is made by distinct characters of theset S = {a, b, c, d, e, f} and wB is made by characters of the setR = {1, 2, 3, u, v, x, y, z}How many security key words w can be created totally?3940 CHAPTER 3. COUNTING TECHNIQUES.5. * Suppose you cut a chocolate bar of rectangular shape with the length mand the width n by a horizontal cut (along the length) or vertical cut(along the width) into small square pieces of size x.Known that only one cut is allowed in each cutting step, and that m, n, xall are eligible positive integers.In your opinion, what is the correct relationship between p, x, m, n?If the length m = 81, the width n = 10, and the size x of square chocolatepieces satises that 1 < x < 5, then what is the number of small chocolatepieces p you can make?3.1.2 Theory on CountabilityMost used concept is:|A| = |B| or A B means there is a bijection between A and B.(a0) A set S is nite (also called countably nite) if there exists an n N sothat |S| = |Nn|(a1) Say that S is countably innite when |S| = |N|Denition 12. We say(a) a set S is countable if |S| = |Nn| or |S| = |N|(b) a set S is uncountable if (a) does not happen!Obviously,1. S is countable if |S| |N|; S is uncountable if |N| < |S|2. S N implies S is countable, [the inverse is not correct, e.g. |Z| = |N|, say Zis countable but Z N]Cantors Result: |A| < |power(A)| for any set A.Proof : use Diagonalization Technique.Example. power(N) is uncountable because |N| < |power(N)|.Inclusion-exclusion, counting practice.Recall that we have a few basic rules Product Rule: |AB| = |A||B| and |An| = |A|n. Inclusion-Exclusion or Union Rule: |A B| = |A| +|B| |A B| Dierence Rule: |A\ B| = |A| |B|3.2. PROBLEMS- SOLVING HINTS 41Pigeonhole and division rules.Pigeon Hole Principle. If m things are put into n places and m > n, thenone place has two or more things (a collision occurs).Another way to say this is that:if A and B are nite sets with |A| > |B|,then there are no injections from A to B.Example. In HCM City there are two people with the same number of hairs ontheir heads. Everyone has less than 8 million hairs on their head and thepopulation of HCM City is more than 8 million. So the pigeon hole principleapplies.Binomial theorem, combinatorial identitiesSee text books.3.1.3 ExamplesExample. Consider a map f : Z N being determined by:f(x) =_ 2x 1 when x I1 = (0, +)2x when x I2 = (, 0]* Prove f is a bijection, nd f1.* Can we conclude that N n (the number of equations is greater than thenumber of unknowns) so that there might exist no exact solution and we mustnd a solution based on global error minimization, like the LSE (Least-squareserror) solution.6.1. LINEAR POLYNOMIAL EQUATIONS 83Nonsingular means invertible. Given A Rnn. If there exists a secondmatrix B Rnnsuch that AB = BA = Ithen we say B is the inverse of A, write B = A1, and say A is nonsingular.Otherwise, when no such matrix B exists, A is singular.Theorem 22. Given a square matrix A Rnn, the followings are equivalent:1. A is nonsingular2. The columns of A form an independent set of vectors3. The rows of A form an independent set of vectors4. The linear system A.x = b has a unique solution for all vectors b Rn5. The homogenous system A.x = 0 has only the trivial solution x = 06. The determinant det(A) = 0(i) The nonsingular case (m = n). We obtain the unique solution x = A1bwhen A is nonsingular, that is det(A) = 0 or rank(A) = n.(ii) The underdetermined case (m < n): Minimum-Norm Solution.(iii) The Overdetermined Case (m > n): Least Square Error (LSE) Solution84 CHAPTER 6. ALGEBRAIC MODEL AND POLYNOMIAL EQUATIONS(ii) The second case of the system A.x = b.If the number of equations is less than the number of unknowns, m < n, thesolution is not unique, but numerous. Suppose the m rows of the coecientmatrix A are independent. Then, any n -dimensional vector can be decomposedinto two componentsx = x++x Range(A) + Ker(A) where the one x+is in the row space Range(A) of A, that can beexpressed as a linear combination of the m row vectors:x+= AT, and the other x is in the null space Ker(A) being orthogonal to the rowspace so thatAx = 0.ThenA(x++x) = AAT+Ax = AAT+ 0 = AAT = bSince AATis supposedly a nonsingular mm matrix resulting frommultiplying an mn matrix by an n m matrix, we can solve the equationAAT = b for to geto = [AAT]1bTherefore,x+ = ATo = AT[AAT]1b (6.2)provides a solution for A.x = b, but not unique, due to many possibilities of x!6.1. LINEAR POLYNOMIAL EQUATIONS 85Denition 23. The matrix AT[AAT]1is called the right pseudo- (generalized)inverse of A, denoted pinv(A).Based on the principle that any one of the two perpendicular legs is shorterthan the hypotenuse in a right-angled triangle, Eq. (6.2) is believed to representthe minimum-norm solution.MATLAB has the pinv() command for obtaining the pseudo-inverse. We canuse this command orthe slash(/) operator to nd the minimum-norm solution (6.2)to the system of linear equationsA.x = b, where A Rmn; b Rn. (6.3)Remark. The solution (6.2)x+ = ATo = AT[AAT]1bcan be viewed as the projection of an arbitrary solution x onto the row spaceRange(A) of the coef[U+FB01]cient matrix A spanned by the row vectors.The remaining component x of the solution xx = x x+ = [Id pinv(A)A]x Ker(A)The matrix P = [Id pinv(A)A] is called the projection operator.86 CHAPTER 6. ALGEBRAIC MODEL AND POLYNOMIAL EQUATIONS(iii) The Overdetermined Case (m > n): Least Square Error (LSE) SolutionIf the number of equations is greater than the number of unknowns, m > nthere exists no solution satisfying all the equations strictly. Thus we try tond the LSE (least-squares error) solution minimizing the norm of the(inevitable) error vectore = Ax bThen, our problem is to minimize the objective functionJ = 12||e||2= 12||Ax b||2= 12[Ax b]T[Ax b] (6.4)whose (LSE) solution can be obtained by setting the derivative of this functionwith respect to x to zero.x = AT[Ax b] = 0 x = [ATA]1ATbx = [ATA]1ATb (6.5)Denition 24. The matrix [ATA]1ATis called the left pseudo- inverse of A,also denoted pinv(A).The LSE solution can be obtained by using the MATLABs pinv() command or the backslash () operator6.1. LINEAR POLYNOMIAL EQUATIONS 876.1.2 Gauss Elimination- TechniqueConsider a linear systemA.x = b, where A Rmn; b Rn...()Denition 25. Elementary row operations or row reductions include:a/ Multiply both sides of an equation by a non-zero constantb/ Add a multiple of one equation to anotherc/ Interchange two equationsWe now form the augmented matrix A = [A|b],then using row reductions on A to obtain a row equivalent matrixR = [U|c]and its row equivalent systemU.x = c ().Two systems (*) and (**) have the same solution sets.Gauss Elimination means systematically eliminating nonzero elements belowthe main diagonal of the coecient matrix A:A rowreductions R such that R = [U|c],where U is upper triangular, and we have rank(U) = rank(A).Gauss Elimination, hence consists of two steps88 CHAPTER 6. ALGEBRAIC MODEL AND POLYNOMIAL EQUATIONS1. Row reduction: to convert (*) to an equivalent upper triangular U (usingrow reduction), having the form:U.x = c, easier to solve, and2. Backward substitution: solve in reverse order,How do we nd the matrix U? Let look at a specic example.Example 11. Consider the linear system___4x1 + 2x2 x3 = 5x1 + 4x2 +x3 = 122x1 x2 + 4x3 = 12in the form A.x = b:__4 2 11 4 12 1 4____x1x2x3__=__51212__(6.6)The augmented matrixA =__4 2 1 51 4 1 122 1 4 12____4 2 1 50 7/2 5/4 43/40 0 73/14 219/14__= RThis augmented matrix represents a triangular system (the coecient matrix istriangular):R = [U|c] U.x = c, i.e.6.1. LINEAR POLYNOMIAL EQUATIONS 89__4 2 10 7/2 5/40 0 73/14____x1x2x3__=__543/4219/14__; (6.7)Backward substitution means using:the third row: 73/14x3 = 219/14 x3 = 3the second row: 7/2x2 + 5/4x3 = 43/4 x2 = 2the rst row: 4x1 + 2x2 x3 = 5 x1 = 1.The solution is x = (1, 2, 3).6.1.3 Matlab section1. Row-echelon form: a matrix derived from another by a nite sequence ofelementary operations,2. gauss(A, b): performs Gaussian elimination on the systemA.x = b;returns the upper triangular factor U (a row-echelon form), and we haverank(U) = rank(A).3. rref([A b]) = R: Row reduced Echelon Form of [A|b], performs the Gausselimination on [A|b], called the extended matrix, returns the uniquereduced row echelon form RWe obtain the unique solution x = A1bwhen A is nonsingular, that is det(A) = 0 or rank(A) = n.90 CHAPTER 6. ALGEBRAIC MODEL AND POLYNOMIAL EQUATIONS4. BackwardSubstitute(R)A row echelon form has the properties:a/ all the nonzero rows precede all the zero rows, and the rst nonzeroelement in a nonzero row appears to the right of the rst nonzero element in thepreceding row;.b/ in the rst nonzero element in each nonzero row is 1 and is the onlynonzero element in its columnSummary command in MATLAB. Quantity MATLAB Syntax Comment pseudo- inverse of A pinv(A)or generalized-inverse of A pinv(A)minimum-norm solution x = A/b orx = pinv(A) bLSE solution x = Abor x = pinv(A) b 6.2. SYMBOLIC COMPUTATIONFOR FINDINGROOTS OF NONLINEAR EQUATIONS916.1.4 Practical projects (Optional)1/ (Max 3 student group) Study Leonchiev model in Economics using linearsystems.[Vasily Leonchiev, an American economist who won the Nobel Prize, privatecapitalism must account for one-half of the Gross National Product...]2/ (Max 3 student group) Study PageRank engine6.2 Symbolic computation for nding roots ofnonlinear equationsThis chapter presents selective topics of Computer Algebra (C.A.). Wespecically intergrate well known algebraic techniques such as the GroebnerBasis Method to some new applicable elds growing very fast in recent years.Applicable elds range from pure math, industrial statistics to statisticalmodelling, mathematical genomics, bioinformatics among others.Benets of symbolic computationComputer algebra systems (CAS) or symbolic computation packages providemany benets:1. dependability of mathematical formulas is increased through newways to produce or check the results exactly;2. dependability and precision of numerical results is enhancedthrough unrestricted-precision integer, rational, real and complexarithmetic;92 CHAPTER 6. ALGEBRAIC MODEL AND POLYNOMIAL EQUATIONS3. models is formulated precisely through using operators and high levelmathematical objects; also by the implementation of exact algorithmswhich havent been done in numerical packages;4. handling combinatorial structures that involve lengthy iterations andrecursions, where computational intensity can limit the models;5. due to the powerful abstraction of symbols, we are able to representmany complex processes in various areas such as: biometrics,computational physics and chemistry, control systems . . .Grobner basis methodThe core of computer algebra systems is the Groebner Basis Method. But whyis Computer Algebra? At least three reasons to study:1/ symbolic solution or numerical solution: symbolic-analytic solutions are moredemanded in practical usages nowadays2/ analyzing and modelling are important than computing3/ the role of algebraic computation combined with geometric, theorecticalgroup computation becomes increasingly important, especially in Math and Statmodeling; eg., determining good-genes and bad-genes in human-being genome,measuring risk in nancial investment, the combinatorial aution problem ine-commerce ...Solve a non-linear system, you must use the Groebner package! Type in Maplewith(Groebner).Example 12. Let f := x2+y +z 1; g := x +y2+z 1; h := x +y +z21;and J :=< f, g, h >. Then6.3. ALGEBRAIC MODELING 93G := Basis(J, plex(x, y, z)); getG := [z6+4 z34 z4z2, 2 z2 y +z4z2, y2z2+z y, x +y +z21];Check Z(J) = Z(G) a nite set, use:IsZeroDimensional(G); trueand to solve this, use:solve(G, {x, z, y});The root set Z(J) is{{y = 0, z = 0, x = 1}, {x = 0, y = 1, z = 0}, {z = 1, x = 0, y = 0}, {z = 1, x =0, y = 0}, {x = RootOf(Z2+ 2Z 1, label = ...), y = x; z = x}}.See more at http://www.cse.hcmut.edu.vn/mnguyen/classes/ACA/Computational-Algebraic-Geometry-2010.html6.3 Algebraic Modeling6.3.1 In Industrial StatisticsIntroduction to Design of Experiments (DOE). Design of Experiments (DOE) is a mathematics branch studyingstatistically designed experiments. But why DOE?1930s of the 20-th century, when Sir R. A. Fisher used Latin squares torandomize the plant varietiesR.C. Bose in the 1950s in India and then in the US: the mathematicaltheory of combinatorial designsNowadays, DOE is extensively studied and employed in , and theMathematics for DOE is very rich. Mostly studied directions are:94 CHAPTER 6. ALGEBRAIC MODEL AND POLYNOMIAL EQUATIONS study of Factorial designs: mathematically described as matriceswhich consist many factors, each has several settings (levels), andthese settings are arranged in a regular way.The main tools are combinatorics, algebra, geometry. study of Optimal designs study of Computer experiments ...Modern industrial organisations in manufacturing and services are subjectto increasing competitive pressures and rising customer expectations. Twokey aims: a/ to satisfy and delight various customers while simultaneouslyb/ improving eciencies and cutting costs. A systematic approach to the evaluation of benets from processimprovement and quality by design (QbD) that can be implementedwithin and across organisations, be summarised and classied using afour-step quality ladder:(1) re ghting , (2) inspection,(3) process control, and (4) quality by design.Statistical methods corresponding to these steps are:(a) Data Accumulation, (b) Sampling,(c) Statistical Process Control and (d) DOE! DOE covers many smaller topics: robust designs, optimal designs,combinatorial designs, fractional factorial designs. DOE helps us toexplore the relationships between the key input process variables (orfactors) and theoutput performance characteristics (responses or qualitycharacteristics) Hence, the whole picture includes operations, machines,6.3. ALGEBRAIC MODELING 95methods, people and other resources that transform some input into anoutput characterised by one or more response variables. Mathematical techniques for studying DOE are very rich:combinatorics, graphs, group theory, nite elds, coding theory,nite geometry and algebra, mathematical programmingComputational Algebaric Geometry & Commutative Algebra. Applied to many areas nowadays: agriculture, bio-informatics[microarray], medicine and pharmaceutics, automobile engineering.What are factorial designs and fractional factorial designs?Factorial designs. Suppose that we have n nite sets Q1, Q2, . . . , Qn containedin a eld k, called the factor sets or factors. We use a few notation below: The (full) factorial design with respect to these n factors is the Cartesianproduct D = Q1 . . . Qn kn. A design point p = (p1, . . . , pn) is an element of D. Moreover, ri := |Qi| is the number of levels of the factor i. We say that D is symmetric if ri = r for all i; otherwise, D is mixed, thatis ri = rj for some i = j.Let s1, s2, . . . , sm (m n) be the distinct levels of D, and suppose that D hasexactly ai factors with si levels. We call sa11 sa22 samm the design type of D.For example, if Q1 = {0, 1, 2, 3}, Q2 = Q3 = Q4 = {0, 1}, thenD = {(0, 0, 0, 0), (0, 0, 0, 1), (0, 0, 1, 0), (0, 0, 1, 1), . . . , (3, 1, 1, 0), (3, 1, 1, 1)}96 CHAPTER 6. ALGEBRAIC MODEL AND POLYNOMIAL EQUATIONSis the 4 23mixed factorial design.Fractional factorial designs. Suppose D is a sa11 samm mixed factorial design.A fraction F of D is a subset consisting of elements of D. If F has an elementwith multiplicity greater than one, we say F has replications. This is also calledan sa11 samm fractional design. For exampleF = { (0, 0, 0, 0), (0, 1, 0, 1), (0, 0, 1, 1), (0, 1, 1, 0), (1, 0, 0, 0), (1, 1, 0, 1),(1, 0, 1, 1), (1, 1, 1, 0), (2, 1, 1, 1), (2, 0, 1, 0), (2, 1, 0, 0), (2, 0, 0, 1),(3, 1, 0, 0), (3, 1, 0, 1), (3, 1, 1, 0), (3, 1, 1, 1) }is a 4 23mixed fractional design. We usually consider a fractional design as amatrix whose rows correspond to the elements of the multiset, in any order, andwhose columns correspond to the factors. So the example above becomesF =__0 0 0 0 1 1 1 1 2 2 2 2 3 3 3 30 1 0 1 0 1 0 1 1 0 1 0 1 0 1 00 0 1 1 0 0 1 1 1 1 0 0 1 1 0 00 1 1 0 0 1 1 0 1 0 0 1 1 0 0 1__T,where T denotes transpose.Example 13. Fix n = 3, we use the full factorial design 23with threebinary factors to nd the relationship between the factor x1 of mixture ratio,the factor x2 of temperature, the factor x3 of experiment time period and theresponse y of wood toughness.The levels of factors are given in Table 6.1, and simulated experiments in Table6.2:6.3. ALGEBRAIC MODELING 97Factor Low (0) High (1)Mix(ture) Ratio 45p 55pTemp(erature) 1000C 1500CTime period 30min 90minTable 6.1: Factor levels of 23factorial experimentRUN Mix Ratio Temp Time Response Y1 45p (-) 100C (-) 30m (-) 82 55p (+) 100C (-) 30m (-) 93 45p (-) 150C (+) 30m (-) 344 55p (+) 150C (+) 30m (-) 525 45p (-) 100C (-) 90m (+) 166 55p (+) 100C (-) 90m (+) 227 45p (-) 150C (+) 90m (+) 458 55p (+) 150C (+) 90m (+) 56Table 6.2: Results of an example 23Factorial ExperimentThe linear model for the wood toughness y, t by the eight experimental runs, isy = f(x1, x2, x3) = 0+1x1+2x2+3x3+12x1x2+13x1x3+23x2x3+123x1x2x3.Example 14. A 23fractional factorial design has only 4 runs, whosecolumns correspond to the three binary factors, of the full 23-factorial design of8 runs above.This fraction is extracted from the below Hadamard matrix of order 4 (in whichevery pair of rows and pair of columns have their inner product equals to 0).This matrix provides enough information to estimate main eects of the mixture98 CHAPTER 6. ALGEBRAIC MODEL AND POLYNOMIAL EQUATIONSratio x1, the temperature x2, the experiment time period x3 in Example 1:F =__1 x1 x2 x3 1 1 1 11 1 1 11 1 1 11 1 1 1__T.But why using Fractional Factorial Designs? To cut cost in scienticinvestigations and/or in industrial manufacturing. In particular case here, if weemploy the four experimental runs of F, we can t only a linear model for theresponse y of wood toughness, of the form:y = f(x1, x2, x3) = 0 +1x1 +2x2 +3x3.So using less resource, we now could t a model that consists of only mainfactor eects!Assignment. Write a Maple program or Singular program to compute a/ the full design D = Q1 . . . Q4 above, where Q1 = {0, 1, 2, 3},Q2 = Q3 = Q4 = {0, 1}; b/ the mixed 4 23fractional design F of 16 rows above.Three Fundamental Research Problems on FFD:1. Problem 1: Constructing a fraction with given estimable terms (masters6.3. ALGEBRAIC MODELING 99Hnh 6.1: th G gm cc khu vc v lin ktlevel)2. Problem 2: Constructing a strength t balanced fraction with givenestimable terms (PhD level!)3. Problem 3: (PhD level!) Construction of new strength t fractions F,givena fraction F0 of N runs, d factors, with strength t.We also name this the OA Column Extension Problem:extend F0 with a new factor X to have a new fraction F = [F0|X] havingthe same strength t and d + 1 factors.6.3.2 In Business IntelligenceMt cng ty A mun pht trin kinh doanh k loi dch v, nh l cung cp thcphm, hng ni tht, thit b truyn thng ... ti 4 khu vc chnh TPHCM, khiu l I, II, III, IV; bit 4 k 2. S biu din cc khu vc ny v cc il kt ni chng cho bi th G nh trn.Cng ty A mun xy dng cc siu th ti cc khu vc chnh TPHCM ni trnsao cho tha ng thi hai rng buc:a/ ch mt siu th c xy ti 1 khu vc, v100 CHAPTER 6. ALGEBRAIC MODEL AND POLYNOMIAL EQUATIONSb/ hai khu vc k nhau (c i l kt ni) bt k phi c hai siu th cungcp 2 dch v khc loi nhau.Phng n kh thi l phng n xy dng cc siu th ti 4 khu vc chnh nitrn m tha mn ng thi hai iu kin a/ v b/.i) C phng n kh thi khng khi k = 2?ii) Anh (Ch) hy trnh by cc bc c th m hnh ha i s bi ton trnkhi 2 k n, bit 2 n N l s lng khu vc chnh TPHCM.iii) Khi s loi dch v k = 3, v n = 4 nh cho trong G, hy cho bit c baonhiu phng n kh thi.Chng 7Probabilistic Models7.1 Practical MotivationProbabilistic Methods help us to solve typical problems in daily life as follows.1. Given the probability that a randomly selected student in a class is afemale is 56%, how much chance that the selected student is a male?2. The mass, X kg, of silicon produced in a manufacturing process ismodelled by the probability density function (pdf)fX(x) = 332(4x x2) if 0 x 4; fX(x) = 0 otherwise.What is the mean of the mass of silicon produced?3. Eggs sold at a market are usually packaged in boxes of six. The number,X, of broken eggs in a box has the probability distribution given in thefollowing table:101102 CHNG 7. PROBABILISTIC MODELSx 0 1 2 3 4 5 6P[X = x] 0.80 0.14 0.03 0.02 0.01 0 0Denote by Y the number of unbroken eggs in a box.What are the average of X and of Y respectively?4. A discrete random variable X represents the number of trafic accidentseach year at HCMC. Suppose X has the probability mass functionfj = P(X = j) = 34_14_j, j = 0, 1, 2, 3, . . . ..with unit of 100 accidents. Up to how much chance that at most 200accidents take place in a year?5. Consider a Markov chain M describing the loyalty of customers to threeretailers Coop, BigC and Walmart, coded by states 0, 1, and 2 respectively.The transition probability matrix P, obtained in a recent poll, is given byP =_ 0.4 0.2 0.40.6 0 0.40.2 0.5 0.3_What is the probability in the longrun that the chain M is in state 1, thatis how much chance the customers will go with BigC?7.2. CONCEPTS AND DEFINITIONS 1037.2 Concepts and DefinitionsProbability is the science of problem-solving in the presence of variability anduncertainty. We will need the below basic concepts.Experiments An experiment E is a specific trial/activity (of scientists, humanbeing) whose outcomes possess randomness. Simple examples are: Coin throwing- throw a coin, random outcomes are head (H) or tail (T) Temperature measurement- observe continuously temperatures at noon inHCMC in 10 days of Summer 2007, random outcomes are the list[34, 29, 28, 32, 31, 32, 30, 31, 30, 33] (in Celcius degree).Sample space.1. Sample space S- set of all possible outcomes.Example 1: Coin throwing S = {H, T}2. Events- is subset A of sample space S: A S. Usually we include allevents into a set, called the event set Q := {A : A S and is an event}.When an experiment E is performed and an outcome a is observed we saythat event A has occurred if a A.3. Probability distribution (probability function)- a map P from Q to theinterval [0, 1]:P : Q [0, 1],A Q P(A) = Prob(A) =probability or chance that the event A occurs.104 CHNG 7. PROBABILISTIC MODELSAxioms of Probability Theory (A. Kolmogorov, 1933).A1. Probabilities are nonnegative, 0 P(A) 1, where P(A) = Prob(A).A2. The sample space S has probability 1, that is P(S) = 1A3. Probabilities of disjoint events A, B, A B = :P(A B) = P(A or B) = P(A) +P(B),in which A, B S are events, the sample space S is formed from a specificrandom experiment E.Computing Rule. For finite sample spaces, we assume S = {s1, s2, , sn},define pi = P(si) thenpi 0, andni=1pi = 1.Fact 2. If all outcomes have equal probabilities, thenP(A) = Prob(A) = nAn , where nA = |A|.Example 15. On a single toss of a die, we get only one of six possibleoutcomes: 1,2,3,4,5 or 6; then the sample space S = {1, 2, 3, 4, 5, 6}, andpi = P(i) = 1/6, for all i = 1..67.2.1 Random Variable and Probability DistributionDefinition 26. A random variable X is a function from a set - sample space Sto the reals R. For any b R, the preimageA := X1(b) = {w : X(w) = b} S7.2. CONCEPTS AND DEFINITIONS 105is an event, we understandProb{X = b} := Prob(A) =wAProb(w).For finite set - sample space S then obviouslyProb{X = b} := Prob(A) = |A||S|.The probability distribution of a random variable describes how probabilities aredistributed over the (range) values of the random variable.Expectation and Variance- the Discrete CaseExpectation. The expectation operator defines the expected value (or averagebehavior) of a random variable X asE(X) =xRange(X)P(X = x) x, where (7.1)P(X = x) = P(X1(x)); and X1(x) = {w : X(w) = x} S.In words, E(X) is a weighted average of the possible values of X, where theweight given to a value x is equal to the probability P(X = x) that X assumesthat value.Note: since the r.v. X : S R is an assignment of values to the points insample space S, you could also thinkE(X) =wSP(w) X(w) equivalently.106 CHNG 7. PROBABILISTIC MODELSVariance of a random variable X isVar(X) = E[(X E(X))2].7.2.2 Why study Probability Distributions?Citibank in HCMC makes available financial services, including checking andsaving accounts, loans, mortgages, insurance and investment services. Thesecomplicated activities have been done through a Citibanking system consistingof many modules, like ATMs, or more advanced, the Card Banking Centers(CBCs).What would be the services available at CBSs? and How? Each CBC operates asa waiting line system with randomly arriving customers seeking service at one ofthe ATMs. CBC capacity studies are used- to analyze customer waiting line and- to determine whether additional ATMs are needed.Data collected by Citibank showed that the random customer arrivals followeda probability distribution known