Higher Nationals Internal verification of assessment decisions – BTEC (RQF) INTERNAL VERIFICATION – ASSESSMENT DECISIONS BTEC Higher National Diploma in Computing Programme title Assessor Internal Verifier Unit(s) Unit 11 : Maths for Computing Assignment title Importance of Maths in the Field of Computing Student’s name Jayasuriya Kuranage Bhanuka Perera NEG – E-118432 List which assessment Pass criteria the Assessor has awarded. Merit Distinction INTERNAL VERIFIER CHECKLIST Do the assessment criteria awarded match those shown in the assignment brief? Y/N Is the Pass/Merit/Distinction grade awarded justified by the assessor’s comments on the student work? Y/N Has the work been assessed accurately? Y/N Is the feedback to the student: Give details: • Constructive? • Linked to relevant assessment Y/N Y/N criteria? • Identifying opportunities for improved performance? Y/N Y/N • Agreeing actions? Does the assessment decision need amending? Y/N Assessor signature Date Internal Verifier signature Programme Leader signature (if required) Date UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA Date I Confirm action completed Remedial action taken Give details: Assessor signature Internal Verifier signature Programme Leader signature (if required) Date Date Date UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA II Higher Nationals – Summative Assignment Feedback Form Student Name/ID Unit Title Unit 11 : Maths for Computing Assignment Number 1 Assessor Date Received 1st submission Date Received 2nd submission Submission Date Re-submission Date Assessor Feedback: LO1 Use applied number theory in practical computing scenarios. Pass, Merit & Distinction P1 P2 M1 D1 Descripts LO2 Analyse events using probability theory and probability distributions. Pass, Merit & Distinction P3 Descripts P4 M2 D2 LO3 Determine solutions of graphical examples using geometry and vector methods. Pass, Merit & Distinction P5 P6 M3 D3 Descripts LO4 Evaluate problems concerning differential and integral calculus. Pass, Merit & Distinction P7 Descripts Grade: P8 M4 D4 Assessor Signature: Date: Assessor Signature: Date: Resubmission Feedback: Grade: Internal Verifier’s Comments: Signature & Date: * Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has taken place and grades decisions have been agreed at the assessment board. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA III General Guidelines 1. A Cover page or title page – You should always attach a title page to your assignment. Use previous page as your cover sheet and make sure all the details are accurately filled. 2. Attach this brief as the first section of your assignment. 3. All the assignments should be prepared using a word processing software. 4. All the assignments should be printed on A4 sized papers. Use single side printing. 5. Allow 1” for top, bottom , right margins and 1.25” for the left margin of each page. Word Processing Rules 1. 2. 3. 4. The font size should be 12 point, and should be in the style of Time New Roman. Use 1.5 line spacing. Left justify all paragraphs. Ensure that all the headings are consistent in terms of the font size and font style. Use footer function in the word processor to insert Your Name, Subject, Assignment No, and Page Number on each page. This is useful if individual sheets become detached for any reason. 5. Use word processing application spell check and grammar check function to help editing your assignment. Important Points: 1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the compulsory information. eg: Figures, tables of comparison etc. Adding text boxes in the body except for the before mentioned compulsory information will result in rejection of your work. 2. Avoid using page borders in your assignment body. 3. Carefully check the hand in date and the instructions given in the assignment. Late submissions will not be accepted. 4. Ensure that you give yourself enough time to complete the assignment by the due date. 5. Excuses of any nature will not be accepted for failure to hand in the work on time. 6. You must take responsibility for managing your own time effectively. 7. If you are unable to hand in your assignment on time and have valid reasons such as illness, you may apply (in writing) for an extension. 8. Failure to achieve at least PASS criteria will result in a REFERRAL grade . 9. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will then be asked to complete an alternative assignment. 10. If you use other people’s work or ideas in your assignment, reference them properly using HARVARD referencing system to avoid plagiarism. You have to provide both in-text citation and a reference list. 11. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be reduced to A REFERRAL or at worst you could be expelled from the course. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA IV Student Declaration I hereby, declare that I know what plagiarism entails, namely, to use another’s work and to present it as my own without attributing the sources in the correct way. I further understand what it means to copy another’s work. 1. I know that plagiarism is a punishable offence because it constitutes theft. 2. I understand the plagiarism and copying policy of the Edexcel UK. 3. I know what the consequences will be if I plagiaries or copy another’s work in any of the assignments for this program. 4. I declare therefore that all work presented by me for every aspects of my program, will be my own, and where I have made use of another’s work, I will attribute the source in the correct way. 5. I acknowledge that the attachment of this document signed or not, constitutes a binding agreement between myself and Edexcel UK. 6. I understand that my assignment will not be considered as submitted if this document is not attached to the attached. bhnkperera@gmail.com 10th October 2022 Student’s Signature: (Provide E-mail ID) Date: (Provide Submission Date) UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA V Feedback Form Formative Feedback : Assessor to Student Action Plan Summative feedback Feedback: Student to Assessor. Assessor’s Signature Student’s Signature Date Date UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA VI Assignment Brief Student Name /ID Number Jayasuriya Kuranage Bhanuka Perera NEG – E-118432 Unit Number and Title Unit 11 : Maths for Computing Academic Year 2021/2022 Unit Tutor Assignment Title Importance of Maths in the Field of Computing Issue Date Submission Date IV Name & Date Submission Format: This assignment should be submitted at the end of your lesson, on the week stated at the front of this brief. The assignment can either be word-processed or completed in legible handwriting. If the tasks are completed over multiple pages, ensure that your name and student number are present on each sheet of paper. Unit Learning Outcomes: LO1 Use applied number theory in practical computing scenarios. LO2 Analyse events using probability theory and probability distributions. LO3 Determine solutions of graphical examples using geometry and vector methods. LO4 Evaluate problems concerning differential and integral calculus. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA VII Assignment Brief and Guidance: Activity 01 Part 1 1. A tailor wants to make square shaped towels. The required squared pieces of cloth will be cut from a ream of cloth which is 20 meters in length and 16 meters in width. a) Find the minimum number of squared pieces that can be cut from the ream of cloth without wasting any cloth. b) Briefly explain the technique you used to solve (a). 2. On the first day of the month, 4 customers come to a restaurant. Afterwards, those 4 customers come to the same restaurant once in 2,4,6 and 8 days respectively. a) On which day of the month, will all the four customers come back to the restaurant together? b) Briefly explain the technique you used to solve (a). Part 2 3. Logs are stacked in a pile with 24 logs on the bottom row and 10 on the top row. There are 15 rows in all with each row having one more log than the one above it. a) How many logs are in the stack? b) Briefly explain the technique you used to solve (a). 4. A company is offering a job with a salary of Rs. 50,000.00 for the first year and a 4% raise each year after that. If that 4% raise continues every year, a) Find the total amount of money an employee would earn in a 10-years career. b) Briefly explain the technique you used to solve (a). Part 3 5. Define the multiplicative inverse in modular arithmetic and identify the multiplicative inverse of 6 mod 13 while explaining the algorithm used. 6. Prime numbers are important to many fields. In the computing field also prime numbers are applied. Provide examples and in detail explain how prime numbers are important in the field of computing. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA VIII Activity 02 Part 1 1. Define ‘Conditional Probability’ with a suitable example. 2. The manager of a supermarket collected the data of 25 customers on a certain date. Out of them 5 purchased Biscuits, 10 purchased Milk, 8 purchased Fruits, 6 purchased both Milk and Fruits. Let B represents the randomly selected customer purchased Biscuits, M represents the randomly selected customer purchased Milk and F represents the randomly selected customer purchased Fruits. Represent the given information in a Venn diagram. Use that Venn diagram to answer the following questions. a) Find the probability that a randomly selected customer either purchased Biscuits or Milk. b) Show that the events “The randomly selected customer purchased Milk” and “The randomly selected customer purchased Fruits” are independent. 3. Suppose a voter poll is taken in three states. Of the total population of the three states, 45% live in state A, 20% live in state B, and 35% live in state C. In state A, 40% of voters support the liberal candidate, in state B, 30% of the voters support the liberal candidate, and in state C, 60% of the voters support the liberal candidate. Let A represents the event that voter is from state A, B represents the event that voter is from state B and C represents the event that voter is from state C. Let L represents the event that a voter supports the liberal candidate. a) Find the probability that a randomly selected voter does not support the liberal candidate and lives in state A. b) Find the probability that a randomly selected voter supports the liberal candidate. c) Given that a randomly selected voter supports the liberal candidate, find the probability that the selected voter is from state B. 4. In a box, there are 4 types [Hearts, Clubs, Diamonds, Scorpions] of cards. There are 6 Hearts cards, 7 Clubs cards, 8 Diamonds cards and 5 Scorpions cards in the box. Two cards are selected randomly without replacement. a) Find the probability that the both selected cards are Hearts. b) Find the probability that one card is Clubs and the other card is Diamonds. c) Find the probability that the both selected cards are from the same type. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA IX Part 2 5. Differentiate between ‘Discrete Random Variable’ and ‘Continuous Random Variable”. 6. Two fair cubes are rolled. The random variable X represents the difference between the values of the two cubes. a) Find the mean of this probability distribution. (i.e. Find E[X] ) b) Find the variance and standard deviation of this probability distribution. (i.e., Find V[X] and SD[X]) The random variables A and B are defined as follows: A = X-10 and B = [(1/2)X]-5 c) Show that E[A] and E[B]. d) Find V[A] and V[B]. e) Arnold and Brian play a game using two fair cubes. The cubes are rolled, and Arnold records his score using the random variable A and Brian uses the random variable B. They repeat this for a large number of times and compare their scores. Comment on any likely differences or similarities of their scores. 7. A discrete random variable Y has the following probability distribution. Y=y 1 P(Y=y) 1/3 where k is a constant. a) Find the value of k. b) Find P(Y≤3). c) Find P(Y>2). 2 1/6 3 1/4 4 k 5 1/6 Part 3 10. The “Titans” cricket team has a winning rate of 75%. The team is planning to play 10 matches in the next season. a) Let X be the number of matches that will be won by the team. What are the possible values of X? b) What is the probability that the team will win exactly 6 matches? c) What is the probability that the team will lose 2 or less matches? d) What is the mean number of matches that the team will win? e) What are the variance and the standard deviation of the number of matches that the team will win? UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA X 11. In a boys’ school, there are 45 students in grade 10. The height of the students was measured. The mean height of the students was 154 cm and the standard deviation was 2 cm. Alex’s height was 163 cm. Would his height be considered an outlier, if the height of the students were normally distributed? Explain your answer. 12. The battery life of a certain battery is normally distributed with a mean of 90 days and a standard deviation of 3 days. For each of the following questions, construct a normal distribution curve and provide the answer. a) About what percent of the products last between 87 and 93 days? b) About what percent of the products last 84 or less days? For each of the following questions, use the standard normal table and provide the answer. c) About what percent of the products last between 89 and 94 days? d) About what percent of the products last 95 or more days? 13. In the computing field, there are many applications of Probability theories. Hashing and Load Balancing are also included to those. Provide an example for an application of Probability in Hashing and an example for an application of Probability in Load Balancing. Then, evaluate in detail how Probability is used for each application while assessing the importance of using Probability to those applications. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA XI Activity 03 Part 1 1. Find the equation (formula) of a circle with radius r and center C(h,k) and if the Center of a circle is at (3,-1) and a point on the circle is (-2,1) find the formula of the circle. 2. Find the equation (formula) of a sphere with radius r and center C(h, k, l) and show that x2 + y2 + z2 - 6x + 2y + 8z - 4 = 0 is an equation of a sphere. Also, find its center and radius. 3. Following figure shows a Parallelogram. If a=(i+3j-k) , b=(7i-2j+4k), find the area of the Parallelogram. Part 2 4. If 2x - 4y =3, 5y = (-3)x + 10 are two functions. Evaluate the x, y values using graphical method. 5. Evaluate the surfaces in β3 that are represented by the following equations. i. y = 4 ii. z = 5 6. Following figure shows a Tetrahedron. Construct an equation to find the volume of the given Tetrahedron using vector methods and if the vectors of the Tetrahedron are a=(i+4j-2k) , b=(3i-5j+k) and c=(-4i+3j+6k), find the volume of the Tetrahedron using the above constructed equation. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA XII Activity 04 Part 1 1. Determine the slope of the following functions. i. f(x) = 2x – 3x4 + 5x + 8 ii. f(x) = cos(2x) + 4x2 – 3 2. Let the displacement function of a moving object is S(t) = 5t3 – 3t2 + 6t. What is the function for the velocity of the object at time t. Part 2 3. Find the area between the two curves f(x) = 2x2 + 1 and g(x) = 8 – 2x on the interval (-2) ≤ x ≤ 1 . 4. It is estimated that t years from now the tree plantation of a certain forest will be increasing at the rate of 3t 2 + 5t + 6 hundred trees per year. Environmentalists have found that the level of Oxygen in the forest increases at the rate of approximately 4 units per 100 trees. By how much will the Oxygen level in the forest increase during the next 3 years? Part 3 5. Sketch the graph of f(x) = x5- 6x3 + 3 by applying differentiation methods for analyzing where the graph is increasing/decreasing, local maximum/minimum points [Using the second derivative test], concave up/down intervals with inflection points. 6. Identify the maximum and minimum points of the function f(x)= 2x3 - 4x4 + 5x2 by further differentiation. [i.e. Justify your answer using both first derivative test and second derivative test.] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA XIII Grading Rubric Grading Criteria Achievement (Yes/No) Feedback LO1 : Use applied number theory in practical computing scenarios. P1 : Calculate the greatest common divisor and least common multiple of a given pair of numbers. P2 : Use relevant theory to sum arithmetic and geometric progressions. M1 : Identify multiplicative inverses in modular arithmetic. D1 : Produce a detailed written explanation of the importance of prime numbers within the field of computing. LO2 : Analyze events using probability theory and probability distributions. P3 : Deduce the conditional probability of different events occurring within independent trials. P4 : Identify the expectation of an event occurring from a discrete, random variable. M2 : Calculate probabilities within both binomially distributed and normally distributed random variables. D2 : Evaluate probability theory to an example involving hashing and load balancing. LO3 : Determine solutions of graphical examples using geometry and vector methods. P5 : Identify simple shapes using co-ordinate geometry. P6 : Determine shape parameters using appropriate vector methods. M3 : Evaluate the coordinate system used in programming a simple output device. D3 : Construct the scaling of simple shapes that are described by vector coordinates. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 14 LO4 : Evaluate problems concerning differential and integral calculus. P7 : Determine the rate of change within an algebraic function. P8 : Use integral calculus to solve practical problems involving area. M4 : Analyse maxima and minima of increasing and decreasing functions using higher order derivatives. D4 : Justify, by further differentiation, that a value is a minimum. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 15 ACKNOWLEDGMENT Primarily, I would like to express my sincere gratitude to the lecturer of this unit, Mr. Nadheera Senasinghe , for the delivery of valuable lectures, assignment guidance and review sessions conducted to examine our progress from time to time. Aside from him, I would also like to extend my gratitude to the management of ESoft Metro Campus for conducting extra guidance sessions and for providing the necessary facilities to join online learning due to the prevailing pandemic situation. Finally, I would also like to thank my family and my dear batch mates for their support and encouraging me during this challenging time. Regards, J.K Bhanuka Perera UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 16 Content ACKNOWLEDGEMENT .................................................................................................... 16 Activity 01 .................................................................................................................... 18 Part 1 ..................................................................................................................................... 18 Part 2 ..................................................................................................................................... 20 Part 3 ..................................................................................................................................... 24 Activity 02 .................................................................................................................... 27 Part 1 ..................................................................................................................................... 27 Part 2 ..................................................................................................................................... 34 Part 3 ..................................................................................................................................... 43 Activity 03 .................................................................................................................... 51 Part 1 ..................................................................................................................................... 51 Part 2 ..................................................................................................................................... 54 Activity 04 .................................................................................................................... 59 Part 1 ..................................................................................................................................... 59 Part 2 ..................................................................................................................................... 61 Part 3 ..................................................................................................................................... 63 REFERENCES ............................................................................................................ 68 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 17 List of figures Figure 1. Load balancing | Source (nginx. 2022) .....................................................................51 Figure 2. graphs for the above function | Source (Author's work) ...........................................56 Figure 3. y = 4 graph | Source (Author’s work) .......................................................................57 Figure 4. Z = 5 | Source (Author’s work).................................................................................57 Figure 5. the graph | Source (Author's work) ...........................................................................67 List of tables Table 1. Differences Discrete and Continuous Random Variable.| Source (Author's work) ..37 Table 2. Decreasing increasing intervals | Source (Author's work). ........................................64 Table 3. Concavity graph | Source (Author's work). ................................................................66 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 18 Activity 01 Part 1 1) A tailor wants to make square shaped towels. The required squared pieces of cloth will be cut from a ream of cloth which is 20 meters in length and 16 meters in width. a) Find the minimum number of squared pieces that can be cut from the ream of cloth without wasting any cloth. GCF or Greatest Common Divisor is the largest common factor of two or more numbers G.C.F of 20 & 16, 20 = 2 x 2 x 5 x 1 16 = 2 x 2 x 2 x 2 x 1 2 2 Greatest Common Factor = 2 x 2 =4 Area of a piece =4*4 = 16 Area of the cutting piece = 20 * 16 = 320 ∴ The minimum number of square pieces that can be cut by a loom without wasting Number of square pieces = 320 / 16 fabric is 20. = 20 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 19 b) Briefly explain the technique you used to solve (a). The method I used above is called the greatest common factor. GCF stands for "greatest common factor" among other things. There are several methods use to find the highest/greatest common factor. It depends on how many numbers you have, how large they are and what you will do with the result. It is useful when we want to simplify a part. For example, the GCF of the given case is 4. Hence, the common factor of 20 and 16 is 4, and we can divide both these numbers by 4. Finding the greatest common factor is a simple process. We must first determine all the components of both numbers, then find the one that is most common to both, and then select the greatest. Using the previous example, we can calculate the length of one side of the fabric using GCF. The final answer is 20 square pieces. 2) On the first day of the month, 4 customers come to a restaurant. Afterwards, those 4 customers come to the same restaurant once in 2,4,6 and 8 days respectively. a) On which day of the month, will all the four customers come back to the restaurant together? 2=2x1 4=2x2 6=2x3 8=2x2x2 L.C.M = 2 x 2 x 2 x 3 x 1 N = 24 N + 1 day = 25 ∴ On the 25th day of the month, all four customers will visit the restaurant. together. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 20 b) Briefly explain the technique you used to solve (a). The Least Common Multiple approach is what I used above. The smallest of all common multiples is the Least Common Multiple or L.C.M. Using the example above, the numbers provided are 2, 4, 6 and 8 respectively. Consequently, the most common multiples are 2, 2, 2, 3, and 1. Consequently, the product of these numbers is 24, and the smallest number formed by the above numbers is also 24. After subtracting the first day and adding 1 to the total of 24 days, all four customers will return on the 25th day. LCM is the lowest two or more numbers that are evenly divided by all numbers in the set. Part 2 3). A Logs are stacked in a pile with 24 logs on the bottom row and 10 on the top row. There are 15 rows in all with each row having one more log than the one above it. a) How many logs are in the stack? ππ = π (π + π) 2 π15 = 15 (24 ∗ 10) 2 a = 24 l = 10 n = 15 = 15 * 32 / 2 π15 = 15 ∗ 17 π15 = πππ ∴ There are 255 logs in the stack. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 21 b) Briefly explain the technique you used to solve (a). The bottom row has 24 logs. And 10 logs in the top row. In each row, one log is lower than the previous row from the bottom. There are about 10 rows in the stack. So, we can use the following formula to calculate the total number of logs in the stack. This is used to find the sum of an arithmetic series. πΊπ = π (π + π) π According to this formula, - “Sn” is referred to total of the arithmetic series. - ”n” refers to numbers of terms in arithmetic series - “a” refers to first term in the series - “l” refers to the last term in the series. [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 22 4. A company is offering a job with a salary of Rs. 50,000.00 for the first year and a 4% raise each year after that. If that 4% raise continues every year a) Find the total amount of money an employee would earn in a 10-year career. π (π π − 1) ππ = π−1 π10 600000(1.0410 − 1) = 1.04 − 1 6 ∗ 105 (1.48 − 1) = 0.04 a = 600000 r = 0.04 n = 10 πΊππ = πππππππ ∴ The total amount earned by an employee in this career in 10 years is Rs. 7 203 664.00 [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 23 a) Briefly explain the technique you used to solve (a). This is an arithmetic progression. The formula used above is used to find the sum of a geometric series. According to the question, the monthly salary of an employee is 50000/-. 600000/- per annum per employee. (50000 x 12). So, the salary of an employee for the first year is Rs.600000. Salary is increased from 4% every year. Salary for first year = 50000 * 12 = Rs.600 000/= Salary for second year = 600000 * (104/100) = Rs.624 000/= Salary for third year = 624000 ∗ ( 104 100 ) = Rs.648 960/= Common Growth Factor (r) = 648960 / 624000 = 1.04 According to the formula, S10 stands for total salary for the 10 years of an employee (r) Stands for growth factor. It is 1.04 as found above. And n is the numbers of terms in series. We need to find the salary in 10 years. Therefore, value 10 can be used as n for the formula. By replacing those values to the formula, Total salary for 10 years can be found. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 24 Part 3 5. Define the multiplicative inverse in modular arithmetic and identify the multiplicative inverse of 6 mod 13 while explaining the algorithm used. Multiplicative inverse in modular arithmetic, Especially in the field of mathematics, a modular multiplicative inverse of an integer a is an integer that is congruent to the product of ax with respect to modulus m. [1] This equality is expressed in the standard notation of modular arithmetic, ππ ≡ π(πππ π) It is a condensed way of saying that the quantity m ax is divided (equally) by 1, or in other words, the result of dividing ax by the number m is 1. This congruence has an infinite number of solutions, which are formed. A congruence class with respect to this modulus, if a has an inverse modulus m. Identify the multiplicative inverse of 6 mod 13 6 * 0 ≡ 0 ≡ 0 (mod 13) 6 * 1 ≡ 6 ≡ 6 (mod 13) 6 * 2 ≡ 12 ≡ 12 (mod 13) 6 * 3 ≡ 18 ≡ 5 (mod 13) 6 * 4 ≡ 24 ≡ 11 (mod 13) 6 * 5 ≡ 30 ≡ 4 (mod 13) 6 * 6 ≡ 36 ≡ 10 (mod 13) 6 * 7 ≡ 42 ≡ 3 (mod 13) 6 * 8 ≡ 48 ≡ 9 (mod 13) 6 * 9 ≡ 54 ≡ 2 (mod 13) 6 * 10 ≡ 60 ≡ 8 (mod 13) 6 * 11 ≡ 66 ≡ 1 (mod 13) The 6 mod 13 = 11 ∴ 11 will be the modular inverse for 6 mod 13, which can be represented as 6 -1 = 11 mod 13. 6 * 12 ≡ 72 ≡ 7 (mod 13) UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 25 The multiplicative inverse of a number x and m is a number y such that xy = 1 (mod m) and we write it like y = x-1. 6x = 1 (mod 13) 13 = 12 + 1 = 2*6 + 1 (the remainder term here is the GCD) Therefore, 1 = 13 – 2*6 and taken mod 13, 1 = 13 – 2*6 = - 2.6 And -2 = 11 (mod 13) So, the inverse of 6 mod 13 is 11. The algorithm used to find the inverse is called Euclid's algorithm. It is a means of subtracting the GCD of two given integers. A multiplicative inverse of a number is defined as a number whose original number is multiplied by one. a-1 or 1/a denotes the multiplicative inverse of 'a'. In other words, if the product of two integers is 1, they are multiplicative inverses of each other. [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 26 6. Prime numbers are important to many fields. In the computing field also prime numbers are applied. Provide examples and in detail explain how prime numbers are important in the field of computing. Cryptography Prime numbers are used to encrypt and decrypt data. By selecting 2 large prime numbers like 6-digit primes and multiplying them we can obtain a strong primary key. It is easy to obtain the key. But it is very difficult to find the 2 prime numbers from the given product number (decrypt). It would take a long time decode the key even from super computers to find the numbers. In that time the transaction could be completed and data will be secure. Hashing Hashing is an algorithm that computes a string value from a fixed-size file and is a secure way to identify and compare databases and files. Hashing works using the Rivest-Shamir-Adleman algorithm to create and declare private and public keys using large prime numbers and extra value. Because prime numbers are kept secret, only the person with the prime number can encrypt and decrypt messages. Gödel Numbering Gödel numbering system is the method of representing any sentence, sequence of words or symbols with a corresponding number. These numbers must be unique as no 2 combinations can have the same number. Hence prime numbers are used for their uniqueness. This system is a one-to-one task. That means it converts one value to number and takes the second value, converts it to number and carries on. Computing Hash Codes This is a numerical code assigned to each object generated by the software. Quickly retrieving/storing complex items from a hash table or in it, requires hash codes. To ensure accuracy, hash codes must be fairly unique for each item. For this reason, prime integers are used when calculating hash codes. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 27 Activity 02 Part 1 1. Define ‘Conditional Probability’ with a suitable example. Conditional probability is the measure of the probability of an event occurring given that another event has previously occurred in probability theory. This process depends on event B, which is tied to another event in some way. In this situation, event B can be tested in relation to event A using conditional probability. If A is the event of interest and B is known or assumed to have occurred. "Conditional probability of B given A", or "probability of B under condition A" is usually written as P (A | B) [2] or occasionally P B (A). This is the portion of probability B that overlaps with probability A. Conditional probability, as defined earlier, depends on the prior outcome. Imagine you draw 3 marbles from a bag: red, green and blue. Each marble has an equal probability of being selected. What is the possibility of drawing a red marble after drawing blue? As a first step, it is one of three possible outcomes, the probability of drawing a blue marble is about 33%. After the initial event occurs, two marbles will remain with a 50% chance of each being drawn. The probability of getting a blue marble after drawing a red marble is about 16.5% (33% x 50%). There are two formulas used in conditional probability, UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 28 2. The manager of a supermarket collected the data of 25 customers on a certain date. Out of them 5 purchased Biscuits, 10 purchased Milk, 8 purchased Fruits, 6 purchased both Milk and Fruits. Let B represents the randomly selected customer purchased Biscuits, M represents the randomly selected customer purchased Milk and F represents the randomly selected customer purchased Fruits. Represent the given information in a Venn diagram. Use that Venn diagram to answer the following questions. M - Milk B – Biscuits F - Fruits a) Find the probability that a randomly selected customer either purchased Biscuits or Milk. Probability of randomly selected customer purchasing Biscuit P (π΅) = (5/25) = (1/5) Probability of randomly selected customer purchasing Milk π (π) = (10/25) = (2/5) Probability of randomly selected customer purchase Milk or Biscuit π (π΅ ∪ π) = (1/5) + (2/5) = (3/5) ∴ There is (3/5) probability that the randomly selected customer purchase either Milk or Biscuit. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 29 b) Show that the events “The randomly selected customer purchased Milk” and “The randomly selected customer purchased Fruits” are independent. If the randomly selected consumer purchases and the randomly selected consumer purchases fruits are independent, then the theorem must be proved below. P (M ∩ F) = P (M) x P (F) Probability of purchasing milk P (M) = 10/25 Probability of purchasing milk P (M) = 8/25 P (M ∩ F) = P (F) x P (M) = 10/25 x 8/25 = 16/125 But in Venn diagram, we can clearly see that (π ∩ πΉ) = 6/25 6/25 ≠ 16/125 ∴ π(π ∩ πΉ) ≠ π(π) × π(πΉ) So, by using above theorem we can see that randomly selected customer purchase Milk and the randomly selected customer purchase Fruits are not Independent. [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 30 3. Suppose a voter poll is taken in three states. Of the total population of the three states, 45% live in state A, 20% live in state B, and 35% live in state C. In state A, 40% of voters support the liberal candidate, in state B, 30% of the voters support the liberal candidate, and in state C, 60% of the voters support the liberal candidate. Let A represents the event that voter is from state A, B represents the event that voter is from state B and C represents the event that voter is from state C. Let L represents the event that a voter supports the liberal candidate. a) Find the probability that a randomly selected voter does not support the liberal candidate and lives in state A. Probability of a randomly selected voter who does not support the liberal candidate and lives in state A = A * the percentage of voters who do not support the liberal candidate in state A's population. = (60/100) x (45/100) = 27 % ∴ Probability of randomly selected voter doesn’t support liberal candidate and lives in state A is 27 %. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 31 b) Find the probability that a randomly selected voter supports the liberal candidate. The probability of a randomly selected customer support liberal candidate is equal to: State A Population * State A Liberal Candidate Supporters + State B Population * State B Liberal Candidate Supporters + State C Population * State C Liberal Candidate Supporters = 45 40 20 30 35 60 π + π + π 100 100 100 100 100 100 18 6 21 = + + 100 100 100 45 ∴ Randomly selected voter = 100 supports the liberal candidate is = π ππ 9/20 c) Given that a randomly selected voter supports the liberal candidate, find the probability that the selected voter is from state B. The probability of a randomly selected voter supporting the liberal candidate in state B = population of state B * liberal supporters in state B. 20 30 π 100 100 60 = 100 = = π% Since a randomly selected voter supports the liberal candidate, the probability that the selected voter is from state B is equal to the product of liberal candidate support times liberal candidate supporters in state B. = 45 100 x 6 100 = 2.7% UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 32 4. In a box, there are 4 types [Hearts, Clubs, Diamonds, Scorpions] of cards. There are 6 Hearts cards, 7 Clubs cards, 8 Diamonds cards and 5 Scorpions cards in the box. Two cards are selected randomly without replacement. a) Find the probability that both selected cards are Hearts. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 33 b) Find the probability that one card is Clubs and the other card is Diamonds. Probability of both selected cards are heart, = 6 26 = = c) x 5 25 30 650 π ππ Find the probability that both selected cards are from the same type. Probability of both selected cards are same type, = 6 26 x 5 25 = + 7 26 30 650 x + 6 25 42 650 = = + + 8 26 x 56 650 7 25 + + 5 26 x 4 25 20 650 148 650 ππ πππ UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 34 Part 2 5. Differentiate between ‘Discrete Random Variable’ and ‘Continuous Random Variable”. A variable is a named unit of data that is assigned a value. If the value is changed, the name of the variable will not change. In the context of a mathematical problem or experiment, a variable is a quantity that can change. A variable is often represented by a single letter. Variables are usually represented by the letters x, y, and z. There are several types of variables. (Definitions and Hope, 2022) Discrete Random Variable A discrete random variable is a variable that can have any outcome in a random experiment that is an integer. Discrete random variables have a finite number of alternative outcomes, which can be counted as 0, 1, 2, 3, 4, . To display the values of discrete random variables, probability distributions are used. A stochastic variable is another name for a discrete random variable. Binomial and Poisson random variables are two examples of discrete random variables. In general, there are two forms of data: discrete and continuous. In this case, a discrete random variable is considered. Additionally, an algebraic variable and a discrete random variable are not the same thing. A discrete random variable has several values, but an algebraic variable has only one. The results of a random experiment are calculated using a discrete random variable. A countable number of outcomes can be considered for discrete random variables. A discrete random variable can usually be numbered as 0, 1, 2, 3, 4, . Both discrete and continuous data types are possible; In this case, discrete random variables are considered. To illustrate how probabilities are spread over the values of discrete random variables, probability distributions are used. As for an example: Suppose two dice are rolled and the sum of the numbers is represented by the random variable X. Then, 1 + 1 = 2 results in the smallest value of X and 6 + 6 = 12 results in the largest value. The value of X. Consequently, X can have values from 2 to 12. The probability distribution of X can now be established if probabilities are assigned to each outcome. It is important to distinguish a discrete random variable from an algebraic variable. The value of an unknown quantity in an algebraic equation that can be determined is represented by an algebraic variable. A discrete random variable, However, can have a range of values that can represent the outcome of the experiment. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 35 Continuous Random Variable A continuous random variable is one that has a range of possible values. In other words, if a random variable follows a value that fits within a specified range, it is said to be continuous. Measurements such as height, weight, and time are all represented by continuous random variables. A continuous random variable is represented as the area under a density curve. A random variable is one whose value changes in every possible instance in an experiment. A discrete random variable is defined at a specific value, while a continuous random variable is defined over a range of values. A random variable with an infinite number of possible values is called a continuous random variable. As a result, a continuous random variable has no chance of having a specific value. The characteristics of a continuous random variable are described using the probability density function and the cumulative distribution function. The probability associated with a continuous random variable is expressed using the probability density function (pdf) and the cumulative distribution function (CDF). As for an example: Suppose that the probability density function of a continuous random variable X is given by 4x3, where x ∈ [0, 1]. Determine the probability that X takes a value between 1/2 and 1. This can be done by integrating 4x3 between 1/2 and 1. Thus, the required probability is 15/16. [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 36 Differences between Discrete Random Variable and Continuous Random Variable. The following are some key differences between discrete random variables and continuous random variables, • A continuous random variable's value fluctuates within a specified range, while a discrete random variable can take on a specified value. • As a consequence, a probability mass function is used to describe a discrete random variable and a probability density function describes a continuous random variable. • Binomial, geometric, Bernoulli, and Poisson random variables are some examples of distributions with discrete random variables. Normal and exponential random variables are two types of continuous random variable distributions. Table 1. Differences of Discrete and Continuous Random Variable.| Source (Author's work) UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 37 6). Two fair cubes are rolled. The random variable X represents the difference between the values of the two cubes. The probability distribution of X a) Find the mean of this probability distribution. (i.e., Find E[X] ) The mean of the probability distribution, E(X) = μ = ∑x.P(x) = 0 + 0.278 + 0.444 + 0.501 + 0.444+ 0.28 μ = 1.947 ∴ The mean is 1.947 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 38 b) Find the variance and standard deviation of this probability distribution. (i.e., Find V[X] and SD[X]) The random variables A and B are defined as follows: A = X-10 and B = [(1/2)X]-5 The random variables A and B are defined as follows: A = X-10 and B = [(1/2) X]-5 Find the V(x): V(x) = E(x2) – [E(x)] 2 E(x2) = ∑ x2. P(x) = ( -52 x 1/36) + (-42 x 2/36)+ (-32 x 3/36) + (-22 x 4/36) + (-12 x 5/36) + (02 x 6/36) + (12 x 5/36) + (22 x 4/36) + (32 x 3/36) + (42 x 2/36) + (52 x 1/36) = + 25/36 + 32/36 + 27/36 + 16/36 + 5/36 + 0 + 5/36 + 16/36 + 27/36 + 32/36 +25/36 = 210/36 = 5.833 [E(x)] 2 = 02 V(x) = 5.833 – 0 V(x) = 5.833 Find SD(x): SD(x) = √V(x) SD(x) = √5.833 = 2.415 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 39 c) Show that E[A] and E[B]. A = X-10 E(A) = E(X) – 10 = 1.947-10 = -8.053 B = [(1/2)X]-5 E(B) = [(1/2)E(X)] – 5 = 1.947/2 - 5 = -4.027 d) Find V[A] and V[B]. V(A) = V(X) = 16.87 V(B) = (1/2)2 * V(X) = 16.87 / 4 = 4.2175 [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 40 e) Arnold and Brian play a game using two fair cubes. The cubes are rolled, and Arnold records his score using the random variable A and Brian uses the random variable B. They repeat this for a large number of times and compare their scores. Comment on any likely differences or similarities of their scores. The difference is that they use two different dice with different outcomes and the similarity is that they use two fair dice with a random variable with different outcomes. Arnold uses the random variable A to record the score when the dice are rolled, while the brain uses the random variable B. Then there is a random variable with values nn, which is the number of times Arnold rolls the fair pair of dice, and pp, which is the probability of success with the random variable AA for each value. Consider the random variable section, which denotes nn, the number of times the brain rolls a fair pair of dice, and pp, the chance of success, where each value can take a random variable BB. The probability distribution has the same binomial distribution with parameters nn and pp. ∴ As proven above E (B) = (1/2) E (A). If Arnold and Brian recorded their scores using random variable A and B, Arnold’s score will be half of the score of brains. [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 41 7) A discrete random variable Y has the following probability distribution. Y=y 1 2 3 4 5 P(Y=y) 1/3 1/6 1/4 k 1/6 where k is a constant. a) Find the value of k. π(π) = 1 π(π) = π(1) + π(2) + π(3) + π(4) + π(5) = 1 1 1 1 + + + πΎ + 3 6 4 6 = 0.333 + 0.167 + 0.25 + πΎ + 0.167 1 = 0.918 + πΎ πΎ = 1 − 0.917 π² = π. πππ ∴ The value of K = 0.083 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 42 b) Find P(Y≤3) π(πΎ ≤ 3) π(π¦ ≤ 3) = π(π¦ = 1) + π(π¦ = 2) + π(π¦ = 3) = 1 1 1 + + 3 6 4 = π π c) Find P(Y>2) π(π¦ > 2) = π(π¦ = 3) + π(π¦ = 4) + π(π¦ = 5) = 1 1 1 + + 4 12 6 = π π UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 43 Part 3 10. The “Titans” cricket team has a winning rate of 75%. The team is planning to play 10 matches in the next season. a) Let X be the number of matches that will be won by the team. What are the possible values of X? = xn b⁄n (10,0,0.75) π = π, π, π, π, π, π, π, π, π, π, ππ b) What is the probability that the team will win exactly 6 matches? π(π₯ = 6) = πππ₯ π π₯ (π)π−π₯ = 10 πΆ ∗ (0.75)6 ∗ (1 − 0.75)10−6 6 = π. ππππππ c) What is the probability that the team will lose 2 or less matches? P(X ≥ 8) = P(X = 8) + P(X = 9) + P(X = 10) = 10C8 (0.75)8 (0.25)10-8 + 10C9 (0.75)9 (0.25)10-9 + 10C10 (0.75)10 (0.25)10-10 = (45 × 0.1001 × 0.0625) + (10 × 0.075 × 0.25) + (1 × 0.0jj563 × 1) = 0.2815 + 0.1875 + 0.0563 = 0.5256 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 44 d) What is the mean number of matches that the team will win? π(π₯) = π ∗ π = 10 ∗ 0.75 = π. π e) What are the variance and the standard deviation of the number of matches that the team will win? π£ππ(π₯) = π ∗ π ∗ π = 10 ∗ 0.75 ∗ 0.25 = π. πππ [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 45 11. In a boys’ school, there are 45 students in grade 10. The height of the students was measured. The mean height of the students was 154 cm and the standard deviation was 2 cm. Alex’s height was 163 cm. Would his height be considered an outlier, if the height of the students were normally distributed? Explain your answer. π§ π ππππ = = 163 − = π. π ππππ ππ‘ππππππ πππ£πππ‘πππ 154 2 Total students – 45 Mean height (µ) = 154 cm Standard deviation (σ) = 2 cm The height of Alex is 4.5 standard deviations above the mean value indicating that Alex will be in the 3 percent outside the 3-standard deviation unit. Heights below than 148cm and 160cm are known/mentioned as outliners. ∴ Alex’s height is 163 cm. and it is greater than 160cm. Alex will be an outlier So, his height is an outliner. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 46 12. The battery life of a certain battery is normally distributed with a mean of 90 days and a standard deviation of 3 days. For each of the following questions, construct a normal distribution curve and provide the answer. a) About what percent of the products last between 87 and 93 days? To calculate the percentage of battery life that last between 87 and 93 days we must calculate the z score for the given data points 87 and 93. Here z score is the standard deviation units from the mean Z score for day 87 Mean (µ) = 90, Standard deviation (σ) = 3, According to the provided data, µ + σ = 93 ∴ 68.2 % is the answer µ - σ = 87 Percentage of the products lasts 87 – 93 days = 68.26% UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 47 b) About what percent of the products last 84 or less days? According to second standard deviation theory, Mean (µ) = 90, Standard deviation (2σ) = 6 µ + 2σ = 96 µ - 2σ = 84 Percentage of products lasts 84 or less days = 1.0000 – 0.9546 2 = 0.0227 = 2.27% c) About what percent of the products last between 89 and 94 days? P (89 < X < 94) = P (X < 94) – P (X ≤ 89) = P (Z < [94 − 90) 89 − 90 ] – P [Z ≤ ] 3 3 = P(Z < 1.3333)– P(Z ≤ −0.3333) = 0.9088 – 0.3694 = 53.94% UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 48 d) About what percent of the products last 95 or more days? P (X ≥ 95) = 1 – P (X < 95) = 1 – P [Z < (95 - 90)/3] = 1 – P (Z < 1.67) = 1 – 0.952 = 4.8% 13. In the computing field, there are many applications of Probability theories. Hashing and Load Balancing are also included to those. Provide an example for an application of Probability in Hashing and an example for an application of Probability in Load Balancing. Then, evaluate in detail how Probability is used for each application while assessing the importance of using Probability to those applications. Hashing Hashing is the process of converting a given key into another value. A hash function is used to initialize the new value according to a mathematical algorithm. The result of a hash function is called a hash value or simply a hash. In general, a good job uses a one-way hashing algorithm. In other words, the hash cannot be converted back to the original key. The effectiveness of all hashing algorithms is determined by how often this happens. A hash table is an associative data structure that holds data. Data is stored in an array format in a hash table where each data item has a unique index value. Data access is very fast when the required data index is known. This makes it a data structure that can be inserted and searched very quickly, regardless of the size of the data. A hash table uses an array to create an index into which an element is to be inserted or located using hash access. UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 49 Let's see how it works. A table of average size T maps the hash function h. To add x to a set we evaluate h(x) and store x at position h(x) in the table (i.e., use the hash function to key). All keys are assigned to the same. The table position of our set is saved in a simple linked list. The DELETE and MEMBER operations are implemented in the same way by evaluating h(x). Note that the effectiveness of a hash function depends on Minimal conflict. The search time for DELETE and MEMBER operations is proportional to the length of the associated list. Source: (What is hashing? 2022) Balls and bins Let's start this problem by putting small balls and bowls into the structure. The balls will represent the keys to be saved (m), and the bins will represent the positions (n) in the hash table (T). Because the hash function maps each key to a random location in the table (T). We think of each key (ball) as selecting a hash table location (bin) equally and independently (T). Consequently, the probability space corresponding to this hashing experiment is the same as the ball-and-bin space. We are interested in event A, which is either no collision or all m balls landing in different bins. Clearly, as m increases, P(A) decreases (with n fixed). Our objective is to find the largest value of m for which P(A) is greater than 50%. Load balancing Load balancing, commonly referred to as server farming or server pooling, is the process of efficiently distributing incoming network traffic between backend servers. Modern high-traffic websites must respond quickly and reliably to millions, not hundreds of thousands, of concurrent user or server requests for accurate text, photos, videos, or application data. Modern computing best practices typically require the addition of additional servers to cost-effectively scale to handle these enormous volumes. A load balancer serves as a "traffic policeman" in front of your servers, distributing server requests across all servers equipped to handle them in a way that maximizes speed and capacity utilization, and ensures that no servers are overworked, which could cause performance degradation. . If one server goes offline, the load balancer moves traffic to the active servers. "The load balancer initiates requests to a new server when it is added to the server group." (“Elastic Load Balancing in AWS - Geekflare”) UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 50 Figure 1. Load balancing | Source (nginx. 2022) Assume we have m tasks and n processors all identical. The goal is to distribute the workload among the processors in such a way that no single processor is overloaded. Of course, there is a direct optimal solution here. Divide the work as evenly as possible so that each processor gets m/n jobs. However, this solution requires a lot of centralized control and/or communication: the workload must be distributed evenly by using a powerful centralized scheduler that communicates with all processors, or by exchanging many messages between jobs and processors. In most distributed systems, this type of operation is very expensive. We can simply apply the ball and bin method here to get rid of the cost. In another way, each job randomly and independently of the others selects a processor and sends it to the processor. (Make sure you imagine that the probability space in this experiment is the same as the space for balls and pots.). Communication is not required in this approach. However, it is unlikely to achieve perfect weight balance in most cases. Let Ak be when the weight of a processor is at least k. [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 51 Activity 03 Part 1 1. Find the equation (formula) of a circle with radius r and center C(h,k) and if the Center of a circle is at (3,-1) and a point on the circle is (-2,1) find the formula of the circle. Center of the circle = C (h,k) Radius of the circle = r (x, y) is any point of the circle r c(3, −1)(−2,1) r 2 = (3 − (−2))2 + ((−1) – (1))2 r 2 = (5)2 + (−2)2 r 2 = 29 π = π. πππ r = √29 Or else, π 2 = π₯ 2 + π¦ 2 – 2βπ₯ − 2ππ¦ + β2 + π 2 29 = π₯ 2 + π¦ 2 – 2(3)π₯ − 2(−1)π¦ + (3)2 + (−1)2 29 = π₯ 2 + π¦ 2 − 6π₯ + 2π¦ + 10 π± π + π² π − ππ± + ππ² − ππ = π ∴ Formula of the circle is = x2 + y2 – 6x + 2y – 19 = 0 and radius is (r) = √29 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 52 2. Find the equation (formula) of a sphere with radius r and center C(h, k, l) and show that x2 + y2 + z2 - 6x + 2y + 8z - 4 = 0 is an equation of a sphere. Also, find its center and radius. Centre of the sphere = C (h, k, l) (h,k,l) r (x,y,z) Radius of the sphere = r (x, y, z) is any point of the sphere. Sphere is the 3D representation of a circle. So, the equation of the sphere is also similar to the equation of circle but with one extra dimension. √ (π₯ − β) 2 + (π¦ − π) 2 + (π§ − π) 2 = r (π − π)π + (π − π)π + (π − π)π = ππ x2 + y2 + z2 – 6x +2y +8z – 4 = 0 x2 – 6x + y2 + 2x + z2 + 8z – 4 =0 (x - 3)2 + (y + 1)2 + (z + 4)2 – 26 – 4 = 0 (x - 3)2 + (y + 1)2 + (z + 4)2 = 30 Above equation is an equation of a sphere. Centre of the sphere (h, k, l) = (3, -1, -4) ∴ Radius (r) = √30 = 5.477 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 53 3. Following figure shows a Parallelogram. If a=(i+3j-k) , b=(7i-2j+4k), find the area of the Parallelogram, i j k [a*b] = 1 3 -1 -2 4 7 = π(3 ∗ 4 − (−2) ∗ (−1)) − π(1 ∗ 4 − 7 ∗ (1)) + π(1 ∗ (−2) − 7 ∗ 3) [a*b] = √102 + (−11)2 + (23)2 = 100 + 121 + 529 = √750 = 5√30 = 27.386 = ππ. π ∴ Area of the parallelogram is 27.5 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 54 Part 2 4. If 2x - 4y =3, 5y = (-3)x + 10 are two functions. Evaluate the x, y values using graphical method. Function 1 = 2x – 4y = 3 Function 2 = (-3) x + 10 = 5y Let’s use these 2 functions in y = mx + c. Function 1: Function 2: 4y = 2x – 3 (-3) x + 10 = 5y y = (½) x – (¾) 5y = (-3) x + 10 y = - (3/5) x + 2 According to the two formulas, When x = 0, When x = 0, When x = 2, y = - (3/4) y=2 y = 1 – 0.75 (0, -0.75) (0, 2) y = 0.25 (2, 0.25) When y = 0, When x = 4, When x = 2, (½) x = (¾) y = - (0.6) x 4 + 2 y = - (3/5) x 2 + 2 x = 1.5 y = - 2.4 + 2 y = 0.8 (1.5, 0) y = - 0.4 (2, 0.8) (4, 0.4) UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 55 Figure 2. graphs for the above function | Source (Author's work) ∴ In the graph we can see that intersection of function 1 and function 2 is, x = 2.5 & y = 0.5 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 56 5. Evaluate the surfaces in β3 that are represented by the following equations. i) y = 4 y = 4 represents a plane parallel to the xz plane and 4 units to the + side of the y axis. This plane has an infinite number of points and each point (x, 4, z) lies 4 units parallel to the xz plane.is, x = 2.5 & y = 0.5 Figure 3. y = 4 graph | Source (Author’s work) ii) z = 5 z = 5 represents a plane that is 5 units above the xy plane. This plane is located on the + side of the z axis. This plane also has an infinite number of points and each point (x, y, 5) lies 5 units above the xy plane. Figure 4. Z = 5 | Source (Author’s work) UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 57 6. Following figure shows a Tetrahedron Construct an equation to find the volume of the given Tetrahedron using vector methods and if the vectors of the Tetrahedron are a=(i+4j-2k) , b=(3i-5j+k) and c=(-4i+3j+6k), find the volume of the Tetrahedron using the below constructed equation. Base area = (1/2) | a * b | height = |π| cos π We need the area of the base and height of the tetrahedron to calculate the volume of tetrahedron. Volume of tetrahedron 1 = ( ) * base area * height 3 1 1 3 2 = ( ) * ( | π * π | ) * | π | cos π 1 = ( ) * π. | π * π | 6 1 = ( ) * | (π * π). π | 6 ABCD is a tetrahedron in 3D space. If a, b and c are the vectors, then the volume of tetrahedron ABCD is, (1/6) * | (a * b).c | UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 58 According to the question, π = (π + 4π – 2π), π = (3π – 5π + π), π = (−4π + 3π + 6π) π Volume of tetrahedron = |(π ∗ π). π| π (a*b) = I j k = 1 4 -2 = 3 -5 1 = (4 − 10)π − (1 + 6)π + (−5 − 12)π = 6π + 7π + 17π ( a.b ) . c = (6,7,17). (−4,3,6) = − 24, + 21, + 102 = 99 ( a * b ) . c = 99 Volume 1 = 6 ∗ 99 = 16.5 ∴ Volume of Tetrahedron = 16.53 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 59 Activity 04 Part 1 1. Determine the slope of the following functions. i. f(x) = 2x – 3x4 + 5x + 8 π(π₯) = 2π₯ − 3π₯ 4 + 5π₯ + 8 π (7π₯ − 3π₯ + 8) ππ₯ π π π (7π₯) + π ′ (π₯) = (−3π₯ 4 ) + (8) ππ₯ ππ₯ ππ₯ π ′ (π₯) = π ′ (π₯) = 7 − 3 ∗ 4π₯ 3 + 0 = π′ (π) = π − ππππ ∴ The slope = 7 − 12π₯ 3 ii. f(x) = cos(2x) + 4x2 – 3 π(π₯) = π₯ππ (2π₯) + 4π₯ 2 − 3 π (πππ (2π₯) + 4π₯ 2 − 3) ππ₯ π π π (4π₯ 2 ) − (3) π ′ (π₯) = (πππ (2π₯)) + ππ₯ ππ₯ ππ₯ π ′ (π₯) = π ′ (π₯) = −π ππ(2π₯) ∗ 2 + 4 ∗ 2π₯ − 0 = π′ (π) = −ππππ(ππ) + ππ ∴ The slope = −2 sin(2π₯ ) + 8π₯ UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 60 2. Let the displacement function of a moving object is S(t) = 5t3 – 3t2 + 6t. What is the function for the velocity of the object at time t. Displacement function of the moving object S(t) = 5t3 – 3t2 + 6t As we know, if d(S) is distance, Velocity is given as π πΊ (π) / π t According to the function, Velocity = (π) π π = 5. 3t2 – 3. 2t + 6 d(S(t))/dt = 15t2 – 6t + 6 ∴ The velocity function of the object is V (t) = 15t 2 – 6t + 6 Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 61 Part 2 3. Find the area between the two curves f(x) = 2x2 + 1 and g(x) = 8 – 2x on the interval (-2) ≤ x ≤ 1 . ππΏπ + π = π − ππΏ ππΏπ + ππΏ − π = π π ± √π 2 − 4ππ π₯= 2π π₯= −2 + √60 −2 − √60 ππ π₯ = 4 4 π₯= −1 + √15 −1 + √15 ππ π₯ = 2 2 ππ > π , ππ < −π 5 = | π 1 − 2(8 − 2π₯) − (2π₯ 2 )ππ₯ | = | π 1 − 2(−2π₯ 2 − 2π₯ + 7)ππ₯ | −2 2 2 =[ ∗ 1 − 12 + 7 ∗ 1] + [− ∗ −2 + 7π₯ − 2] 3 3 = ππ ∴ The area between two curves is 18 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 62 4. It is estimated that t years from now the tree plantation of a certain forest will be increasing at the rate of 3t2 + 5t + 6 hundred trees per year. Environmentalists have found that the level of Oxygen in the forest increases at the rate of approximately 4 units per 100 trees. By how much will the Oxygen level in the forest increase during the next 3 years? π₯ 1 (π‘) = 3π‘ 2 + 5π‘ + 6 π₯(π‘) = ∫ π1 (π‘)ππ‘ π ∫ ππ πππ + ππ + ππ π = ππ + ππ + ππ + π π 5 π₯(3) = π‘ 3 + π‘ 2 + 6π‘ + π 2 5 = 33 + ∗ 32 + 6 ∗ 3 + π 2 = ππ. π + πͺ − − − −→ π 5 π₯(0) = π‘ 3 + π‘ 2 + 6π‘ + π 2 5 = 03 + ∗ 02 + 6 ∗ 0 + π 2 = πͺ − − − −→ π π πππππ − −−→ πππ πππππ π πππππ − −−→ ππππ πππππ π₯ =4∗ 6750 100 = πππ πΌππππ UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 63 Part 3 5. Sketch the graph of f(x) = x5- 6x3 + 3 by applying differentiation methods for analyzing where the graph is increasing/decreasing, local maximum/minimum points [Using the second derivative test], concave up/down intervals with inflection points. 1. ππ (π) = π π1 = π 1 (π₯) = 5π₯ 4 − 18π₯ 3 = 0 π₯=0 ππ π₯ = ±√ 12 5 = ± π. π Intervals Test ππ (π) = ππ (πππ − ππ) F(x) is π₯ < −1.9 -2 +8 > 0 (+) Increase −1.9 < π₯ < 0 -1 −13 < 0 (−) Decrease 0 < π₯ < 1.9 1 −13 < 0 (−) Decrease π₯ > 1.9 2 +8 > 0 (+) Increase Table 2. Decreasing increasing intervals | Source (Author's work). 2. Maximum and minimum points At π₯ = −1.9 , πΉ(π₯) goes from (+) to (-), local maximum at π₯ = −1.9 and value of function πΉ(1.9) = 19.39 πΉ(π₯) = π₯ 5 − 6π₯ 3 + 3 πΉ(1.9) = 1. 95 − 6 ∗ (−1.9)3 + 3 = ππ. ππ UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 64 At π₯ = 0 , πΉ(π₯) goes from (+) to (-), Its inflation points atπ₯ = 0 and value of the function πΉ(0) = 3 πΉ(π₯) = π₯ 5 − 6π₯ 3 + 3 = 05 − 6 ∗ 03 + 3 =π At π₯ = −1.9 , πΉ(π₯) goes from (-) to (+), local maximum at π₯ = −1.9 and value of function πΉ(1.9) = 13.39 πΉ(π₯) = π₯ 5 − 6π₯ 3 + 3 πΉ(1.9) = 1. 95 − 6 ∗ (−1.9)3 + 3 = −ππ. ππ 3. Intersection points π¦ =0; π₯ 5 − 6π₯ 3 + 3 = 0 π = −π. ππππ ππ π = π. ππ 4. Finding concavity 4π₯(5π₯ 2 − 9) = 0 ; π₯=0 ππ = π π ππ → 5π₯ 2 − 9 = 0 π = √π⁄π → π = ±π. ππ UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 65 Intervals Test ππ (π) Concavity π₯ < −1.34 -2 -88 Concave down −1.34 < π₯ < 0 -1 16 Concave up 0 < π₯ < 1.34 1 16 Concave down π₯ > 1.34 2 88 Concave up Table 3. Concavity graph | Source (Author's work). π(π) = πππ − ππππ π(π) = ππππ − πππ [Space left intentionally] UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 66 Graph, f (x) = x5 – 6x3 + 3 Figure 5. the graph | Source (Author's work) UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 67 6. Identify the maximum and minimum points of the function f(x)= 2x3 - 4x4 + 5x2 by further differentiation. [i.e., Justify your answer using both first derivative test and second derivative test.] → f(x) = 2x3 - 4x4 + 5x2 f `(x) = 6x2 – 16x3 + 10x Let’s find the Critical points. In critical points, f `(x) should be 0. 6x2 – 16x3 + 10x = 0 β 2x (3x – 8x2 + 5) = 0 β 2x (8x + 5) (1 – x) = 0 2x = 0 or x=0 8x + 5 = 0 or x = - (5/8) 1-x = 0 x=1 • In range x < − (5/8), f `(x) is (+) so, f(x) is increasing. βͺ In range – (5/8) < x < 0, f `(x) is (-) so, f(x) is decreasing. βͺ In range 0 < x < 1, f `(x) is (+) so, f(x) is increasing. βͺ In range x < 1, f `(x) is (-) so, f(x) is decreasing. f `(x) = 6x2 – 16x3 + 10x → f ``(x) = 12x – 48x2 + 10 f ``(x) = 12x – 48x2 + 10 Assigning x = - (5/8): f ``(x) = -16.25 → f(x) has a relative maximum x = 0: f ``(x) = 10 → f(x) has a relative minimum x = 1: f ``(x) = -26 → f(x) has a relative maximum x = - (5/8) → f (x) = 0.854 x = 0 → f (x) = 0 x = 1 → f (x) = 3 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 68 REFERENCES Investopedia. (n.d.). Cryptographic Hash Functions. [online] Available at: https://www.investopedia.com/news/cryptographic-hashfunctions/#:~:text=A%20cryptographic%20hash%20function%20is. Wikipedia Contributors (2019). Modular multiplicative inverse. [online] Wikipedia. Available at: https://en.wikipedia.org/wiki/Modular_multiplicative_inverse. Cuemath. (n.d.). Discrete Random Variable - Definition, Formula, Differences, Example, FAQs. [online] Available at: https://www.cuemath.com/algebra/discrete-random-variable/. Cuemath. (n.d.). Continuous Random Variable - Definition, Formulas, Mean, Examples. [online] Available at: https://www.cuemath.com/data/continuous-random-variable/. SearchDataManagement. (n.d.). What is hashing and how does it work? [online] Available at: https://www.techtarget.com/searchdatamanagement/definition/hashing#:~:text=Hashing%20is%20th e%20process%20of. NGINX (2018). What Is Load Balancing? How Load Balancers Work. [online] NGINX. Available at: https://www.nginx.com/resources/glossary/load-balancing/. DATAtab (2021). Standard deviation (simply explained). YouTube. Available at: https://www.youtube.com/watch?v=esskJJF8pCc. www.youtube.com. (n.d.). To find Maximum and Minimum of a functions || Applications of derivatives. [online] Available at: https://www.youtube.com/watch?v=Gb86aqeYrOA www.youtube.com. (n.d.). Probability with At Least Two in Selected Group. [online] Available at: https://www.youtube.com/watch?v=0oiHefLn7Zc www.youtube.com. (n.d.). Venn Diagrams and Testing Validity. [online] Available at: https://www.youtube.com/watch?v=rcyeHdx0Qv4 UNIT 11 – MATHS FOR COMPUTING | BHANUKA PERERA 69