Matrices: Gauss method. Gauss Matrix Calculation: Examples

Science 2023

Table of contents:

Matrices: Gauss method. Gauss Matrix Calculation: Examples
Matrices: Gauss method. Gauss Matrix Calculation: Examples

Linear algebra, which is taught in universities in various speci alties, combines many complex topics. Some of them are related to matrices, as well as to the solution of systems of linear equations by the Gauss and Gauss-Jordan methods. Not all students manage to understand these topics, algorithms for solving various problems. Let's understand together the matrices and methods of Gauss and Gauss-Jordan.

Basic concepts

A matrix in linear algebra is a rectangular array of elements (table). Below are sets of elements enclosed in parentheses. These are matrices. From the above example, it can be seen that the elements in rectangular arrays are not only numbers. The matrix can consist of mathematical functions, algebraic symbols.

To understand some concepts, let's make matrix A from elements aij. Indexes are not just letters: i is the number of the row in the table, and j is the number of the column, in the area of the intersection of which the element is locatedaij. So, we see that we have a matrix of elements such as a11, a21, a12, a22 and so on. The letter n denotes the number of columns, and the letter m denotes the number of rows. The symbol m × n denotes the dimension of the matrix. This is the concept that defines the number of rows and columns in a rectangular array of elements.

Optionally, the matrix must have several columns and rows. With a dimension of 1 × n, the array of elements is single-row, and with a dimension of m × 1, it is a single-column array. When the number of rows and the number of columns are equal, the matrix is called square. Every square matrix has a determinant (det A). This term refers to the number that is assigned to the matrix A.

A few more important concepts to remember in order to successfully solve matrices are the main and secondary diagonals. The main diagonal of a matrix is the diagonal that goes down to the right corner of the table from the top left corner. The side diagonal goes to the right corner up from the left corner from the bottom.

Types of matrices
Types of matrices

Stepped matrix view

Look at the picture below. On it you will see a matrix and a diagram. Let's deal with the matrix first. In linear algebra, a matrix of this kind is called a step matrix. It has one property: if aij is the first non-zero element in the i-th row, then all other elements from the matrix below and to the left of aij, are null (i.e., all those elements that can be given the letter designation akl, where k>i andl<j).

Now consider the diagram. It reflects the stepped form of the matrix. The scheme shows 3 types of cells. Each type denotes certain elements:

  • empty cells - zero elements of the matrix;
  • shaded cells are arbitrary elements that can be both zero and non-zero;
  • black squares are non-zero elements, which are called corner elements, “steps” (in the matrix shown next to them, such elements are the numbers –1, 5, 3, 8).

When solving matrices, sometimes the result is that the "length" of the step is greater than 1. This is allowed. Only the "height" of the steps matters. In a step matrix, this parameter must always be equal to one.

Stepwise Matrix View
Stepwise Matrix View

Matrix reduction to step form

Any rectangular matrix can be converted to a stepped form. This is done through elementary transformations. They include:

  • rearranging strings;
  • add to one line another line, if necessary multiplied by some number (you can also perform a subtraction operation).

Let's consider elementary transformations in solving a specific problem. The figure below shows the matrix A, which needs to be reduced to a stepped form.

The problem of reducing a matrix to a stepped form
The problem of reducing a matrix to a stepped form

In order to solve the problem, we will follow the algorithm:

  • It is convenient to perform transformations on a matrix withthe first element in the top left corner (i.e., the "leading" element) is 1 or -1. In our case, the first element in the top row is 2, so let's swap the first and second rows.
  • Let's perform subtraction operations, affecting rows 2, 3 and 4. We should get zeros in the first column under the "leading" element. To achieve this result: from the elements of line No. 2, we sequentially subtract the elements of line No. 1, multiplied by 2; from the elements of line No. 3 we sequentially subtract the elements of line No. 1, multiplied by 4; from the elements of line No. 4 we sequentially subtract the elements of line No. 1.
  • Next, we will work with a truncated matrix (without column 1 and without row 1). The new "leading" element, standing at the intersection of the second column and the second row, is equal to -1. There is no need to rearrange the lines, so we rewrite the first column and the first and second rows without changes. Let's perform subtraction operations in order to get zeros in the second column under the "leading" element: from the elements of the third line we sequentially subtract the elements of the second line, multiplied by 3; subtract the elements of the second line multiplied by 2 from the elements of the fourth line.
  • It remains to change the last line. From its elements we subtract successively the elements of the third row. Thus, we got a stepped matrix.
Solution algorithm
Solution algorithm

Reduction of matrices to a step form is used in solving systems of linear equations (SLE) by the Gauss method. Before looking at this method, let's understand some of the terms related to SLN.

Matrices and systems of linear equations

Matrices are used in various sciences. Using tables of numbers, you can, for example, solve linear equations combined into a system using the Gauss method. First, let's get acquainted with a few terms and their definitions, and also see how a matrix is formed from a system that combines several linear equations.

SLU several combined algebraic equations with first power unknowns and no product terms.

SLE solution – found values of unknowns, substituting which the equations in the system become identities.

A joint SLE is a system of equations that has at least one solution.

Inconsistent SLE is a system of equations that has no solutions.

How is a matrix formed based on a system that combines linear equations? There are such concepts as the main and extended matrices of the system. In order to obtain the main matrix of the system, it is necessary to put in the table all the coefficients for the unknowns. The expanded matrix is obtained by adding a column of free terms to the main matrix (it includes known elements to which each equation in the system is equated). You can understand this whole process by studying the picture below.

The first thing we see in the picture is a system that includes linear equations. Its elements: aij – numerical coefficients, xj – unknown values, bi – constant terms (where i=1, 2, …, m, and j=1, 2, …, n). The second element in the picture is the main matrix of coefficients. From each equation, the coefficients are written in a row. As a result, there are as many rows in the matrix as there are equations in the system. The number of columns is equal to the largest number of coefficients in any equation. The third element in the picture is an augmented matrix with a column of free members.

Matrices and system of linear equations
Matrices and system of linear equations

General information about the Gauss method

In linear algebra, the Gauss method is the classical way of solving SLE. It bears the name of Carl Friedrich Gauss, who lived in the 18th-19th centuries. This is one of the greatest mathematicians of all time. The essence of the Gauss method is to perform elementary transformations on a system of linear algebraic equations. With the help of transformations, the SLE is reduced to an equivalent system of a triangular (stepped) form, from which all variables can be found.

It is worth noting that Carl Friedrich Gauss is not the discoverer of the classical method of solving a system of linear equations. The method was invented much earlier. Its first description is found in the encyclopedia of knowledge of ancient Chinese mathematicians, called "Mathematics in 9 books".

An example of solving the SLE by the Gauss method

Let's consider the solution of systems by the Gauss method on a specific example. We will work with the SLU shown in the picture.

The task of solving the SLU
The task of solving the SLU

Solving algorithm:

  1. We will reduce the system to a step form by the direct move of the Gauss method, but firstwe will compose an expanded matrix of numerical coefficients and free members.
  2. To solve the matrix using the Gaussian method (i.e. bring it to a stepped form), from the elements of the second and third rows, we sequentially subtract the elements of the first row. We get zeros in the first column under the "leading" element. Next, we will change the second and third lines in places for convenience. To the elements of the last row, add sequentially the elements of the second row, multiplied by 3.
  3. As a result of the calculation of the matrix by the Gauss method, we got a stepped array of elements. Based on it, we will compose a new system of linear equations. By the reverse course of the Gauss method, we find the values of the unknown terms. It can be seen from the last linear equation that x3 is equal to 1. We substitute this value into the second line of the system. You get the equation x2 – 4=–4. It follows that x2 equals 0. Substitute x2 and x3 into the first equation of the system: x 1 + 0 +3=2. The unknown term is -1.

Answer: using the matrix, the Gaussian method, we found the values of the unknowns; x1 =–1, x2=0, x3=1.

Application of the Gauss method
Application of the Gauss method

Gauss-Jordan method

In linear algebra there is also such a thing as the Gauss-Jordan method. It is considered a modification of the Gaussian method and is used to find the inverse matrix, calculate unknown terms of square systems of algebraic linear equations. The Gauss-Jordan method is convenient in that it allows solving the SLE in one step (without the use of direct and inversemoves).

Let's start with the term "inverse matrix". Suppose we have a matrix A. The inverse for it will be the matrix A-1, while the condition is necessarily satisfied: A × A-1=A -1 × A=E, i.e. the product of these matrices is equal to the identity matrix (the elements of the main diagonal of the identity matrix are ones, and the remaining elements are zero).

An important nuance: in linear algebra there is a theorem on the existence of an inverse matrix. A sufficient and necessary condition for the existence of the matrix A-1 is that the matrix A is nonsingular.

Basic steps on which the Gauss-Jordan method is based:

  1. Look at the first row of a particular matrix. The Gauss-Jordan method can be started if the first value is not equal to zero. If the first place is 0, then swap the rows so that the first element has a non-zero value (it is desirable that the number is closer to one).
  2. Divide all elements of the first row by the first number. You will end up with a string that starts with one.
  3. From the second line, subtract the first line multiplied by the first element of the second line, i.e. in the end you will get a line that starts from zero. Do the same for the rest of the lines. Divide each line by its first non-zero element to get 1's diagonally.
  4. As a result, you will get the upper triangular matrix using the Gauss - Jordan method. In it, the main diagonal is represented by units. The bottom corner is filled with zeros, andupper corner - various values.
  5. From the penultimate line, subtract the last line multiplied by the required coefficient. You should get a string with zeros and one. For the rest of the lines, repeat the same action. After all the transformations, the identity matrix will be obtained.

An example of finding the inverse matrix using the Gauss-Jordan method

To calculate the inverse matrix, you need to write the augmented matrix A|E and perform the necessary transformations. Let's consider a simple example. The figure below shows the matrix A.

The task of calculating the inverse matrix
The task of calculating the inverse matrix


  1. First, let's find the matrix determinant using the Gaussian method (det A). If this parameter is not equal to zero, then the matrix will be considered nonsingular. This will allow us to conclude that A definitely has A-1. To calculate the determinant, we transform the matrix to a stepwise form by elementary transformations. Let's count the number K equal to the number of row permutations. We changed the lines only 1 time. Let's calculate the determinant. Its value will be equal to the product of the elements of the main diagonal, multiplied by (–1)K. Calculation result: det A=2.
  2. Compose the augmented matrix by adding the identity matrix to the original matrix. The resulting array of elements will be used to find the inverse matrix by the Gauss-Jordan method.
  3. The first element in the first row is equal to one. This suits us, because there is no need to rearrange the lines and divide the given line by some number. Let's start workingwith the second and third lines. To turn the first element in the second row into 0, subtract the first row multiplied by 3 from the second row. Subtract the first row from the third row (no multiplication required).
  4. In the resulting matrix, the second element of the second row is -4, and the second element of the third row is -1. Let's swap the lines for convenience. From the third row subtract the second row multiplied by 4. Divide the second row by -1 and the third row by 2. We get the upper triangular matrix.
  5. Let's subtract the last line multiplied by 4 from the second line, and the last line multiplied by 5 from the first line. Next, subtract the second line multiplied by 2 from the first line. On the left side we got the identity matrix. On the right is the inverse matrix.
Inverse Matrix Calculation
Inverse Matrix Calculation

An example of solving SLE by the Gauss-Jordan method

The figure shows a system of linear equations. It is required to find the values of unknown variables using a matrix, the Gauss-Jordan method.

Problem for solving equations
Problem for solving equations


  1. Let's create an augmented matrix. To do this, we will put the coefficients and free terms in the table.
  2. Solve the matrix using the Gauss-Jordan method. From line No. 2 we subtract line No. 1. From line No. 3 we subtract line No. 1, previously multiplied by 2.
  3. Swap rows 2 and 3.
  4. From line 3 subtract line 2 multiplied by 2. Divide the resulting third line by –1.
  5. Subtract line 3 from line 2.
  6. Subtract line 1 from line 12 times -1. On the side, we got a column consisting of the numbers 0, 1 and -1. From this we conclude that x1=0, x2=1 and x3 =–1.
Gauss-Jordan method
Gauss-Jordan method

If you wish, you can check the correctness of the solution by substituting the calculated values into the equations:

  • 0 – 1=–1, the first identity from the system is correct;
  • 0 + 1 + (–1)=0, the second identity from the system is correct;
  • 0 – 1 + (–1)=–2, the third identity from the system is correct.

Conclusion: using the Gauss-Jordan method, we have found the correct solution to a quadratic system that combines linear algebraic equations.

Online calculators

The life of today's youth studying in universities and studying linear algebra has been greatly simplified. A few years ago, we had to find solutions to systems using the Gauss and Gauss-Jordan method on our own. Some students successfully coped with the tasks, while others got confused in the solution, made mistakes, asked classmates for help. Today, you can use online calculators when doing homework. To solve systems of linear equations, search for inverse matrices, programs have been written that demonstrate not only the correct answers, but also show the progress of solving a particular problem.

There are many resources on the Internet with built-in online calculators. Gaussian matrices, systems of equations are solved by these programs in a few seconds. Students only need to specify the required parameters (for example, the number of equations,number of variables).

Popular topic