Pick a technique that we have learned to solve the following two sets of linear
ID: 3700800 • Letter: P
Question
Pick a technique that we have learned to solve the following two sets of linear equations: xi +3x2 x3-4 2x2x2+X31 2x 3x2 x3 3 and 4X1 + X2 + X3 + X4=6 3x7x2-X3 X4 1 7x1 3x2-5x38x4-3 xi +X2X32x43 If you know a programming language, develop a code to read in the input, systematically perform the chosen technique, and then print the output, i.e., the solution to the x-vector for each system. If you do not know a programming language, then type the steps of an algorithm that you would systematically follow to apply the technique and solve each set of systems of linear equations above For example, you may select the technique of finding the inverse of the coefficient matrix A, and then applying Theorem 1.6.2:x ATb. There are several ways that we have learned to find A1. Pick one of those ways to code or write as an algorithm. Or another example, you may select Cramer's rule. Within Cramer's rule, there are several techniques that we learned to find the determinant of a matrix. Pick one of those ways to code or write as an algorithm. What to submit: For those who choose to code, submit to me a PDF of the computer code, and a PD of the screenshots of the input and the output for each set of systems of linear equations above. Make sure to use comments throughout the code so that I can understand what each step of the code is performing.Explanation / Answer
Algorithm :
step 1 : declare the variables
step 2 : read the order of the matrix
step 3 : taking the coefficients of linear equations as :
step 4 : Do for i = 1 to n
step 5 : Do for j = 1 to n+1
Step 6 : read A[i][j]
step 7 : end for j
step 8 : end for i
step 9 : call det(a,n) method as determinant = det (a,n)
step a : det(a,n) method implementation
step a1 : declaring variables
step a2 : if n =2 then determinant = determinant + a[0][0]*a[1][1]-a[0][1]*a[1][0]; return determinant;
step a3 : Do for i =1 to n
step a4 : Do for j =1 to n
step a5 : Do for k =1 to n
step a6 : if j != 0 and k != i then
step a7 : finding minor as Minor[c1][c2] = a[j][k]
step a8 : increase c2 by 1.
step a9 : if(c2>n-2) then c1 is increased by 1 and c2=0 .end if
step a10 : end if and for k
step a11 : end for j
step a12 : end for i
step 10 : if determinant =0 then stop execution else continues execution
step 11 : call cofactors(a,n) method
step a : cofactors(a,n) method implementation
step a1 : declaring variables
step a2 : Do for q =1 to n
step a3 : Do for p =1 to n
step a4 : Do for i =1 to n
step a5 : Do for i =1 to n
step a6 : if i != q and j != p then
step a7 : determine matrix b[m][n]=num[i][j]
step a8 : if (f<(n-2)) then f is incremented by 1.otherwise m will be incremented by 1.
step a9 : end if and for j
step a10 : end for i
step a11 : compute cofactors[n] = pow(-1,q + p) * determinant(b,n-1)
step a12 : end for p
step a12 : end for q
step a13 : call transpose(matrix1,matrix2,n) method.
step b : transpose(a,b,n) method implementation.
step b1 : declare variables.
step b2: Do for i =1 to n
step b3: Do for j =1 to n
step b4: compute a[i][j] = b[j][i]
step b5: end for j
step b6 : end for i
step b7: d= det (b,n);
step b8 : Do for i =1 to n
step b9 : Do for j= 1 to n
step b10: compute inversematrix[i][j] = (1/d) * a[i][j]. and read second matrix.
step b11 : end for j
step b12 : end for i
step b13 : Do for i=i to n
step b14: Do for j=1 to n
step b15 : Do for k=1 to n
step b16 : compute sum= sum + a[i][k] * second[k][j]
step b17 : end for k
step b18: assign x[i]=sum
step b19: end for j
step b20: end for i
step b21: display the result x[n]
step a8 : if (f<(n-2)) then f is incremented by 1.otherwise m will be incremented by 1.