

To solve this for x1 we have to eliminate both x2 part by multiplying equation I by a22 and equation II by a12 and subtracting II from I

And get

This transformed for x1 is

This equation can be solved if the denominator is not 0

And this term is the Determinant for a 2x2 Matrix.

The calculation of the Determinant for a 3x3 Matrix is similar. Starting at the Matrix equation

To solve this equation for X3 we eliminate x1 first and therefore multiply I by a21 and II by a11 and subtract II from I.

And get

Now we have to multiply II by a31 and III by a21 and subtract III from II

This is

If we eliminate the x2 part now we get

And finally

The denominator shall not be 0 to get a solution of this equation.
If we have a closer look onto the terms in the brackets now. It can be seen that they look like Determinants of 2x2 Matrixes. In fact it is

And this is the Determinant of the 3x3 Matrix. Only the sign is negative.If we look at the involved elements in the Matrix:

The building order becomes obvious:We first take a11 and multiply it by the Determinant of the remaining Matrix consisting of the elements except row 1 and column 1. Then we take a12 and multiply it by the Determinant of the Elements except row 1 and column 2. And then a13 is multiplied by the Determinant of the elements except row 1 and column 3. The 3 parts we add together with a switching sign: +..-...+
If we calculate the solution for x1 and x2, we get the same denominator and therefore the same Determinant. If we try to do the same for the 4x4 Matrix it would basically be the same but becomes much more complicate. So we better leave that

The calculation of the Determinant of a (n x n) Matrix is always the same. We take all the elements of one row (or it can as well be one column) and multiply them by the Determinant of the Matrix consisting of rest of the elements except the row and column the element is in. Then we add all this part with together with a switching sign starting at + The definition for the development of the determinant according to Laplace is

For i = element of {1…n}Whereas det Aij’ is the determinant of the Matrix consisting of the remaining elements. Laplace uses the elements of the first column instead of the first row. That’s basically the same.
"Development" means that we are not done by using this formula once. We have to develop the determinant by this formula. The 3 X 3 Matrix we had to dissect into 2 x 2 Matrixes and calculate the determinant of them first. A 4 x 4 Matrix needs to be dissect into 3 x 3 Matrixes which have to be dissect into their 2 x 2 Matrixes to calculate the determinant of them and build the determinants for the 3 x 3 Matrixes with this results and build the determinant of the 4 x 4 Matrix out of this.
It’s quite an effort to develop a determinant for a 4 x 4 Matrix already

Put into C# code that looks like this:
double CalcDet(TMatrix m, int order)
{
int i,j, k;
double sign = 1.0;
double dm = 0;
if (order <= 2)
if (order <= 2)
{
return m.a[0, 0] * m.a[1, 1] - m.a[1, 0] * m.a[0, 1];
}
else
{
TMatrix mm = new TMatrix(order - 1);// temporary matrix
for (i = 0; i < order; i++)
// index for the element of the top row
{
for(j=0; j < order-1; j++)
// index to copy the elements into a sub matrix
{
for(k=0; k < order-1; k++)
// index that runs down from second row to n
{
if (j < i)
mm.a[k, j] = m.a[k+1, j];
else
mm.a[k, j] = m.a[k+1, j+1];
}
}
dm = dm + sign * CalcDet(mm, order - 1) * m.a[0, i];
sign = -sign;
}
return dm;
}
}
With TMatrix as a class
{
public double[,] a;
public double[] y;
public double[] x;
public TMatrix(int size)
{
a = new double[size, size];
y = new double[size];
x = new double[size];
}
}
If we have a closer look onto the numerator of the equation for x3 of the 3 x 3 Matrix

This also looks like some determinants of 2 x 2 Matrixes.In fact its

With the involved elements

That’s a determinant as well.
If we switch the sign of both the numerator and the denominator, we get for x3

Similar we get for x1 and x2 for x3


That means to solve the Matrix equation we have to replace the column of the unknown element by the solution vector, calculate the determinant of this matrix and divide it by the determinant of the main Matrix. That's the method of Cramer and for small MAtrix equations this can be an elegant solution. For bigger Matrix equations it consumes quite some calculation time. But still it's worthwhile giving it a trial

I implement an online Matrix determinant solver. This determinant solver solver can be found here

To solve the Matrix equation by using determinants
To solve the Matrix equation by using determinants