#include<stdio.h>
#define N 3
// Function to get cofactor of mat[p][q] in temp[][]. n is
current
// dimension of mat[][]
void getCofactor(int mat[N][N], int temp[N][N], int p, int q, int
n)
{
int i = 0, j = 0,row,col;
// Looping for each element of the matrix
for (row = 0; row < n; row++)
{
for (col = 0; col < n; col++)
{
// Copying into temporary matrix only those element
// which are not in given row and column
if (row != p && col != q)
{
temp[i][j++] = mat[row][col];
// Row is filled, so increase row index and
// reset col index
if (j == n - 1)
{
j = 0;
i++;
}
}
}
}
}
/* Recursive function for finding determinant of matrix.
n is current dimension of mat[][]. */
int determinantOfMatrix(int mat[N][N], int n)
{
int D = 0; // Initialize result
if (n == 1)
return mat[0][0];
int temp[N][N]; // To store cofactors
int sign = 1,f; // To store sign multiplier
// Iterate for each element of first row
for (f = 0; f < n; f++)
{
// Getting Cofactor of mat[0][f]
getCofactor(mat, temp, 0, f, n);
D += sign * mat[0][f] * determinantOfMatrix(temp, n - 1);
// terms are to be added with alternate sign
sign = -sign;
}
return D;
}
/* function for displaying the matrix */
void display(int (*mat)[N], int row, int col)
{
int i,j;
for ( i = 0; i < row; i++)
{
for ( j = 0; j < col; j++)
printf(" %d", mat[i][j]);
printf("n");
}
}
// Driver program to test above functions
int main()
{
int
mat[N][N],matx[N][N],maty[N][N],matz[N][N],D[N],i,j,x,y,z,det;
printf("Enter the matrix of cofficeint of dimension 3X3:\n");
for(i=0;i<N;i++)
{
printf("\n Enter the %d Row:",i+1);
for(j=0;j<N;j++)
{
scanf("%d",&mat[i][j]);
matx[i][j]=mat[i][j];
maty[i][j]=mat[i][j];
matz[i][j]=mat[i][j];
}
}
det=determinantOfMatrix(mat, N);
printf("\n%d\n",det);
printf("Enter the matrix of D :\n");
for(i=0;i<N;i++)
scanf("%d",&D[i]);
for(i=0;i<N;i++)
{
matx[i][0]=D[i];
maty[i][1]=D[i];
matz[i][2]=D[i];
}
if(det!=0)
{
x=determinantOfMatrix(matx, N);
printf("\nx=%d\n",x/det);
y=determinantOfMatrix(maty, N);
printf("\ny=%d\n",y/det);
z=x=determinantOfMatrix(matz, N);
printf("\nz=%d\n",z/det);
}
else
printf("\nSystem does not have a unique solution because
determinant is 0");
return 0;
}
**C PROGRAMMING ONLY**!!!!!!! Create a script that will use Cramer's rule to find the Solutions of...
Cramer's Rule: 5. Use Cramer's Rule to find x,y and z for the following system of equations. X 2 7x + 2y - z= -1 ។ 6x + 5y + z = 16 -5x - 4y + 3z = -5 2 : 2 a. Write the coefficient matrix first for the system above. Call it matrix D. 7 2 5 L-8-4 3 1 14 ] = 0 b. Find the determinant of the coefficient matrix (det(D)).
Number theory: Part C and Part D please!
QUADRA range's Four-Square Theorem) If n is a natural be expressed as the sum of four squares. insmber, then n cam be expressed tice Λ in 4-space is a set of the form t(x,y, z, w). M:x,y,z, w Z) matrix of nonzero determinant. The covolume re M is a 4-by-4 no is defined to be the absolute value of Det M such a lattice, of covolume V, and let S be the...