Prime • An integer greater than one is called a prime number if its only positive divisors (factors) are one and itself. • Examples: • The first six primes are 2, 3, 5, 7, 11 and 13. • The prime divisors of 10 are 2 and 5. • The Fundamental Theorem of Arithmetic shows that the primes are the building blocks of the positive integers: every positive integer is a product of prime numbers in one and only one way, except for the order of the factors. (This is the key to their importance: the prime factors of an integer determines its properties.)
Prime • Algorithm to test whether an integer N>1 is prime: Step1: N = 2 ? If so, N is prime, If not, continue. Step2: 2 | N ? If so, N is not a prime, otherwise cont. Step3: Compute the largest integer K ≤ √N. Then Step4: D | N? where D is any odd number such that 1 < D ≤ K. If D | N, then N is not prime, otherwise, N is prime.
Greatest Common Divisor (GCD) • Given two numbers not prime to one another, find their greatest common divisor. • GCD(a, b) = p1min(a1, b1) p2min(a2,b2) …pkmin(ak, bk) wherep1,p2,p3,….,pk are prime factors of either a or b. and some of ai andbi may be zeros. • Example: 630 = 21. 3 2.5 1.7 1 450 = 2 1. 3 2.5 2.7 0 GCD(630, 450) = 2min(1, 1). 3 min(2, 2) 5min(1, 2). 7min(1, 0).= 2 1. 3 2.51. 7 0 = 90
Least Common Multiple (LCM) • LCM(a, b) = p1max(a1, b1) p2max(a2,b2) …pkmax(ak, bk) wherep1,p2,p3,….,pk are prime factors of either a or b. and some of ai andbi may be zeros. Example: 630 = 21. 3 2.5 1.7 1 450 = 2 1. 3 2.5 2.7 0 LCM(630, 450) = 2max(1, 1). 3 max(2, 2).5max(1, 2). 7max(1,0). = 2 1. 3 2.52. 7 1 = 3150
Euclidean Algorithm • The algorithm is based on the following two observations: • If b|a then gcd(a, b) = b. This is indeed so because no number (b, in particular) may have a divisor greater than the number itself (I am talking here of non-negative integers.) • If a = bt + r, for integers t and r, then gcd(a, b) = gcd(b, r).
Euclidean Algorithm • Indeed, every common divisor of a and b also divides r. Thus gcd(a, b) divides r. But, of course, gcd(a, b)|b. Therefore, gcd(a, b) is a common divisor of b and r and hence gcd(a, b) = gcd(b, r). The reverse is also true because every divisor of b and r also divides a.
Euclidean Algorithm • Example • Let a = 2322, b = 654. • 2322 = 654*3 + 360 gcd(2322, 654) = gcd(654, 360) • 654 = 360*1 + 294 gcd(654, 360) = gcd(360, 294) • 360 = 294*1 + 66 gcd(360, 294) = gcd(294, 66) • 294 = 66*4 + 30 gcd(294, 66) = gcd(66, 30) • 66 = 30*2 + 6 gcd(66, 30) = gcd(30, 6) • 30 = 6*5 gcd(30, 6) = 6 • Therefore, gcd(2322,654) = 6.
Euclidean Algorithm • The greatest common divisor of 190 and 34 is computed as follows using the Euclidean Algorithm:190 = 5 * 34 + 2034 = 1 * 20 + 1420 = 1 * 14 + 614 = 2 * 6 + 26 = 3 * 2 + 0 Since it is the next-to-last number appearing on the right-hand side of these equations,the GCD of the two is 2.
Euclidean Algorithm • The greatest common divisor of 878 and 82 is computed as follows via the Euclidean Algorithm:878 = 10 * 82 + 5882 = 1 * 58 + 2458 = 2 * 24 + 1024 = 2 * 10 + 410 = 2 * 4 + 24 = 2 * 2 + 0 Since it is the next-to-last number appearing on the right-hand side of these equations,the GCD of the two is 2.
Matrices • Consider two families A and B. • Every month, the two families have expenses such as: utilities, health, entertainment, food, etc. • Let us restrict ourselves to: food, utilities, and health. • How would one represent the data collected? • Many ways are available but one of them has an advantage of combining the data so that it is easy to manipulate them.
Matrices • We will write the data as follows: If we have no problem confusing the names and what the expenses are, then we may write This is what we call a Matrix.
Matrix: Addition • Addition of two matrices: Add entries one by one. For example, we have • Multiplication of a Matrix by a Number: In order • to multiply a matrix by a number, you multiply every • entry by the given number.
Matrices • The size of the matrix is given by the number of rows and the number of columns. If the two numbers are the same, we called such matrix a square matrix. • Consider the matrix: its diagonal is given by a and d.
Matrices • For the matrix Its diagonal consists of a, e, and k. In general, if A is a square matrix of order n and if aij is the number in the ith-row and jth-column, then the diagonal is given by the numbers aii, for i=1,..,n.
Upper-triangular and lower-triangular matrices • The diagonal of a square matrix helps define two type of matrices: upper-triangular and lower-triangular. • The diagonal subdivides the matrix into two blocks: one above the diagonal and the other one below it. • If the lower-block consists of zeros, we call such a matrix upper-triangular. • If the upper-block consists of zeros, we call such a matrix lower-triangular.
Matrices are upper-triangular, while the matrices • For example, the matrices are lower-triangular.
Transpose of a Matrix Now consider the two matrices • The matrices A and B are triangular. But there is something • special about these two matrices. • If you reflect the matrix A about the diagonal, you get the • matrix B. This operation is called the transpose operation. • Let A be a n x m matrix defined by the numbers aij, then • the transpose of A, denoted AT is the m x n matrix defined • by the numbers bij where bij = aji.
Transpose of a Matrix we have • For example, for the matrix
Matrices • Properties of the Transpose operation. If X and Y are m x n matrices and Z is an n x k matrix, then • 1. • (X+Y)T= XT+ YT • 2. • (XZ)T = ZTXT • 3. • (XT)T= X
Symmetric matrix • Symmetric matrix is a matrix equal to its transpose. So a symmetric matrix must be a square matrix. For example, the matrices are symmetric matrices.
Matrices • A diagonal matrix is a symmetric matrix with all of its entries equal to zero except may be the ones on the diagonal. So a diagonal matrix has at most n different numbers. For example, the matrices are diagonal matrices. Identity matrices are examples of diagonal matrices. Diagonal matrices play a crucial role in matrix theory.
Invertible Matrices • Invertible matrices are very important in many areas of science. For example, decrypting a coded message uses invertible matrices. • Definition. An n x n matrix A is called nonsingular or invertible if and only ifthere exists an n x n matrix B such that where In is the identity matrix. The matrix B is called the inverse matrix of A. Example: