<?xml version="1.0" encoding="UTF-8"?>
<Worksheet><Version major="6" minor="1"/><View-Properties><Zoom percentage="100"/></View-Properties><Styles><Layout alignment="left" bullet="none" firstindent="0.0" leftmargin="0.0" linebreak="space" linespacing="0.0" name="Normal" rightmargin="0.0" spaceabove="0.0" spacebelow="0.0"/><Layout alignment="centred" bullet="none" linespacing="0.5" name="Maple Output"/><Font background="[0,0,0]" bold="true" executable="true" family="Monospaced" foreground="[255,0,0]" name="Maple Input" opaque="false" size="12"/><Font background="[0,0,0]" bold="false" executable="false" family="Times New Roman" foreground="[0,0,0]" italic="false" name="Text" opaque="false" size="12" underline="false"/><Font background="[0,0,0]" family="Times New Roman" foreground="[0,0,255]" name="2D Output" opaque="false" readonly="true" size="12"/></Styles><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">with( linalg ):</Text-field></Input></Group><Group><Input><Text-field layout="Normal" style="Text">In most linear algebra courses, the algorithm for finding the determinant involves </Text-field><Text-field layout="Normal" style="Text">computing the solutoin recursively using a cofactor expansion.  The problem with</Text-field><Text-field layout="Normal" style="Text">this approach is that it has complexity O(n!), which is clearly intractable for any </Text-field><Text-field layout="Normal" style="Text">nontrivial n.</Text-field><Text-field layout="Normal" style="Text"/><Text-field layout="Normal" style="Text">Using the LU decomposition leads to a polynomial time algorithm.  Essentially, we </Text-field><Text-field layout="Normal" style="Text">use the following theorem:</Text-field><Text-field layout="Normal" style="Text"/><Text-field layout="Normal" style="Text">Theorem 3.2.1 (Matrix Computations, Golub and Loan)</Text-field><Text-field layout="Normal" style="Text">Real, nxn matrix A has an LU factorization if det(A(1:k,1:k)) != 0 for k = 1:n-1.</Text-field><Text-field layout="Normal" style="Text">If an LU factorization exists and A is nonsingular, then the LU factorization is </Text-field><Text-field layout="Normal" style="Text">unique and det(A)=u_11..u_nn</Text-field><Text-field layout="Normal" style="Text"/><Text-field layout="Normal" style="Text">So essentially we use gaussian elimination to check if the matrix is nonsingular, and </Text-field><Text-field layout="Normal" style="Text">if its not we can use the results of the elimination, the product of the diagonal entries </Text-field><Text-field layout="Normal" style="Text">of U, to get the determinant. </Text-field></Input></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">A := matrix( 3, 3, [3,4,5,1,2,3,3,1,5] );</Text-field></Input><Output><Text-field layout="Maple Output" style="2D Output"><Equation>NiM+SSJBRzYiLUknbWF0cml4RzYkSSpwcm90ZWN0ZWRHRilJKF9zeXNsaWJHRiU2IzclNyUiIiQiIiUiIiY3JSIiIiIiI0YuNyVGLkYyRjA=</Equation></Text-field></Output></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">B := LUdecomp( A );</Text-field></Input><Output><Text-field layout="Maple Output" style="2D Output"><Equation>NiM+SSJCRzYiLUknbWF0cml4RzYkSSpwcm90ZWN0ZWRHRilJKF9zeXNsaWJHRiU2IzclNyUiIiQiIiUiIiY3JSIiISMiIiNGLiNGL0YuNyVGMkYyIiIn</Equation></Text-field></Output></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">det( A );</Text-field></Input><Output><Text-field layout="Maple Output" style="2D Output"><Equation>NiMiIzc=</Equation></Text-field></Output></Group><Group><Input><Text-field layout="Normal" prompt="&gt; " style="Maple Input">B[1,1] * B[2,2] * B[3,3];</Text-field></Input><Output><Text-field layout="Maple Output" style="2D Output"><Equation>NiMiIzc=</Equation></Text-field></Output></Group><Text-field/></Worksheet>