
ISSN 2597-5250 Volume 2, 2019 | Pages: 245-248 EISSN 2598-232X The Implementation of Recursive Algorithm to Determine the Determinant of n x n Matrix Using Cofactor Expansion Rahmat Hidayat*, Seto Rahardyanto**, Pahlevi Wahyu Hardjita*** Informatics Engineering Department, Faculty of Science and Technology, UIN Sunan Kalijaga Yogyakarta Jl. Marsda Adisucipto No. 1 Yogyakarta 55281, Indonesia. Tel. +62-274-540971, Fax. +62-274-519739 Email: [email protected]*, [email protected]**, [email protected]*** Abstract. This research examines the algorithm to determine the Determinant of n x n matrix using cofactor expansion and the implementation using recursive algorithm. Random function is added as an option to generate large matrix. To identified singular matrix and to avoid unnecessary further process, the algorithm searches for rows that are multiples of integer from another row, or columns that are multiples of integer from another column, then returns 0 as a Determinant value. In order to minimize the number of iterations and computations, the algorithm searches for rows or columns having the highest number of zero elements to be expanded. The program will not expand zero element and immediately returns a value of zero for those cofactor. Finally the program calculates the number of iterations performed each time the cofactor expands to calculate the Determinant of 2 x 2 matrix.In conclusion, the data shows that the use of recursice algorithm to iteratively expand cofactor considering the row and column having highest number of zero, will reduce the number of iteration and computation. Keywords: Algorithm, Cofactor expansion, Determinant, Recursive INTRODUCTION the notation of two vertical lines on either side of the array that remains the standard to date (Debnath, 2013). Mathematics has a close relationship with informatics. In Europe, the famous German mathematician, In the academic text (Naskah Akademik) of the Gottfried Wilhelm Leibniz (1646 – 1716) separately Indonesian National Qualification Framework For invent the same idea of determinant. His results was Informatic And Computer Cluster In Aptikom V used by Gabriel Cramer (1704–1752), a Swiss Region (Kerangka Kualifikasi Nasional Indonesia mathematician, for solving linear equations in terms of untuk Rumpun Informatika dan Komputer di Aptikom determinants which known as cramer’s rule. Pierre Wilayah V), there are topics in Mathematics and Simon Laplace (1749–1827), a famous French Statistics with a field studies of discrete structure and mathematician, in 1772 proved the expansion of computational science. Courses in the curriculum 2016 determinant of order n in terms of minors or cofactors of the Informatics Engineering program in Sunan along the ith row, known as the Laplace Expansion Kalijaga State Islamic University, Yogyakarta, related Theorem. Carl Friedrich Gauss (1777 – 1855) German to those topics area are Discrete Mathematic, Calculus, Mathematician first used the properties of determinant Numerical Methods, Statistics & Probability and Linear in his Disquisitiones Arithmeticae. (Gauss, 1965). Algebra. One of the material learned in Linear Algebra Afterward, French Mathematicians, Augustin Louis course is about determinants. Cauchy contribute to the theory of determinants in the In addition to the topic area of Mathematics and context of quadratic forms in n variables (Cauchy, Statistics, there are also topics in the area of Algorithms 1821). and Programming, with one of the related course Recursive function theory can be traced to its origin namely the Algorithm & Programming in which a since around 1931 about primitive recursive (Kleene, recursive function studied. This paper intends to 1981). In 1932, Rozsa Peter presented Rekursive collaborate the use of recursive algorithms to find Funktionen, followed by Herbrand-Godel introduced determinants with orders of more than three using term ‘general recursiveness’. In 1936, Turing notion of cofactor expansion, implemented using Python ‘computability’ of recursive function. In its language programming. As the results, Informatics development, the recursion function and its variance Engineering, Mathematics or Mathematics Education are used in many cases, such as to compute the discrete students can add their learning material. cosine transform (Hou, 1987), for solving a class of Determinant, for more than hundreds of years, has non-linear matrix equations (Yan, B.Moore, & Helmke, many significant roles in a several of mathematical 1994), to adaptive CFAR detection (Conte, De Maio, & areas such as geometry, differential equations including Ricci, 2002), to construct Unitary and symplectic theory of equations and matrix algebra. Seki Kowa group representations (Baclawski, 1982), and many (1642–1708) first discovered the idea of 2 x 2 others cases in various fields of study. determinant in 1683 while to denote it, Arthur Cayley Thus, this essay will discuss the implementation of (1821–1895) a British mathematician first introduced recursive algorithm to determine the determinant of n x 246 2: 245- 248, 2019 n matrix using cofactor/laplace expansion in Python After eliminate the headings, then we are given the language programming. following rectangular array of numbers with four rows and five columns, called a ‘matrix’. MATERIALS AND METHODS [ ] Matrix and Determinant Simply, a matrix can be defined as a rectangular array of numbers. Nevertheless, matrix occurs in any Determinant is certain function that associates a real contexts. For instance, the following rectangular array number with a square matrix. One of the properties of with four rows and five columns might describe the determinant is that the value of a determinant is zero if number of minutes that a lecturer spent times during an any two rows (or columns) are identical. office hour in campus, it can be seen in the table 1. Table 1. The number of minutes one lecturer spent on campus during office hour. Monday Tuesday Wednesday Thursday Friday Teaching 120 0 60 100 30 Research 30 150 30 45 0 Community Service 10 30 0 15 120 Administrative 180 200 150 60 0 Determinants by Cofactor Expansion two integers. Three important laws must be obeyed by Definition: If A is a square matrix, then the minor of Recursive algorithm : entry aij is denoted by Mij and is defined to be the 1. A recursive algorithm must have a base case. determinant of the submatrix that remains after the ith 2. A recursive algorithm must change its state and row and jth column are deleted from A. The number move toward the base case. (i+j) 3. A recursive algorithm must call itself, recursively. (-1) Mij is denoted by Cij and is called the cofactor of entry aij. The definition of a n x n determinant in In order to compare the number of iterations needs terms of minors and cofactors is to find the determinant, we arrange three algorithms : det (A)= a c +a c +.....+a c 1. program1 using cofactor expansion without 1j 1j 2j 2j nj nj considering the row or column containing zero nor This method of evaluating det (A) is called cofactor whether there is row or column multiple integer A expansion along the jth column of And other row or column 2. program2 using cofactor expansion and analyze det (A)= ai1cil+ai2ci2+.....+aincin whether there is row or column multiple integer as cofactor expansion along the ith row. other row or column without considering the row or Smart choice of using which row or column are column containing zero used to simplifier the calculation as well as to ease the 3. program3 using cofactor expansion, analyze number of iteration. The row or column containing whether there is row or column multiple integer most zero is suggested as the basis of finding the other row or column and considering the row or determinant (Anton & Rorres, 2011). column containing zero Recursive Algorithm Recursion is a method to solve a problem where the Pseudocode program1 solution use the solution resulting from smaller function hitungDeterminan: instances of the same problem (compared to iteration) input: matrix, jumlah iterasi = iterasi + 1 (Graham, Knuth, Patashnik, & Liu, 1989). Many 1. if sizeMatrix=1 , return jumlah * mattrix[0][0] computer programming languages, allows a function to 2. otherwise, call itself as a form of recursive code. Based on the for i in range(lebar): bantu1 = [] number self-reference contained, recursive algorithm for j in range(1, lebar): can be divided into single recursion or multiple bantu2 = [] recursion. Recursion also can be categorized into direct for k in range(lebar): if k != i: recursion and indirect recursion, depends on the way bantu2.append(mat[j][k]) the function is called, whether it referred by its angka += 1 function, or by other function that called by the bantu1.append(bantu2) function. Several examples of recursive programs are total += jumlah * hitungDeterminan(bantu1, kof * mat[0][i]) kof *= -1 the program to calculate the factorial of a natural return total number, to computes the greatest common divisor of end hitungDeterminan Rahmat Hidayat, et.al. – The Implementation of Recursive Algorithm to Determine the Determinant of n x n... 247 On the other hand, to compare program 1 and Pseudocode program 2 program2, samples matrix with size 5 to 10 containing function hitungDeterminan: row or column with most zero are used. input: matrix, jumlah iterasi = iterasi + 1 Table 3. Sample matrix used to compare the number iterations 1. if sizeMatrix=1 , total= jumlah * mattrix[0][0] program1, program2
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-