Mathematical Foundation for Computer Science 1 Past Paper PDF
Document Details
MET Institute of Computer Science
MUMBAI EDUCATIONAL TRUST
Tags
Summary
This document contains examples and solutions for calculations of mean, median, mode, and Karl Pearson's coefficient of skewness for different kinds of grouped data, such as marks, ash content, and bursting pressure. The examples are part of a Mathematical Foundation for Computer Science course.
Full Transcript
MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 1: Calculate the mean and median of the following data Marks < 10 20 30...
MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 1: Calculate the mean and median of the following data Marks < 10 20 30 40 50 60 70 80 90 No. of 5 15 98 242 367 405 425 438 439 students Solution: To find the mean let’s consider Assumed mean (a) = 45 Class width (c) = 10 Class Class Frequency fi Cumulative fiui Interval matrix frequency (xi) 0-10 5 5 5 -4 -20 10-20 15 10 15 -3 -30 20-30 25 83 98 -2 -166 30-40 35 144 242 -1 -144 40-50 45 125 367 0 0 50-60 55 38 405 1 38 60-70 65 20 425 2 40 70-80 75 13 438 3 39 80-90 85 1 439 4 4 N= Measures of Central tendency Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science To calculate mean Hence To calculate median Median class (l1 –l2) = (30-40) Frequency of median class (f) = 144 Measures of Central tendency Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Cumulative frequency up to but not including the median class (F) =98 For given data Mean = 39.56 Median = 38.43 Measures of Central tendency Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2: Calculate the median of the following data Marks 0-20 20-40 40-60 60-80 80-100 No. of 5 8 15 16 6 students Solution: We prepare following table Class Frequency fi Cumulative Interval frequency 0-20 5 5 20-40 8 13 40-60 15 28 60-80 16 44 80-100 6 50 N= 50 To calculate median Measures of Central tendency Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Median class (l2 –l1) = (40-60) Frequency of median class (f) = 15 Cumulative frequency up to but not including the median class (F) =13 For given data Median = 56 Measures of Central tendency Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3: Calculate the median of the following data Marks 10-12 12-14 14-16 16-18 18-20 20-22 22-24 No. of 11 17 20 22 10 10 10 students Solution: We prepare following table Class Frequency fi Cumulative Interval frequency 10-12 11 11 12-14 17 28 14-16 20 48 16-18 22 70 18-20 10 80 20-22 10 90 22-24 10 100 N= 100 To calculate median Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Median class (l2 –l1) = (16-18) Frequency of median class (f) = 22 Cumulative frequency up to but not including the median class (F) = 48 For given data Median = 16.1818 Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4: The following table shows the percentage of ash content in 280 wagons tests of a certain kind of coal. Find the mode of the distribution. % of ash 3-4 4-5 5-6 6-7 7-8 8-9 9-10 10-11 11-12 content Frequency 1 7 28 78 84 45 28 7 2 Solution: We prepare following table Class Frequency fi Interval 3-4 1 4-5 7 5-6 28 6-7 78 7-8 84 Modal class 8-9 45 9-10 28 10-11 7 11-12 2 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Modal class (l2 –l1) =7-8 Frequency of modal class (f) = 84 Frequency of pre-modal class (f1) = 78 Frequency of post-modal class (f2) = 45 Difference between frequency of modal class and of previous class d1 = (f- f1) = 84-78 = 6 Difference between frequency of modal class and of following class d2 = (f- f2) = 84 -45 = 39 For given data Mode = 7.1333 Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 5: The following frequency distribution of marks of students in an examination, calculate the value of Karl Pearson’s coefficient of skewness. Marks less than 10 20 30 40 50 No. of students 5 12 32 44 50 Solution: We prepare following table Assumed mean (a) = 25 Class width (c) = 10 Class Class Freqn Cumu. fiui fiui2 Interval marks fi Freqn (xi) 0-10 5 5 5 -2 -10 20 10-20 15 7 12 -1 -7 7 20-30 25 20 32 0 0 0 30-40 35 12 44 1 12 12 40-50 45 6 50 2 12 24 N= Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science To calculate mean Hence Standard deviation where N = fi To find mode Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Modal class (l1 –l2) = (20-30) Frequency of modal class (f) = 20 Frequency of pre-modal class (f1) = 7 Frequency of post-modal class (f2) = 12 Difference between frequency of modal class and of previous class d1 = (f- f1) = 20 -7 = 13 Difference between frequency of modal class and of following class d2 = (f- f2) = 20 – 12 = 8 Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 6: A prospective buyer tested the bursting pressure of the sample of polythene bags received from a manufacturer. The test gives the following results Bursting pressure 5-10 10-15 15-20 20-25 25-30 30-35 No. of bags 2 10 30 50 6 2 Find Karl Pearson’s coefficient of skewness for bursting pressure Solution: We prepare following table Assumed mean (a) = 17.5 Class width (c) = 5 Class Class Freqn Cumu. fiui fiui2 Interval pressu fi Freqn re (xi) 5-10 7.5 2 2 -2 -4 8 10-15 12.5 10 12 -1 -10 10 15-20 17.5 30 42 0 0 0 20-25 22.5 50 92 1 50 50 25-30 27.5 6 98 2 12 24 30-35 32.5 2 100 3 6 18 N= Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science To calculate mean Hence Standard deviation where N = fi To find mode Modal class (l1 –l2) = (20-25) Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Frequency of modal class (f) = 50 Frequency of pre-modal class (f1) =30 Frequency of post-modal class (f2) =6 Difference between frequency of modal class and of previous class d1 = (f- f1) = 50-30 = 20 Difference between frequency of modal class and of following class d2 = (f- f2) =50 – 6 = 44 Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 7: From the following data on age of employee, calculate the Karl Pearson’s coefficient of skewness Age 20-25 25-30 30-35 35-40 40-45 45-50 50-55 (years) No. of 8 12 20 25 15 12 8 employees Solution: We prepare following table Assumed mean (a) = 37.5 Class width (c) = 5 Class Class Freqn Cumu. fiui fiui2 Interval age fi Freqn (xi) 20-25 22.5 8 8 -3 -24 72 25-30 27.5 12 20 -2 -24 48 30-35 32.5 20 40 -1 -20 20 35-40 37.5 25 65 0 0 0 40-45 42.5 15 80 1 15 15 45-50 47.5 12 92 2 24 48 50-55 52.5 8 100 3 24 72 N= 100 -5 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science To calculate mean Hence Standard deviation where N = fi To find mode Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Modal class (l1 –l2) = (35-40) Frequency of modal class (f) = 25 Frequency of pre-modal class (f1) =20 Frequency of post-modal class (f2) =15 Difference between frequency of modal class and of previous class d1 = (f- f1) = 25-20 =5 Difference between frequency of modal class and of following class d2 = (f- f2) = 25-15 = 10 Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 8: For a moderately skewed frequency distribution of retail prices for men’s shoes it is found that the mean price is Rs. 20 and median price is Rs. 17. If the coefficient of variation is 20%, find the Pearson’s coefficient of skewness. Solution: Given Mean =20 Median = 17 Coefficient of variation = 20% Standard Deviation = 4 Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 9: From the following frequency distribution of marks of students in the examination calculate the Bowley’s coefficient of skewness Marks less 10 20 30 40 50 than No. of 5 12 32 44 50 students Solution: We prepare following table Class Freqn Cumu. Interval fi Freqn 0-10 5 5 10-20 7 12 20-30 20 32 30-40 12 44 40-50 6 50 N= 50 To calculate Q1, Q2, Q3 Page 1 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science For first quartile (Q1) Q1 class(l1 –l2) =(20-30) Frequency of Q1 class (f) = 20 Cumulative frequency up to but not including the Q1 class (F) = 12 For second quartile Q2 (median) To calculate median Page 2 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Median/Q2 class(l1 –l2) = (20-30) Frequency of median class (f) = 20 Cumulative frequency up to but not including the median class (F) =12 For third quartile (Q3) Q3 class(l1 –l2) = 30-40 Frequency of Q3 class (f) = 12 Cumulative frequency up to but not including the Q3 class (F) =32 Page 3 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 4 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 10: The following data gives the number of car accidents in the city during a random time period. Calculate Bowley’s coefficient of skewness for the following distribution Class 5-10 10-15 15-20 20-25 25-30 30-35 35-40 Frequency 7 9 16 22 14 12 3 Solution: We prepare following table Class Freqn Cumu. Interval fi Freqn 5-10 7 7 10-15 9 16 15-20 16 32 20-25 22 54 25-30 14 68 30-35 12 80 35-40 3 83 N= To calculate Q1, Q2, Q3 Page 1 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science For first quartile (Q1) Q1 class(l1 –l2) =15-20 Frequency of Q1 class (f) = 16 Cumulative frequency up to but not including the Q1 class (F) =16 For second quartile Q2 (median) To calculate median Page 2 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Median/Q2 class(l1 –l2) = 20-25 Frequency of median class (f) = 22 Cumulative frequency up to but not including the median class (F) =32 For third quartile (Q3) Q3 class(l1 –l2) = 25-30 Frequency of Q3 class (f) = 14 Cumulative frequency up to but not including the Q3 class (F) =54 Page 3 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Quartile devitation = (Q3 –Q1)/(Q3 +Q1) Page 4 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 11: Calculate Bowley’s coefficient of skewness for the following distribution X 10-15 15-20 20-25 25-30 30-35 35-40 40-45 45-50 f 2 5 7 13 21 16 8 3 Solution: We prepare following table Class Freqn Cumu. Interval fi Freqn 10-15 2 2 15-20 5 7 20-25 7 14 25-30 13 27 30-35 21 48 35-40 16 64 40-45 8 72 45-50 3 75 N= To calculate Q1, Q2, Q3 Page 1 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science For first quartile (Q1) Q1 class (l1 –l2) = 25-30 Frequency of Q1 class (f) = 13 Cumulative frequency up to but not including the Q1 class (F) =14 For second quartile Q2 (median) To calculate median Page 2 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Median/Q2 class (l1 –l2) = 30-35 Frequency of median class (f) = 21 Cumulative frequency up to but not including the median class (F) =27 5 For third quartile (Q3) Q3 class (l1 –l2) = 35-40 Frequency of Q3 class (f) = 16 Cumulative frequency up to but not including the Q3 class (F) =48 Page 3 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 4 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.1: Obtain the equation of regression line for the following values of x and y x 1 2 3 4 5 y 2 5 3 8 7 Find the value of corresponding regression coefficient. If x = 2.45, find the value of y. Solution: We prepare following table Here n = 5 x y x2 y2 xy 1 2 1 4 2 2 5 4 25 10 3 3 9 9 9 4 8 16 64 32 5 7 25 49 35 151 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Regression of y on x is Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science y-5 = 1.3 x -3.9 y=1.3 x + 1.1 Y = 4.285 Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.2: Obtain the equation of regression line for the following values of x and y x 1 3 4 6 8 9 11 14 y 1 2 4 4 5 7 8 9 Find the value of corresponding regression coefficient. Solution: We prepare following table Here n = 8 x y x2 y2 xy 1 1 1 1 1 3 2 9 4 6 4 4 16 16 16 6 4 36 16 24 8 5 64 25 40 9 7 81 49 63 11 8 121 64 88 14 9 196 81 126 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Regression of y on x is Regression of x on y is Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.3: The table given below is of production (in thousand tons) of a sugar factory Year 1969 1970 1971 1972 1973 1974 1975 Production 77 88 94 85 91 98 90 also find Karl pearson’s coefficient of correlation. Solution: We prepare following table Here n = 7 year X= year- y x2 y2 xy 1969 1969 0 77 0 5929 0 1970 1 88 1 7744 88 1971 2 94 4 8836 188 1972 3 85 9 7225 255 1973 4 91 16 8281 364 1974 5 98 25 9604 490 1975 6 90 36 8100 540 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Regression of y on x is Karl pearson’s coefficient of correlation is given by Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.4: Following data represents assets of a multinational company in crores of rupees for the year 1995 to 2000. Year 1995 1996 1997 1998 1999 2000 Asset 83 92 71 90 110 115 Find the regression of asset on year. Estimate the asset for the year 2002. Also find Karl pearson’s coefficient of correlation. Solution: We prepare following table Here n = 6 year X= year- y x2 y2 xy 1995 1995 0 83 0 6889 0 1996 1 92 1 8464 92 1997 2 71 4 5041 142 1998 3 90 9 8100 270 1999 4 110 16 12100 440 2000 5 115 25 13225 575 561 55 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Regression of y on x is Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science To estimate asset in the year 2002 X= 2002-1995 X=7 Hence y-93.5 = byx (7-2.5) Y=123.4574 Karl pearson’s coefficient of correlation is given by 0.7536 Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.5: Find Karl Pearson’s coefficient of correlation for the following data. X 1 2 3 Y 6 5 10 Solution: We prepare following table Here n = 3 X y x2 y2 xy 1 6 1 36 6 2 5 4 25 10 3 10 9 100 30 Karl Pearson’s coefficient of correlation is given by Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.6: The following data represents 10 students marks in statistics (x) and probability (y). Find Karl pearson’s coefficient of correlation for the following data. X 56 55 58 58 57 56 60 54 59 57 Y 68 67 67 70 65 68 70 66 68 66 Solution: We prepare following table Here n = 10 X y x2 y2 xy 56 68 3136 4624 3808 55 67 3025 4489 3685 58 67 3364 4489 3886 58 70 3364 4900 4060 57 65 3249 4225 3705 56 68 3136 4624 3808 60 70 3600 4900 4200 54 66 2916 4356 3564 59 68 3481 4624 4012 57 66 3249 4356 3762 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Karl Pearson’s coefficient of correlation is given by Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.7: The marks obtained by 9 students in OS and DS are given below Marks in OS 35 47 23 6 17 10 43 9 28 Marks in DS 30 46 33 4 23 8 48 12 31 Compute the ranks in two subjects and the coefficient of correlation of ranks. Solution: We prepare following table Here n = 9 Marks in Marks in Rank in Rank in d = d2 OS DS OS (r1) DS (r2) |r1 – r2 | 35 30 3 5 2 4 47 46 1 2 1 1 23 33 5 3 2 4 6 4 9 9 0 0 17 23 6 6 0 0 10 8 7 8 1 1 43 48 2 1 1 1 9 12 8 7 1 1 28 31 4 4 0 0 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Spearman’s rank correlation coefficient is given by Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.8: Find Spearman’s rank correlation for the following data Marks in CPP 64 50 44 42 56 65 59 Marks in SEPM 80 60 37 51 30 75 44 Solution: We prepare following table Here n = 7 Marks in Marks in Rank in Rank in d = d2 CPP SEPM CPP (r1) SEPM (r2) |r1 – r2 | 64 80 2 1 1 1 50 60 5 3 2 4 44 37 6 6 0 0 42 51 7 4 3 9 56 30 4 7 3 9 65 75 1 2 1 1 59 44 3 5 2 4 Spearman’s rank correlation coefficient is given by Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.9: In a sample of 12 fathers and their eldest sons gave the following data about their heights in inches. Father(x) 65 63 67 64 68 62 70 66 68 67 69 71 Son(y) 68 66 68 65 69 66 68 65 71 67 68 70 Calculate coefficient of rank correlation between x and y. Solution: We prepare following table, Here n = 12 Father Son (y) Rank in x Rank in y d = d2 (x) (r1) (r2) |r1 – r2 | 65 68 9 5.5 3.5 12.25 63 66 11 9.5 1.5 2.25 67 68 6.5 5.5 1 1 64 65 10 11.5 1.5 2.25 68 69 4.5 3 1.5 2.25 62 66 12 9.5 2.5 6.25 70 68 2 5.5 3.5 12.25 66 65 8 11.5 3.5 12.25 68 71 4.5 1 3.5 12.25 67 67 6.5 8 1.5 2.25 69 68 3 5.5 2.5 6.25 71 70 1 2 1 1 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (i) Rank 4.5 repeated m = 2 times Hence the correlation coefficient (ii) Rank 6.5 is repeated m=2 times Hence the correlation coefficient (iii) Rank 5.5 is repeated m=4 times Hence the correlation coefficient (iv) Rank 9.5 is repeated m=2 times Hence the correlation coefficient (v) Rank 11.5 is repeated m=2 times Hence the correlation coefficient Corrected Spearman’s rank correlation coefficient is given by Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.10: Find Spearman’s rank correlation for the following data Student A B C D E F G H Marks in Test1 52 34 47 65 43 34 54 65 Marks in Test2 65 59 65 68 82 60 57 58 Solution: We prepare following table, Here n = 8 Marks Marks Rank in Rank in d = d2 in Test1 in Test2 Test1 (r1) Test2 (r2) |r1 – r2 | 52 65 4 3.5 0.5 0.25 34 59 7.5 6 1.5 2.25 47 65 5 3.5 1.5 2.25 65 68 1.5 2 0.5 0.25 43 82 6 1 5 25 34 60 7.5 5 2.5 6.25 54 57 3 8 5 25 65 58 1.5 7 5.5 30.25 91.5 (i) Rank 1.5 repeated m = 2 times Hence the correlation coefficient Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (ii) Rank 7.5 is repeated m=2 times Hence the correlation coefficient (iii) Rank 3.5 is repeated m=2 times Hence the correlation coefficient Corrected Spearman’s rank correlation coefficient is given by Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.11: Calculate the coefficient of rank correlation from the following data: X 48 33 40 9 16 16 65 24 16 57 Y 13 13 24 6 15 4 20 9 6 19 Solution: We prepare following table, Here n = 10 X Y Rank in X Rank in Y d = d2 (r1) (r2) |r1 – r2 | 48 13 3 5.5 2.5 6.25 33 13 5 5.5 0.5 0.25 40 24 4 1 3 9 9 6 10 8.5 1.5 2.25 16 15 8 4 4 16 16 4 8 10 2 4 65 20 1 2 1 1 24 9 6 7 1 1 16 6 8 8.5 0.5 0.25 57 19 2 3 1 1 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (i) Rank 5.5 repeated m = 2 times Hence the correlation coefficient (ii) Rank 8.5 is repeated m=2 times Hence the correlation coefficient (iii) Rank 8 is repeated m=3 times Hence the correlation coefficient Corrected Spearman’s rank correlation coefficient is given by Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.12: The ranking of ten students in two subjects A and B as follows: Subject A 3 5 8 4 7 10 2 1 6 9 Subject B 6 4 9 8 1 2 3 10 5 7 Find Spearman’s Rank correlation coefficient. Solution: We prepare following table, Here n = 10 Rank in Rank in d = d2 subject A (r1) subject B (r2) |r1 – r2 | 3 6 3 9 5 4 1 1 8 9 1 1 4 8 4 16 7 1 6 36 10 2 8 64 2 3 1 1 1 10 9 81 6 5 1 1 9 7 2 4 Spearman’s rank correlation coefficient is given by Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.13: Compute the quadratic regression equation of following data. Check its best fitness. x -3 -2 -1 0 1 2 3 y 7.5 3 0.5 1 3 6 14 Solution: We prepare following table, Here N=7 x y x2 x3 x4 xy x2 y -3 7.5 9 -27 81 -22.5 67.5 -2 3 4 -8 16 -6 12 -1 0.5 1 -1 1 -0.5 0.5 0 1 0 0 0 0 0 1 3 1 1 1 3 3 2 6 4 8 16 12 24 3 14 9 27 81 42 126 0 35 28 28 233 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science The equations are Substituting values the equations are 7a0 + 0 + 28a2 = 35 -----eq1 0 + 28a1 + 0 = 28 ------eq2 28a0 + 0 + 196a2 = 233 -------eq3 Solving the simultaneous equations eq1 and eq3 7a0 + 28a2 = 35 28a0 + 196a2 = 233 Hence a2 = 1.107142 and a0 = 0.571429 Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science We get a1 = 1 using equation 2 Hence the quadratic equation is y= 0.571429 + x + 1.107142 x2 y= 1.107142 x2 + x + 0.571429 The following plot is just for reference. If asked then only draw it. Quadratic Regression 16 14 y= 0.571429 + x + 1.107142 x2 12 10 8 Series1 6 4 2 0 -4 -3 -2 -1 0 1 2 3 4 x Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.14: Fit a least-squares parabola of the form Y = a0 + a1x + a2x2 to the set of data in Table X 1.2 1.8 3.1 4.9 5.7 7.1 8.6 9.8 y 4.5 5.9 7.0 7.8 7.2 6.8 4.5 2.7 Solution: We prepare following table, Here N=8 x y x2 x3 x4 xy x2 y 1.2 4.5 1.44 1.728 2.0736 5.4 6.48 1.8 5.9 3.24 5.832 10.498 10.62 19.12 3.1 7 9.61 29.791 92.352 21.7 67.27 4.9 7.8 24.01 117.649 576.48 38.22 187.3 5.7 7.2 32.49 185.193 1055.6 41.04 233.9 7.1 6.8 50.41 357.911 2541.2 48.28 342.8 8.6 4.5 73.96 636.056 5470.1 38.7 332.8 9.8 2.7 96.04 941.192 9223.7 26.46 259.3 42.2 46.4 291.2 2275.35 18971.92 230.42 1449 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science The equations are Since N = 8, the normal equations becomes https://onlinemschool.com/math/assistance/equation/gaus/ Solving the equations a0 =2.5887, a1 = 2.0644 and a2 = -0.2110; hence the required least-squares parabola has the equation Y=2.5887 + 2.0644X - 0.2110 X2 Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science The following plot is just for reference. If asked then only draw it. Quadratic Regression 9 8 7 Y=2.588 + 2.065X - 0.2110 X2 6 5 4 Series1 3 2 1 0 0 2 4 6 8 10 12 x Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.15: The revenue generated by a company in $billions is provided in following table, Find a quadratic least square fit for the data and estimate 2006 revenue generated year $billion 2000 236 2001 214 2002 207 2003 250 2004 300 2005 375 Solution: We prepare following table, Here N=6 X=year-2000 year x y x2 x3 x4 xy x2 y 2000 0 236 0 0 0 0 0 2001 1 214 1 1 1 214 214 2002 2 207 4 8 16 414 828 2003 3 250 9 27 81 750 2250 2004 4 300 16 64 256 1200 4800 2005 5 375 25 125 625 1875 9375 15 1582 55 225 979 4453 17467 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science The equations are Hence we will get 6a0 + 15a1 + 55a2 = 1582 15a0 + 55a1 + 225a2 = 4453 55a0 + 225a1+ 979a2 = 17467 Solving the equations a0 =234.9643, a1 = -35.2036 and a2 =12.7321 ; hence the required least-squares parabola has the equation Y=234.9643 - 35.2036X + 12.7321 X2 The expenses of 2006 will be substituting x= 6 Y=482.0983 Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.16: Find a cubic least square fit for the following data. xi yi -3 7.5 -2 3 -1 0.5 0 1 1 3 2 6 3 14 Solution: We prepare following table, Here N=7 x y x2 x3 x4 x5 x6 xy x2 y X3 y -3 7.5 9 -27 81 -243 729 -22.5 67.5 -202.5 -2 3 4 -8 16 -32 64 -6 12 -24 -1 0.5 1 -1 1 -1 1 -0.5 0.5 -0.5 0 1 0 0 0 0 0 0 0 0 1 3 1 1 1 1 1 3 3 3 2 6 4 8 16 32 64 12 24 48 3 14 9 27 81 243 729 42 126 378 35 28 196 28 Page 1 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science The equations are (here N is number of data points given) Solving the simultaneous equation obtain the values of coefficients a0 , a1, a2 and a3 Page 2 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science ---eq1 ---eq2 ---eq3 --eq4 Solve eq1 and eq3 Solve eq2 and eq4 Solving the equations a0 =0.5714, a1 = 0.8056, a2 =1.1071 and a3 = 0.0278; hence the required least-squares cubic curve is Y = 0.5714+ 0.8056X + 1.1071 X2 + 0.0278 X3 Y = 0.0278 X3 + 1.1071 X2 + 0.8056X + 0.5714 Page 3 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Cubic regression 16 14 12 Y = 0.0278 X3 + 1.1071 X2 + 0.8056X + 0.5714 10 8 6 4 2 0 -4 -3 -2 -1 0 1 2 3 4 X Page 4 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.17: Find the cubic regression for the following data X -3 -2 -1 0 1 2 3 y -27 -8 -1 0 1 8 27 Solution: We prepare following table, Here N=7 x y x2 x3 x4 x5 x6 xy x2 y X3 y -3 -27 9 -27 81 -243 729 81 -243 729 -2 -8 4 -8 16 -32 64 16 -32 64 -1 -1 1 -1 1 -1 1 1 -1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 8 4 8 16 32 64 16 32 64 3 27 9 27 81 243 729 81 243 729 1588 0 0 28 196 0 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science The equations are (here N is number of data points given) Solving the simultaneous equation obtain the values of coefficients a0 , a1, a2 and a3 ----------eq1 --------eq2 ---------eq3 ----eq4 Solving eq1 and eq3 , solving eq2 and eq4 we get a0 =0, a1 = 0 , a2 =0 and a3 = 1; hence the required least-squares cubic curve is Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Y = 1 X3 +0 X2 + 0 X + 0 i.e. y= x3 Cubic regression 30 20 10 Y = X3 0 -4 -3 -2 -1 0 1 2 3 4 -10 -20 -30 X Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 2.18: Find the cubic regression for the following data X -1 0 2 3 y 0 -12 0 0 Solution: We prepare following table, Here N=4 x y x2 x3 x4 x5 x6 xy x2 y X3 y -1 0 1 -1 1 -1 1 0 0 0 0 -12 0 0 0 0 0 0 0 0 2 0 4 8 16 32 64 0 0 0 3 0 9 27 81 243 729 0 0 0 4 -12 14 34 98 274 794 0 0 0 The equations are (here N is number of data points given) Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Solving the simultaneous equation obtain the values of coefficients a0 , a1, a2 and a3 Solving the equations a0= -12 , a1= -2 , a2= 8 , a3= -2 Hence the required least-squares cubic curve is Y = -2X3 +8 X2 - 2 X -12 Cubic Regression 120 100 Y = -2X3 +8 X2 - 2 X -12 80 60 40 20 0 -1.5 -1 -0.5 0 0.5 1 1.5 2 2.5 3 3.5 -20 X Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.1: A bag contains 2 red, 5 white and 8 blue balls. Two balls are drawn at random from it. What is the probability that one is white and other is blue? Solution: Sample space = 2 + 5 + 8 = 15 balls ∴ n(S)= 15C2 n Cr = Event A = 1 ball is white and 1 ball is blue 5 C1 X 8C1 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.2: Box A contains 5 red marbles and 3 blue marbles and the box B contains 3 red and 2 blue marbles. A marble is drawn at random from each box. Find the probability that (i) Both marbles are red (ii) One is red and one is blue Solution: Sample space (S) = (one marble is drawn from box A containing 8 marbles) and (one marble is drawn from box B containing 5 marbles) ∴ n(S)= 8C1 X 5C1 n Cr = Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (i) Event A = both marbles are red 5 C1 X 3C1 (ii) Event B = ( 1 red from box A and 1 blue from box B) or (1 red from box B and 1 blue from box A) Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science 5 C1 X 2C1 + 3C1 X 3C1 Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.3: A box contains 2 white socks and 2 blue socks. Two are drawn at random. Find the probability, p, that they are a match. Solution: Sample space (S) = 2 socks are drawn from 4 ∴ n(S)= 4C2 n Cr = Event A = both socks are white or both are blue 2 C2 + 2C2 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.4: A box contains 15 chips where 5 are defective. If the random samples of 3 chips are drawn, what is the probability that exactly two are defective? Solution: Sample space (S) = 3 chips are drawn randomly from a box containing 15 chips ∴ n(S)= 15C3 n Cr = Event A = 3 chips are drawn and 2 are defective 5 C2 X 10C1 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.5: Five horses are in race. X person picks two of the horses at random and bets on them. Find the probability that X picked the winner? Solution: Sample space (S) = picking 2 horses from a set of 5 ∴ n(S)= 5C2 n Cr = Event A = 1 horse is winner and other is not 1 C1 X 4C1 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.6: Two cards are drawn from a pack of 52 playing cards, find the probability that both the cards are kings. Solution: Sample space (S) = 2 cards are drawn from a pack of 52 cards ∴ n(S)= 52C2 n Cr = Event A = Both cards are king 4 C2 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.7: 4 cards are drawn from a pack of 52 playing cards. Find the probability that (i) All are spade cards (ii) There is 1 card of each suit (iii) 2 spade and 2 diamonds. Solution: Sample space (S) = 4 cards are drawn from a pack of 52 cards ∴ n(S)= 52C4 n Cr = (i) Event A = all 4 cards are spade cards 13 C4 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (ii) Event B= there is 1 card of each suit 13 C1 X 13C1 X 13C1 X 13C1 Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (iii) Event C = 2 spade and 2 diamonds 13 C2 X 13C2 Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.8: A box contains 75 good ICs and 25 defective. If 12 ICs are selected at random, find the probability that at least 1 chip is defective? Solution: Probability that at least 1 chip is defective = 1 – probability that no chips are defective ∴ n(S)= 100C12 n Cr = Event A = no chips are defective 75 C12 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science 75 100 C12 / C12 1 – [ 75C12 / 100 C12 ] Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.9: A bag contains 8 red and 5 white balls. Two successive drawings of 3 balls are made such that Case I : balls are replaced before the second trial. Case II: balls are not replaced before the second trial. Find the probability that the first drawing will give 3 white balls and 2nd drawing will give 3 red balls for case I and case II Solution: Let A = three white balls are drawn B= three red balls are drawn Case I : balls are replaced before second trial P(A B) = P(A). P(B) n P(A) = 5C3 / 13C3 Cr = P(A) = 10/286 P(B) = 8C3 / 13C3 P(B) = 56/286 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science P(A B) = P(A). P(B) P(A B) = 10/286 X 56/286 P(A B) =0.0068 Case II : balls are not replaced before the second trial P(A B) = P(A). P(B|A) P(A) = 5C3 / 13C3 P(A) = 10/286 P(B|A) = 8C3 / 10C3 P(B|A) = 56 / 120 P(A B) = P(A). P(B|A) P(A B) = 10/286 X 56 / 120 P(A B) = 0.016 Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.10: Among the digits 3, 4, 5, 6, 7 first digit is chosen and then second digit is chosen from the remaining four. Find the probability that an odd digit will be selected (i) As first digit (ii) As second digit (iii) As both digits Solution: Sample space (S) = two digit number is selected where first digit from 5 digit and second from remaining 4 digits. ∴ n(S)= 5C1 X 4C1 ∴ n(S)= 5 X 4 ∴ n(S)=20 (i) Event A = an odd digit will be selected as first digit and second digit is selected from remaining digits n(A) = 3C1 X 4C1 ∴ n(A)= 3 X 4 ∴ n(A)= 12 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (ii) Event B = an odd digit will be selected as second digit = an even digit is selected as first digit and odd digit is selected as second digit OR an odd digit is selected as first digit and odd digit is selected as second digit n(B) = 2C1 X 3C1 + 3C1 X 2C1 i.e. (iii) Event C= odd digits are selected as both digits Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science n(C) = 3C1 X 2C1 n(C) =3 X 2 n(C) =6 i.e. Page 3 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.11: Find the probability of constructing a two digit even number using the digits 2,3,4,5,6 if (i) You can use the same digit again (ii) You cannot use a digit more than once Solution: Sample space (S) = two digit number with 5 digits with repetition allowed ∴ n(S)= 5C1 X 5C1 ∴ n(S)= 5 X 5 ∴ n(S)=25 (i) Event A = two digit even number at units place = {2,4,6 } = 3 ways at tens place = {2,3,4,5,6} = 5 ways n(A) = 5C1 X 3C1 ∴ n(A)= 5 X 3 ∴ n(A)= 15 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (ii) Event B = repetition of digits is not allowed and required number is even number 5 4 n(S) = C1 X C1 = 20 n(B) = 4C1 X 3C1 i.e. Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.12: Find the probability of constructing a two digit even number using the digits 1,2,3,4,5,6,7,8,9 if (i) Repetition of digits is allowed (ii) Repetition of digits is not allowed Solution: Sample space (S) = two digit number with 9 digits with repetition allowed ∴ n(S)= 9C1 X 9C1 ∴ n(S)= 9X 9 ∴ n(S)=81 (i) Event A = repetition of digits is allowed at units place = {2,4,6 ,8} = 4 ways at tens place = {1,2,3,4,5,6,7,8,9} = 9 ways ∴ n(A)= 9 X 4 ∴ n(A)= 36 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (ii) Event B = repetition of digits is not allowed and required number is even number 9 8 n(S) = C1 X C1 = 72 n(B) = 8C1 X 4C1 i.e. Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.13: Find the probability of constructing a two digit even number using the digits 3,4,5,6, and 7 Assume first that you may use same digit again, then repeat the question, assuming that you may not use a digit more than once Solution: Sample space (S) = two digit number with 5 digits with repetition allowed ∴ n(S)= 5C1 X 5C1 ∴ n(S)= 5X 5 ∴ n(S)=25 (i) Event A = two digit even number , repetition of digits is allowed at units place = {4,6} = 2 ways at tens place = {3,4,5,6,7} = 5 ways ∴ n(A)= 5 X 2 ∴ n(A)= 10 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Event B = two digit even number, repetition of digits is not allowed and required number is even number 5 4 n(S) = C1 X C1 = 20 n(B) = 4C1 X 2C1 i.e. Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.14: A sample survey was taken to check which newspaper (A,B, C) people read. In a sample of 100 people the following results are obtained, 60 read A, 40 read B, 70 read C, 45 read A and C, 32 read A and B, 38 read B and C, 30 read A, B and C. If a person is selected at random, find the probability that (a) He reads only A newspaper. (b) He reads at least two newspapers (c) He reads at most 1 newspaper (d) He doesn’t read any paper Solution: Page 1 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (i) Event A = he reads only A newspaper ∴ n(A)= 60 – n(A B) – n(A C) + n(ABC) ∴ n(A)= 60-32-45+30 n(A) = 13 (ii) Event B = he reads at least two newspapers (means he may read 2 or more newspapers) Page 2 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science n(B) = (45-30) + (32-30) + (38-30) + 30 i.e. (iii) Event C = he reads at most 1 newspaper (means 1 or less than 1 newspaper) n(C) = (60-45-32+30) + (40-32 -38+ 30) + (70- 45-38+30) + 15 n(C)= 13+0+17+15 Page 3 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science n(C)=45 i.e. (iv) Event D = he doesn’t read any newspaper Page 4 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.15: ‘n’ persons are seated on ‘n’ chairs on a round table. Find the probability that two specific persons are sitting next to each other. Solution: For a round table n persons and n chairs arrangements Sample space S= total arrangements of sitting ∴ n(S)= (n-1) ! Event A = two specific persons are sitting next to each other in arranegment Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science ∴ n(A)= (n-2)! X 2! Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.16: What is the probability that 4 S’s come consecutively in the arrangement of the letters in the word ‘MISSISSIPPI’ Solution: Sample space S= total arrangements of letters in word ‘MISSISSIPI’ S= arrangement of 4 letters S, 4 letters I, 2 letters P, 1 letter M Event A = 4 S’s come consecutively = arrangement of (4S) in 1 group , 4 letters I, 2 letters P, 1 letter M Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.17: What is the probability that 4 A’s come consecutively in the arrangement of the letters in the word ‘MAHARASHTRA’ Solution: Sample space S= total arrangements of letters in word ‘MAHARASHTRA’ S= arrangement of M- 1 A-4 H-2 R-2 S-1 T-1 Event A = 4 A’s come consecutively = arrangement of (4A) in 1 group , 2 letters H, 2 letters R, 1 letter M, 1 letter S, 1 letter T Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.18: What is the probability that all vowels come consecutively in the arrangement of the letters in the word ‘PROBABILITY’ Solution: Sample space S= total arrangements of letters in word ‘PROBABILITY’ S= arrangement of P- 1 R-1 O-1 B-2 A-1 L-1 I-2 T-1 Y-1 Event A = all vowels (O,A, I, I) come consecutively P, R, [ O, A, I, I ], B , B, L, T, Y Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.19: What is the probability that 4 A’s come consecutively in the arrangement of the letters in the word ‘MAHANAGAR’ Solution: Sample space S= total arrangements of letters in word ‘MAHANAGAR’ S= arrangement of M- 1 A-4 H-1 N-1 G-1 R-1 Event A = 4A’s come consecutively M, [A, A, A, A,] N, H, G, R Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.20: What is the probability that all vowels come consecutively in the arrangement of the letters in the word ‘COMMERCE’ Solution: Sample space S= total arrangements of letters in word ‘COMMERCE’ S= arrangement of C- 2 O-1 M-2 E-2 R-1 Event A = all vowels come consecutively C, [O, E,E,] M, M, R,C Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.21: Letters of the word ‘FAILURE’ are arranged at random. Find the probability that the consonants may occupy only odd position. Solution: Sample space S= total arrangements of letters in word ‘FAILURE’ S= arrangement of F- 1 A-1 I-1 L-1 U-1 R-1 E-1 Event A = all consonants may occupy only odd positions (there are odd positions 1st, 3rd, 5th, 7th and 3 consonants viz. F, L, R) 4P3 X 4! Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science P(A) = [4P3 X 4!] / 7! Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.22: What is the probability that all vowels come consecutively in the arrangement of the letters in the word ‘MATHEMATICS’ Solution: Sample space S= total arrangements of letters in word ‘MATHEMATICS’ S= arrangement of M= 2 , A= 2 , T= 2 ,H=1 , I =1 , E=1 ,C= 1 , S=1 Event A = all vowels (A,E,I) come consecutively M, T, M,H, T, C, S, [A, A, E, I] Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.23: What is the probability that all vowels come consecutively in the arrangement of the letters in the word ‘AHMEDNAGAR’ Solution: Sample space S= total arrangements of letters in word ‘AHMEDNAGAR’ S= arrangement of A= 3 , H= 1 , M= 1 ,E=1 , D =1 , N=1 ,G= 1 R=1 Event A = all vowels (A,A,A,E) come consecutively H,M,D,N,G,R ,[A, A, A, E] Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.24: Ten balls are distributed at random among 4 boxes. What is the probability that first box contains 4 balls. Solution: Sample space S= 10 balls are distributed at random among 4 boxes Every ball have 4 choices. hence 10 balls have Event A = first box will contain 4 balls For the first box 4 balls can be selected from 10 balls and from remaining boxes remaining balls can be distributed in 36 ways 10C4 X 36 P(A) =(10C4 X 36 ) / 410 Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.25: Find the probability that randomly chosen 3-letter sequence will not have any repeated letters. Solution: Sample space S= 3-letters are randomly chosen among 26 alphabets/letters Event A = 3 letter sequence is chosen without any repetition letters. Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 3.26: In a party of five persons, compute the probability that at least two have the same birthday (month/day), assume a 365 day a year. Solution: Sample space S= A day is a birthday of 5 persons Event A = at least two have same birthday. Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4.1: Consider an experiment “three coins are tossed”. Let the random variable X= ‘number of heads’ a) Find the values of X b) Find the probability of X c) Find the probability mass function d) Find the cumulative distribution function Solution: The sample space is S = {HHH, HHT, HTH, HTT, THH, THT, TTH, TTT} Event HHH HHT HTH HTT THH THT TTH TTT X 3 2 2 1 2 1 1 0 X P(X) pmf P(X) cdf F(X) 0 1/8 1/8 1/8 1 3/8 3/8 4/8 2 3/8 3/8 7/8 3 1/8 1/8 8/8 i.e. 1 Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4.2: A box of 6 ICs contains 2 defective. A computer center makes a random purchase of 3 of the ICs. If X is the number of defective chips purchased by the computer center, find the probability distribution of X. Solution: There are only 2 defective ICs in a box Therefore X can take values 0,1,2 P(x=r) = P(choosing exactly r defective chips) =P(choosing r defective and (3-r) good chips) = (2Cr. 4C3-r)/6C3 r=0,1,2 The probability distribution is represented in the following table X=r P(X=r) 0 1/5 1 3/5 2 1/5 Total= 1 Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4.3: Two dice are rolled. Let X denote the random variable which counts the total number of points on the upturned faces. Construct a table giving the non-zero values of probability mass function? Solution: X=r P(X=r) 2 1/36 3 2/36 4 3/36 5 4/36 6 5/36 7 6/36 8 5/36 9 4/36 10 3/36 11 2/36 12 1/36 Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4.4: A random variable X takes the values 1, 2, 3, and 4 such that 4P(X=1)=2P(X=2)=3P(X=3)=P(X=4) Find the probability and cumulative distribution function of X Solution: Let 4P(X=1)=2P(X=2)=3P(X=3)=P(X=4)=k Therefore P(X=1) = k/4 P(X=2) = k/2 P(X=3) = k/3 P(X=4) = k Since P(xi) = 1 We get k/4 + k/2 + k/3 + k = 1 25k/12 = 1 k=12/25 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science x PMF P(X) CDF F(X) 1 3/25 3/25 2 6/25 9/25 3 4/25 13/25 4 12/25 25/25 = 1 Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4.5: The probability distribution P(X) and cumulative distribution F(X) are given in the following table X X=1 X=2 X=3 X=4 X=5 Pmf 1/15 2/15 3/15 4/15 5/15 Cdf 1/15 3/15 6/15 10/15 15/15 =1 Find (i) (ii) Solution: (i) Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (ii) Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4.6: A random variable X has the following probability distribution function X 0 1 2 3 4 5 6 7 P(X) 0 k 2k 2k 3k k2 2k2 7k2 + k (i) Find k (ii) Evaluate P(x < 6), P(x >= 6), and P(0 < x < 5) (iii) If P(x C) > ½ , find minimum value of C, and (iv) Determine the distribution function CDF of x Solution: X 0 1 2 3 4 5 6 7 P(X) 0 k 2k 2k 3k k2 2k2 7k2 + k F(X) 0 k 3k 5k 8k 8k+ k2 8k+ 3k2 9k+ 10k2 (i) Since we have k + 2k + 2k + 3k + k2 +2k2 + 7k2 + k = 1 10k2 + 9k -1 = 0 10k2 + 10k – k - 1 = 0 10k(k+1) – 1(k+1) = 0 (10k -1)(k+1) = 0 Page 1 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science K = -1 or k = 1/10 But k is probability so it cannot be negative hence k = 1/10 (ii) P(x < 6) = P(x=0) + P(x=1) + P(x=2) + P(x=3) + P(x=4) + P(x=5) P(X < 6) = 0 + 1/10 + 2/10 +2/10 +3/10 +1/100 P(x < 6) =81/100 P(X 6) = 1 – P(X < 6) P(X 6) = 1 - 81/100 P(X 6) = 19/100 P(0 < x < 5) = P(x=1) + P(x=2) + P(x=3) + P(x=4) P(0 < x < 5) = 8k P(0 < x < 5) = 8/10 P(0 < x < 5) = 4/5 (iii) To find minimum value of C such that P(x C) > ½ Page 2 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Consider P(x 0) = P(X=0) = 0 P(x 1) = P(X=0) + P(X=1) =0+k P(X 1) = k = 1/10 P(x 2) = P(X=0) + P(X=1) + P(X=2) P(x 2) = 0 + k + 2k P(x 2) = 3k = 3/10 P(x 3) = P(X=0) + P(X=1) + P(X=2) + P(X=3) P(x 3) = 0 + k + 2k + 2k P(x 3) = 5k = 5/10 P(x 4) = P(X=0) + P(X=1) + P(X=2) + P(X=3) + P(X=4) P(x 4) = 0 + k + 2k + 2k + 3k P(x 4) = 8k = 8/10 Hence minimum value of C such that P(x C) > ½ is equal to 4. (iv) The cumulative distribution F(X) is given below X Fx(X) = P(X x ) 0 0 1 k = 1/10 2 3k = 3/10 3 5k = 5/10 Page 3 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science 4 8k = 8/10 5 8k + k2 = 81/100 6 8k + 3k2 = 83/100 7 9k + 10k2 = 1 Page 4 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4.7: The probability mass function of a random variable X is zero except at points x=0, 1, 2. At these points it has the values P(0) = 3C2 , P(1) = 4C – 10C2 and P(2)= 5C – 1 , for some C > 0 (i) Determine the value of C (ii) Compute the following probabilities P[x < 2] and P[1 a) (ii) P(x > b) = 0.05 Solution: (i) Since P(x a) = P(x >a) each must be ½ as total probability is 1. Hence Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (ii) Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4.14: A continuous random variable x has p.d.f. (i) Determine the constant k (ii) Compute P(X 1.5) (iii) Determine cumulative density function, F(x) Solution: (i) Constant ‘k’ is determined from consideration that total probability is unity. Page 1 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (ii) Page 2 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (iii) Determine CDF Substituting k Page 3 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science i.e. 1 = 1 Page 4 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 4.15: A continuous random variable x has p.d.f. (i) Determine the constant a (ii) Compute P(X < 1.5) (iii) Find P(1.5 < X < 2.5) Solution: (i) Constant ‘a’ is determined from consideration that total probability is unity. Page 1 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (ii) Page 2 of 4 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (iii) Determine P(1.5 < x 8: EXY 7 < ? ? EXY 7 ? ? < 1 EXY 6 Page 5 of 6 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science AB,&,. % &. % & . % . 1 5 5 AB, &,. . 6 12 12 1 25 AB, &,. 6 144 1 AB,&,. 144 Page 6 of 6 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 5.1: A die is rolled 3 times. What is the probability of (a) No fives turning up? (b) 1 five? (c) 3 fives? Solution: This is a binomial distribution because there are only 2 possible outcomes (we get a 5 or we don’t know, n=3 for each part.) Let X= number of fives appearing (a) Here, X=0 n Cx px qn-x 3 C0 (1/6)0 (5/6)3 = 125/216 = 0.5787 (b) Here , X=1 n Cx px qn-x 3 C1 (1/6)1 (5/6)2 = 75/216 = 0.3472 (c) Here, X=3 n Cx px qn-x 3 C3 (1/6)3 (5/6)0 = 1/216 = 0.0046 Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 5.2: Hospital records show that of patients suffering from a certain disease, 75% die of it. What is the probability that of 6 randomly selected patients, 4 will recover? Solution: This is a binomial distribution because there are only 2 possible outcomes (The patient die or does not die) Let X= number who recover Here n=6, and x=4 Let p=25% (success, i.e. they live) q=75% (failure, i.e. they die) The probability that 4 will recover n Cx px qn-x 6 C4 (0.25)4 (0.75)2 15 * 0.0039 * 0.5625 0.0329 Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 5.3: In the old days, there was a probability of 0.8 of success in any attempt to make a telephone call. (This often depended on the importance of the person making the call, or the operator's curiosity!) Calculate the probability of having 7 successes in 10 attempts. Solution: The probability of success p =0.8 and q=0.2 n=10 X= success in getting through The probability of 7 successes in 10 attempts n Cx px qn-x 10 C7 (0.8)7 (0.2)3 120 * 0.2098 * 0.008 0.2014 Page 1 of 1 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 5.4: A manufacturer of metal pistons finds that on the average, 12% of his pistons are rejected because they are either oversize or undersize. What is the probability that a batch of 10 pistons will contain (a) no more than 2 rejects? (b) at least 2 rejects? Solution: Let X= number of rejected pistons In this case, “success” means rejection! Here n=10, p=0.12 , q=0.88 (a) No rejects n Cx px qn-x 10 C0 (0.12)0 (0.88)10 1 * 1 * 0.2785 0.2785 (b) One reject n Cx px qn-x 10 C1 (0.12)1 (0.88)9 10 * 0.12 * 0.3165 0.3798 Page 1 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (c) Two rejects n Cx px qn-x 10 C2 (0.12)2 (0.88)8 45 * 0.0144 * 0.3596 0.2330 So the probability of getting no more than 2 rejects is Probability = P(X 2) =P(X=0) + P(X=1)+P(X=2) =0.2785 + 0.3798 + 0.2330 P(X 2) = 0.8913 Probability of at least 2 rejects = 1 – P(X 1) = 1 – [ P(X=0) +P(X=1)] = 1 – (0.2785 + 0.3798) = 1- 0.6583 Probability of at least 2 rejects = 0.3417 Page 2 of 2 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science Semester: I MCA11: Mathematical Foundation for Computer Science 1 Example 5.5: A fair coin is tossed 7 times. Find the probabilities of obtaining various numbers of heads. Solution: A fair coin is tossed 7 times. p= probability of appearing head = ½ q= 1 – p = 1 – ½ = ½ Let X= number of heads (a) No head n Cx px qn-x 7 C0 (1/2)0 (1/2)7 1 * 1 * 1/128 (b) One head n Cx px qn-x 7 C1 (1/2)1 (1/2)6 7 * 1/128 Page 1 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (c) Two heads n Cx px qn-x 7 C2 (1/2)2 (1/2)5 21 * 1/128 (d) Three heads n Cx px qn-x 7 C3 (1/2)3 (1/2)4 35 * 1/128 (e) Four heads n Cx px qn-x 7 C4 (1/2)4 (1/2)3 35 * 1/128 (f) Five heads n Cx px qn-x 7 C5 (1/2)5 (1/2)2 21 * 1/128 Page 2 of 3 MUMBAI EDUCATIONAL TRUST MET Institute of Computer Science (g) Six heads n Cx px qn-x 7 C6 (1/2)6 (1/2)1 7 * 1/128 (h) Seven heads n Cx px qn-x 7 C7 (1/2)7 (1/2)0 1 * 1/128 Page 3 of 3