School of Information and Communications Technology ALBUKHARY INTERNATIONAL UNIVERSITY, MALAYSIA Lecture Notes CSM1023 MATHEMATICAL TECHNIQUES I School of ICT, AiU RMA, July 2012 KNAR, October 2012 Who am I? Mr. Khairul Najmy Abdul Rani Room 09-4-12, Level 4, School of ICT Building Email: najmy@aiu.edu.my Phone: 04-774-7421 Consultation Hours: School of ICT, AiU 2 RMA, July 2012 KNAR, September 2012 October 2012 Who are U? • Introduce briefly yourself: – – – – Name Home Country Ambition What do you Think about Mathematics? School of ICT, AiU 3 RMA, July 2012 KNAR, September 2012 October 2012 Students Mathematics and Related Software Knowledge • Please raise your hand, who has learnt about linear algebra or calculus? • Please raise your hand, who used to study probability and statistics? • Please raise your hand, who has learnt to use any mathematical software e.g. MATLAB® or SIMULINK® or SCILAB® or MATHEMATICA®, or MATHCAD® or SPSS® etc. ? School of ICT, AiU 4 RMA, July 2012 KNAR, September 2012 October 2012 Overview of the Course • Course Name: Mathematical Techniques I • Course Learning Outcome At the end of the course, the student should be able to:LO1: describe the application of given mathematical concepts or structures. LO2: demonstrate the basic principle of probability and statistics. LO3: illustrate the basics of linear algebra, number theory and their applications. LO4: use MATLAB® or equivalent tools for mathematical computation and solving problems. School of ICT, AiU 5 RMA, July 2012 KNAR, September 2012 October 2012 Overview of The Course • Teaching Mode – Lecture and Practical Lab • Assessment – Homework – Quizzes – Assignments 5% 5% 20% – Lab Work 15% – Midterm Test – Final Examination – Total 15% 40% 100% School of ICT, AiU 6 RMA, July 2012 KNAR, September 2012 October 2012 Reference Main references supporting the course 1. Fleming, W., Varberg, D., & Kasube, H. (1992). Algebra and Trigonometry: A Problem Solving Approach, (4th Ed). New Jersey: Prentice-Hall. 2. Patterson, B. A.S. (1991). Computer Related Mathematics. Oxford: NCC Blackwell Limited. 3. Kolman, B., & Hill, D. R. (2001). Introductory Linear Algebra with Applications, (7th Ed). New Jersey: Prentice-Hall. 4. Freund, J. E., & Perles, B. M. (2004).Statistics – A First Course, (8th Ed). New Jersey: PrenticeHall. 5. Stark, H. M. (1978). An Introduction to Number Theory. Cambridge: MIT Press. Additional text references supporting the course 6.Montgomery, D. C., & Runger, G. C. (1999). Applied Statistics and Probability for Engineers, (2nd Ed). New York: John Wiley & Sons. 7.Munro, J. E. (1992). Discrete Mathematics. New Jersey: Prentice-Hall. 8.Perry, W. L. (1988). Elementary Linear Algebra. New York: McGraw-Hill. 9.Strang, G. (2006). Linear Algebra and its Applications, 4th Ed). Florence: Thomson Brooks/Cole. Not limited to the above list only School of ICT, AiU 7 RMA, July 2012 KNAR, September 2012 October 2012 Rules & Regulation • All students must abide by the Student Code of Conduct as stipulated in Student Handbook • Specifically on : discipline, attendance/punctuality, plagiarism, and examination • Merit/demerit point system still applies • Late submissions of assignments/projects without a valid reason will be penalized Tests and Final Examination are compulsory • Being ethical all the time e.g. respectful, honest, responsible, polite, etc. School of ICT, AiU 8 RMA, July 2012 KNAR, September 2012 October 2012 Week 1 Session 1 School of ICT, AiU RMA, July 2012 KNAR, September 2012 October 2012 Why Study Mathematics? • A significant proportion of computer science concepts cannot be described without sophisticated mathematics. • Studying mathematics is probably the best way of learning how to think logically and clearly, and this kind of thinking helps immensely when doing computer science. • In short, a lot of computing study, e.g. computer science depends on mathematics. [Source: http://users.dickinson.edu/~jmac/selectedtalks/math-and-cs-talk.pdf] School of ICT, AiU 10 RMA, July 2012 KNAR, September 2012 October 2012 Conventional Number Systems • A number system is a set of rules and symbols used to represent a number. • Additive: Numbers have intrinsic value:, e.g.: Roman numerals: LVIII = 50 + 5 + 1 + 1 + 1 = 58 • Positional: Value depends on position: e.g.: Decimal system: 55 = 5 x 10 + 5 x 1 • Additive number systems are not used much anymore: – Awkward to use. – Prone to errors. School of ICT, AiU 11 RMA, July 2012 KNAR, September 2012 October 2012 Computer Number Systems • The decimal system is a base-10 system. • There are 10 distinct digits (0 to 9) to represent any quantity. • For an n-digit number, the value that each digit represents depends on its weight or position. • The weights are based on powers of 10. School of ICT, AiU 12 RMA, July 2012 KNAR, September 2012 October 2012 Computer Number Systems • Expand the decimal number 645810: 6458=(6 x 103)+(4 x 102)+(5 x 101)+(8 x 100) series of additions. • Decimal place values 105 104 103 102 101 100 100,000 10,000 1,000 100 10 1 Tens Ones Hundred Ten Thousands Hundreds Thousands Thousands School of ICT, AiU 13 RMA, July 2012 KNAR, September 2012 October 2012 Computer Number Systems • The binary system is a base-2 system. • There are 2 distinct digits (0 and 1) to represent any quantity. • To express any number in base-2 we use powers much like our own decimal system. School of ICT, AiU 14 RMA, July 2012 KNAR, September 2012 October 2012 Computer Number Systems • Expand the binary 10102: 10102=( 1 x 23 )+( 0 x 22 )+( 1 x 21 )+( 0 x 20 ) series of additions. • Binary place values 211 210 29 28 2048 1024 512 256 School of ICT, AiU 27 26 128 64 15 25 24 23 22 21 20 32 16 8 4 2 RMA, July 2012 KNAR, September 2012 October 2012 1 Computer Number Systems • The octal system is a base-8 system. • There are 8 distinct digits (0-7) to represent any quantity. • To express any number in base-8 we use powers much like our own decimal system. School of ICT, AiU 16 RMA, July 2012 KNAR, September 2012 October 2012 Computer Number Systems • Expand the hexadecimal 1278: 1278=( 1 x 82 )+( 2 x 81 )+( 7 x 80 ) series of additions. • Octal place values 86 85 84 83 82 81 80 32,768 4096 512 64 8 1 262,144 School of ICT, AiU 17 RMA, July 2012 KNAR, September 2012 October 2012 Computer Number Systems • The hexadecimal system is a base-16 system. • There are 16 distinct digits (0-9, A(10)F(15)) to represent any quantity. • To express any number in base-16 we use powers much like our own decimal system. School of ICT, AiU 18 RMA, July 2012 KNAR, September 2012 October 2012 Computer Number Systems • Expand the hexadecimal 5AE716: 5AE716=( 5 x 163 )+( 10 x 162 )+( 14 x 161 )+ (7 x 160 ) series of additions. • Hexadecimal place values 166 165 164 163 1,048,576 65536 4096 162 161 160 16,777,216 School of ICT, AiU 19 256 16 1 RMA, July 2012 KNAR, September 2012 October 2012 Number Systems Conversion • Converting binary to decimal, e.g. 100012. 100012 = (1 x 24) + ( 0 x 23 )+ ( 0 x 22 )+ ( 0 x 21 )+ ( 1 x 20 ) = 16 + 0 + 0 + 0 + = 1710 School of ICT, AiU 20 1 RMA, July 2012 KNAR, September 2012 October 2012 Number Systems Conversion • Converting decimal to binary, e.g. 8910. 89/2 = 44 remainder 1 44/2 = 22 remainder 0 22/2 = 11 remainder 0 11/2 = 5 remainder 1 5/2 = 2 remainder 1 2/2 = 1 remainder 0 Hence, 8910 = 10110012 [(1 x 26) + ( 0 x 25 )+ ( 1 x 24 )+ ( 1 x 23 )+ (0 x 22 ) + ( 0 x 21 )+ ( 1 x 20 )] School of ICT, AiU 21 RMA, July 2012 KNAR, September 2012 October 2012 Number Systems Conversion • Converting octal to decimal, e.g. 5268 5268=( 5 x 82 )+( 2 x 81 ) )+( 6 x 80 ) = 320 + 16 + 6 = 3428 School of ICT, AiU 22 RMA, July2012 2012 KNAR, September Number Systems Conversion • Converting decimal to octal, e.g. 50510. 505/8 = 63 remainder 1 63/8 = 7 remainder 7 Hence, 50510 = 7718 [(7 x 82) + ( 7 x 81 )+ ( 1 x 80)] School of ICT, AiU 23 RMA, July 2012 KNAR, September 2012 October 2012 Number Systems Conversion • Converting hexadecimal to decimal, e.g. 70F16 70F16=( 7 x 162 )+( 0 x 161 ) )+( 15 x 160 ) = 1792 + 0 + 15 = 180710 School of ICT, AiU 24 RMA, July2012 2012 KNAR, September Number Systems Conversion • Converting decimal to hexadecimal, e.g. 30010. 300/16 = 18 remainder 12 = C 18/16 = 1 remainder 2 Hence, 30010 = 12C16 [(1 x 162) + ( 2 x 161 )+ ( 12 x 160)] School of ICT, AiU 25 RMA, July 2012 KNAR, September 2012 October 2012 Number Systems Conversion • Converting binary to hexadecimal, e.g. 1011012. 0010 11012 2 13 = 2D16 Hence, 1011012 = 2D16 School of ICT, AiU 26 RMA, July 2012 KNAR, September 2012 October 2012 Number Systems Conversion • Converting hexadecimal to binary, e.g. 8F16. 8 F16 1000 1111 = 100011112 Hence, 8F16 = 100011112 School of ICT, AiU 27 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • The inverse of a function is the same as reflecting a function across the line y = x • Firstly, interchange x and y and then solve for y. • The inverse of f(x) is denoted by f-1(x). [Source: http://library.thinkquest.org/20991/alg2/log.html] School of ICT, AiU 28 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • Example: Find f-1(x) of 3x + 1. • Solution: The equation is y = 3x + 1. Interchange x and y: x = 3y + 1. Solve for y: x - 1 = 3y. (x - 1)/3 = y. Then, f-1(x) = (x - 1)/3. School of ICT, AiU 29 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • The exponential functions are generally depicted as f(x) = ax + B where a is any real constant and B is any expression. • An example of an exponential function: f(x) = e-x - 1 • To graph exponential functions, remember that unless they are transformed, the graph will always pass through (0,1) and will approach, but not touch or cross the x-axis. School of ICT, AiU 30 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • Problem: Graph f(x) = 2x. • Solution: Plug in numbers for x and find values for y, as done in the table below: ________________ | x: | 0 | 1 | 2 | 3 | --------------------------| y: | 1 | 2 | 4 | 8 | --------------------------• Now plot the points and draw the graph. School of ICT, AiU 31 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations School of ICT, AiU 32 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • The inverse functions of exponential functions is called logarithmic functions. • For example, the inverse of y = ax is y = logax, which is the same as x = ay. • Logarithms written without a base are understood to be base 10. • This definition is explained by knowing how to convert exponential equations to logarithmic form, and vice versa. School of ICT, AiU 33 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • Examples 1: Convert to logarithmic form: 8 = 2x. Solution: Remember that the logarithm is the exponent: x = log28. • Example 2: Convert to exponential form: y = log35. Solution: Remember that the logarithm is the exponent: 3y = 5. School of ICT, AiU 34 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • The general conversion between exponential and logarithmic (including natural logarithmic, ln) functions: School of ICT, AiU 35 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • Sometimes you can solve equations containing logarithms by changing everything in logarithmic form to exponential form. • Example 3: Solve log2x = -3. Solution: Convert the logarithm to exponential form: 2-3 = x, then, x = 1/23 = 1/8. School of ICT, AiU 36 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • There are five special rules that you ought to always have in mind when working with logarithms. 1. For any positive numbers x and y, loga (x * y) = loga x + loga y when a <> 1. Example 4: Simplify: log2 x + log2 6. Solution: log2 (x * 6). 2. For any positive numbers x and p, logaxp = p * loga x. Example 5: Simplify: logb9-x. Solution: -x * logb9. School of ICT, AiU 37 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations 3. For any positive numbers x and y, loga(x/y) = logax - logay. Example 6: Express as a single logarithm: logax - 5logay Solution: logax - logay5 (Using the 2nd rule.) Use the 3rd rule in reverse yields loga (x/y5). 4. loga a = 1. 5. loga 1 = 0. School of ICT, AiU 38 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • To solve for an exponential equation, take logarithms of both sides and use the listed five rules. • Example 7: Solve for x: 3x = 8. Solution: Take the logarithm of both sides: log 3x = log 8. Use theorem 2: x * log 3 = log 8. Solve for x by dividing each side by log 3: x = (log 8/log 3). A decimal approximation may be found if desired: x = 1.8929. School of ICT, AiU 39 RMA, July 2012 KNAR, September 2012 October 2012 Exponential Functions and Inverse Relations • To solve logarithmic equations, you convert them to exponential form and solve for x. • Example 8: Solve log3 (5x + 7) = 2 for x. Solution: Write an equivalent exponential expression: 5x + 7 = 32. 5x + 7 = 9. Solve for x: 5x = 9 – 7 = 2. Then, x = (2/5) = 0.4. School of ICT, AiU 40 RMA, July 2012 KNAR, September 2012 October 2012 Binary and Natural Logarithms • The binary logarithm (log2 n) is the logarithm to the base 2. • Its inverse function: n ↦ 2n. • The binary logarithm of n is the power to which the number 2 must be raised to obtain the value n. • This makes the binary logarithm useful for anything involving powers of 2, i.e. doubling. School of ICT, AiU 41 RMA, July 2012 KNAR, September 2012 October 2012 Binary and Natural Logarithms • Plot of log2 n. School of ICT, AiU 42 RMA, July 2012 KNAR, September 2012 October 2012 Binary and Natural Logarithms • The natural logarithm is the logarithm to the base e, where e is an irrational and transcendental constant approximately equal to 2.718281828. • The natural logarithm is generally written as ln(x), loge(x) or sometimes, if the base of e is implicit, as simply log(x). School of ICT, AiU 43 RMA, July 2012 KNAR, September 2012 October 2012 Binary and Natural Logarithms • Plot of logen = ln(n). School of ICT, AiU 44 RMA, July 2012 KNAR, September 2012 October 2012 Binary and Natural Logarithms • The conversion of natural log into binary log. • Example 9: log2x = log x / log 2. On the right side, you can use logarithm in any base (calculators usually provide base-10 and base-e), just be sure to use the same base in both cases. Thus: log2x = logex / loge2 = ln x / ln 2. or: log2x = log10x / log102. School of ICT, AiU 45 RMA, July 2012 KNAR, September 2012 October 2012 THANK YOU Q&A School of ICT, AiU RMA, July2012 2012 KNAR, September