The assignment is to do mostly with basic Matlab and discrete probability.Attached herewith are the assignment questions. please let me the cost.
MAS162: Foundations of Discrete Mathematics Semester 2, 2021 ASSIGNMENT 3 Due by 11pm, Sun 3 October 2021 Total Marks: 25 • Before submitting your assignment, please check if there is an updated version of the worksheet available (incorporating possible corrections, typos, etc) • For all MatLab-related questions, you need to submit a printout of your MATLAB scripts as well as of all plots. • Please provide clear answers to the questions. While it is essential to show all work- ing/code/plots, it is also essential to clearly state the answers to the questions (if need be in the form of a sentence). • The assignment needs to be submitted in the form of a single pdf file that includes the MATLAB plots, codes, etc. 1. [12 marks] (summative assessment) This question addresses the representation of numbers and potential round-off errors. (a) For each of the following equations, perform the following tasks: • Decide if the equation is mathematically true for the variable values provided below. • Implement the equations in MATLAB, and test if they are true in the floating point arithmetic within MATLAB for the variable values provided. (For example, the equation 3 + 72 = 5 in matlab would correspond to the command disp(3+7^2==5) and yields, upon execution of the command, the value 0 corresponding to false. This is expected since the equation is not mathematically true.) • Where the MATLAB result differs from the mathematical expectation explain in one or more full sentences why the MATLAB results are different. The equations to be considered are, with x = 107, 1. x2 + x = x 2. x + x5 = x 3. x21/x6 = x15 (b) Write a MATLAB program that creates a vector i=(0:50)+0.5 and a corresponding vector x with values 30, 31, 32, . . . , 350. Then, for each element in x, calculate y=(-x+1/2)+(1/2+x)-1/2 and store the result in a vector y. Plot y as a function of i (not y as a function of x!). Explain the result and the differences to the expected value. If there is a value i∗ of i where the result changes rapidly, discuss how the value of i∗ fits with your knowledge about the representa- tion of floating point numbers in a computer. 2. [3 marks] (summative assessment) Answer the following questions. (a) A child has bricks of the same shape in 9 different colors, including orange and pink. The child chooses 6 bricks and puts them into a bag. In how many different ways can the child choose 6 bricks if none of the chosen bricks have the same color and the selection must include an orange brick and a pink brick? (b) The child builds a tower out of 8 bricks all of which have a different color, by stacking the bricks one on top of the other. In how many ways can the child build the tower? (c) The child builds a tower of 3 orange bricks, 2 purple bricks, 2 yellow bricks and 1 red brick. In how many ways can he child build the tower? 3. [6 marks] (summative assessment) Lara, Sara and Cara are good friends. They have a set of 12 cards each with one of the letters S, U, X, Y, E, O, T, I, H, A, V, B on them. For the purpose of this question, a word is any sequence of letters, regardless as to whether it makes any sense as a word in the English language and a sentence is any combination of words, regardless of whether it is meaningful. (a) First Lara randomly chooses one card. Then Sara randomly chooses 4 cards from the re- maining cards. Then Cara randomly chooses 3 cards from the remaining cards. Each girl puts their letters together in random order to form a word. Then they put their words to- gether to form a sentence, with Lara’s word first, Sara’s word second and Cara’s word last. How many different outcomes of the sentence are possible? (b) Compare the result obtained in (a) to P(12, 8) and argue if you expect the two to be the same or why you expect them to differ? (short answer suffices) (c) What is the probability that the sentence resulting in (a) reads ’I love you’? What is the probability that the sentence resulting in (a) reads ’I hate you’? (d) Instead of putting all three words together to form a sentence, the girls now randomly choose (for example by drawing sticks) one of their words and put that word on the table. How many different outcomes are possible? 4. [4 marks] (summative assessment) Martingale strategies in gambling. A player plays the following game at a casino: The player puts in an amount X in money. A fair coin is tossed. If the coin shows heads, the player receives 2X in return; otherwise he gets nothing. Karen goes to the casino with 1000$ and plays the following strategy: In her first game, she puts in 1$. If she wins, she finishes playing and takes her profit home. If she looses a game, she will play another game and put in twice as much money as she did in the previous game. If she wins, she will finish playing and take her profits home. She will keep going with that strategy, until she either wins a game or runs out of money. (a) Create a table for n = 1, 2, ..., 10 which lists: (a) The amount of money she puts in in game n; (b) the sum of the amount of money she has put in in all games up to this game n; and (c) her overall profit if the game n is the first game she wins. (b) What is the likelihood of her loosing 8 games in a row? (c) How many games can she loose in a row before she cannot afford to continue with her strategy of doubling her bet? (d) Given the low likelihood of loosing, is this a smart strategy for Karen to pursue? 5. [0 marks] (formative assessment) Consider the equation (A ∩ B) ∪ (A ∩ C) = A ∪ (B ∩ C) for three arbitrary sets A, B and C. (a) Use Venn diagrams to test if this equation is true or not. To this end, create separate neat drawings of Venn diagrams for A, B, A∩ B, C, A∩C, B∩C, A∪ (B∩C), and for the left-hand side and the right-hand side of the above equation. Then describe why this demonstrates that the above equation is valid for arbitrary sets A, B, C. (You might use the Venn diagram template attached to this assignment worksheet) (b) Use the rules for algebras of sets to show that the equation above is true. 6. [0 marks] (formative assessment) In a hypothetical university in a particular degree, all students have to participate in two engi- neering units in year 1, called ENG101 taught in semester 1 and ENG102 taught in semester 2. While ENG101 provides foundation knowledge that is useful for ENG102, it is not a prerequisite for students to pass ENG101 before they can take ENG102. Students who fail ENG101 in semester 1 are still allowed to participate in ENG102 in semester 2 (but have to repeat ENG101 in year 2). The average success rates (averaged over all students in their first year and over all cohorts of the last decade) are as follows: 71% pass ENG101 in their first attempt and 62.89% of all students pass ENG102 in their first attempt. Out of those that pass ENG101 in their first attempt, 82% also pass ENG102 in their first attempt. Let A be the event that a student passes ENG101 in their first attempt and B be the event that a student passes ENG102 in their first attempt. (a) Describe in words the meaning of P(A ∪ B). (b) Are A and B independent events? Provide a justification for your answer. (c) Describe the meaning of P(B ∩ A) and calculate its value. (d) Do you expect A and B to be disjoint events? Describe in a sentence why the provided context supports your opinion. Calculate the probability that demonstrates that A and B are disjoint or not disjoint. B C A B C A B C A B C A B C A B C A B C A B C A B C A B C A B C A B C A