Detailed solution of the system of equations by the Gauss method. Algorithm and examples of solving by the Gauss method a system of linear equations with a square matrix of the system

In this article, the method is considered as a way to solve systems of linear equations (SLAE). The method is analytical, that is, it allows you to write a solution algorithm in a general form, and then substitute values ​​from specific examples there. Unlike the matrix method or Cramer's formulas, when solving a system of linear equations using the Gauss method, you can also work with those that have infinitely many solutions. Or they don't have it at all.

What does Gauss mean?

First you need to write down our system of equations in It looks like this. The system is taken:

The coefficients are written in the form of a table, and on the right in a separate column - free members. The column with free members is separated for convenience. The matrix that includes this column is called extended.

Further, the main matrix with coefficients must be reduced to the upper triangular shape. This is the main point of solving the system by the Gauss method. Simply put, after certain manipulations, the matrix should look like this, so that there are only zeros in its lower left part:

Then, if you write the new matrix again as a system of equations, you will notice that the last row already contains the value of one of the roots, which is then substituted into the equation above, another root is found, and so on.

This is a description of the solution by the Gauss method in the most general terms. And what happens if suddenly the system does not have a solution? Or are there an infinite number of them? To answer these and many more questions, it is necessary to consider separately all the elements used in the solution by the Gauss method.

Matrices, their properties

There is no hidden meaning in the matrix. It's just a convenient way to record data for later operations. Even schoolchildren should not be afraid of them.

The matrix is ​​always rectangular, because it is more convenient. Even in the Gauss method, where everything boils down to building a triangular matrix, a rectangle appears in the entry, only with zeros in the place where there are no numbers. Zeros can be omitted, but they are implied.

The matrix has a size. Its "width" is the number of rows (m), its "length" is the number of columns (n). Then the size of the matrix A (capital Latin letters are usually used for their designation) will be denoted as A m×n . If m=n, then this matrix is ​​square, and m=n is its order. Accordingly, any element of the matrix A can be denoted by the number of its row and column: a xy ; x - row number, changes , y - column number, changes .

B is not the main point of the solution. In principle, all operations can be performed directly with the equations themselves, but the notation will turn out to be much more cumbersome, and it will be much easier to get confused in it.

Determinant

The matrix also has a determinant. This is a very important feature. Finding out its meaning now is not worth it, you can simply show how it is calculated, and then tell what properties of the matrix it determines. The easiest way to find the determinant is through diagonals. Imaginary diagonals are drawn in the matrix; the elements located on each of them are multiplied, and then the resulting products are added: diagonals with a slope to the right - with a "plus" sign, with a slope to the left - with a "minus" sign.

It is extremely important to note that the determinant can only be calculated for a square matrix. For a rectangular matrix, you can do the following: choose the smallest of the number of rows and the number of columns (let it be k), and then randomly mark k columns and k rows in the matrix. The elements located at the intersection of the selected columns and rows will form a new square matrix. If the determinant of such a matrix is ​​a number other than zero, then it is called the basis minor of the original rectangular matrix.

Before proceeding with the solution of the system of equations by the Gauss method, it does not hurt to calculate the determinant. If it turns out to be zero, then we can immediately say that the matrix has either an infinite number of solutions, or there are none at all. In such a sad case, you need to go further and find out about the rank of the matrix.

System classification

There is such a thing as the rank of a matrix. This is the maximum order of its non-zero determinant (remembering the basis minor, we can say that the rank of a matrix is ​​the order of the basis minor).

According to how things are with the rank, SLAE can be divided into:

  • Joint. At of joint systems, the rank of the main matrix (consisting only of coefficients) coincides with the rank of the extended one (with a column of free terms). Such systems have a solution, but not necessarily one, therefore, joint systems are additionally divided into:
  • - certain- having a unique solution. In certain systems, the rank of the matrix and the number of unknowns (or the number of columns, which is the same thing) are equal;
  • - indefinite - with an infinite number of solutions. The rank of matrices for such systems is less than the number of unknowns.
  • Incompatible. At such systems, the ranks of the main and extended matrices do not coincide. Incompatible systems have no solution.

The Gauss method is good in that it allows one to obtain either an unambiguous proof of the inconsistency of the system (without calculating the determinants of large matrices) or a general solution for a system with an infinite number of solutions.

Elementary transformations

Before proceeding directly to the solution of the system, it is possible to make it less cumbersome and more convenient for calculations. This is achieved through elementary transformations - such that their implementation does not change the final answer in any way. It should be noted that some of the above elementary transformations are valid only for matrices, the source of which was precisely the SLAE. Here is a list of these transformations:

  1. String permutation. It is obvious that if we change the order of the equations in the system record, then this will not affect the solution in any way. Consequently, it is also possible to interchange rows in the matrix of this system, not forgetting, of course, about the column of free members.
  2. Multiplying all elements of a string by some factor. Very useful! With it, you can reduce large numbers in the matrix or remove zeros. The set of solutions, as usual, will not change, and it will become more convenient to perform further operations. The main thing is that the coefficient is not equal to zero.
  3. Delete rows with proportional coefficients. This partly follows from the previous paragraph. If two or more rows in the matrix have proportional coefficients, then when multiplying / dividing one of the rows by the proportionality coefficient, two (or, again, more) absolutely identical rows are obtained, and you can remove the extra ones, leaving only one.
  4. Removing the null line. If in the course of transformations a string is obtained somewhere in which all elements, including the free member, are zero, then such a string can be called zero and thrown out of the matrix.
  5. Adding to the elements of one row the elements of another (in the corresponding columns), multiplied by a certain coefficient. The most obscure and most important transformation of all. It is worth dwelling on it in more detail.

Adding a string multiplied by a factor

For ease of understanding, it is worth disassembling this process step by step. Two rows are taken from the matrix:

a 11 a 12 ... a 1n | b1

a 21 a 22 ... a 2n | b 2

Suppose you need to add the first to the second, multiplied by the coefficient "-2".

a" 21 \u003d a 21 + -2 × a 11

a" 22 \u003d a 22 + -2 × a 12

a" 2n \u003d a 2n + -2 × a 1n

Then in the matrix the second row is replaced with a new one, and the first one remains unchanged.

a 11 a 12 ... a 1n | b1

a" 21 a" 22 ... a" 2n | b 2

It should be noted that the multiplication factor can be chosen in such a way that, as a result of the addition of two strings, one of the elements of the new string is equal to zero. Therefore, it is possible to obtain an equation in the system, where there will be one less unknown. And if you get two such equations, then the operation can be done again and get an equation that will already contain two less unknowns. And if each time we turn to zero one coefficient for all rows that are lower than the original one, then we can, like steps, go down to the very bottom of the matrix and get an equation with one unknown. This is called solving the system using the Gaussian method.

In general

Let there be a system. It has m equations and n unknown roots. You can write it down like this:

The main matrix is ​​compiled from the coefficients of the system. A column of free members is added to the extended matrix and separated by a bar for convenience.

  • the first row of the matrix is ​​multiplied by the coefficient k = (-a 21 / a 11);
  • the first modified row and the second row of the matrix are added;
  • instead of the second row, the result of the addition from the previous paragraph is inserted into the matrix;
  • now the first coefficient in the new second row is a 11 × (-a 21 /a 11) + a 21 = -a 21 + a 21 = 0.

Now the same series of transformations is performed, only the first and third rows are involved. Accordingly, in each step of the algorithm, the element a 21 is replaced by a 31 . Then everything is repeated for a 41 , ... a m1 . The result is a matrix where the first element in the rows is equal to zero. Now we need to forget about line number one and execute the same algorithm starting from the second line:

  • coefficient k \u003d (-a 32 / a 22);
  • the second modified line is added to the "current" line;
  • the result of the addition is substituted in the third, fourth, and so on lines, while the first and second remain unchanged;
  • in the rows of the matrix, the first two elements are already equal to zero.

The algorithm must be repeated until the coefficient k = (-a m,m-1 /a mm) appears. This means that the algorithm was last run only for the lower equation. Now the matrix looks like a triangle, or has a stepped shape. The bottom line contains the equality a mn × x n = b m . The coefficient and free term are known, and the root is expressed through them: x n = b m /a mn. The resulting root is substituted into the top row to find x n-1 = (b m-1 - a m-1,n ×(b m /a mn))÷a m-1,n-1 . And so on by analogy: in each next line there is a new root, and, having reached the "top" of the system, you can find many solutions. It will be the only one.

When there are no solutions

If in one of the matrix rows all elements, except for the free term, are equal to zero, then the equation corresponding to this row looks like 0 = b. It has no solution. And since such an equation is included in the system, then the set of solutions of the entire system is empty, that is, it is degenerate.

When there are an infinite number of solutions

It may turn out that in the reduced triangular matrix there are no rows with one element-the coefficient of the equation, and one - a free member. There are only strings that, when rewritten, would look like an equation with two or more variables. This means that the system has an infinite number of solutions. In this case, the answer can be given in the form of a general solution. How to do it?

All variables in the matrix are divided into basic and free. Basic - these are those that stand "on the edge" of the rows in the stepped matrix. The rest are free. In the general solution, the basic variables are written in terms of the free ones.

For convenience, the matrix is ​​first rewritten back into a system of equations. Then in the last of them, where exactly only one basic variable remained, it remains on one side, and everything else is transferred to the other. This is done for each equation with one basic variable. Then, in the rest of the equations, where possible, instead of the basic variable, the expression obtained for it is substituted. If the result is again an expression containing only one basic variable, it is expressed from there again, and so on, until each basic variable is written as an expression with free variables. This is the general solution of SLAE.

You can also find the basic solution of the system - give the free variables any values, and then for this particular case calculate the values ​​of the basic variables. There are infinitely many particular solutions.

Solution with specific examples

Here is the system of equations.

For convenience, it is better to immediately create its matrix

It is known that when solving by the Gauss method, the equation corresponding to the first row will remain unchanged at the end of the transformations. Therefore, it will be more profitable if the upper left element of the matrix is ​​​​the smallest - then the first elements of the remaining rows after the operations will turn to zero. This means that in the compiled matrix it will be advantageous to put the second in place of the first row.

second line: k = (-a 21 / a 11) = (-3/1) = -3

a" 21 \u003d a 21 + k × a 11 \u003d 3 + (-3) × 1 \u003d 0

a" 22 \u003d a 22 + k × a 12 \u003d -1 + (-3) × 2 \u003d -7

a" 23 = a 23 + k×a 13 = 1 + (-3)×4 = -11

b "2 \u003d b 2 + k × b 1 \u003d 12 + (-3) × 12 \u003d -24

third line: k = (-a 3 1 /a 11) = (-5/1) = -5

a" 3 1 = a 3 1 + k×a 11 = 5 + (-5)×1 = 0

a" 3 2 = a 3 2 + k×a 12 = 1 + (-5)×2 = -9

a" 3 3 = a 33 + k×a 13 = 2 + (-5)×4 = -18

b "3 \u003d b 3 + k × b 1 \u003d 3 + (-5) × 12 \u003d -57

Now, in order not to get confused, it is necessary to write down the matrix with the intermediate results of the transformations.

It is obvious that such a matrix can be made more convenient for perception with the help of some operations. For example, you can remove all "minuses" from the second line by multiplying each element by "-1".

It is also worth noting that in the third row all elements are multiples of three. Then you can reduce the string by this number, multiplying each element by "-1/3" (minus - at the same time to remove negative values).

Looks much nicer. Now we need to leave alone the first line and work with the second and third. The task is to add the second row to the third row, multiplied by such a factor that the element a 32 becomes equal to zero.

k = (-a 32 / a 22) = (-3/7) = -3/7 fractions, and only then, when the answers are received, decide whether to round up and translate into another form of notation)

a" 32 = a 32 + k × a 22 = 3 + (-3/7) × 7 = 3 + (-3) = 0

a" 33 \u003d a 33 + k × a 23 \u003d 6 + (-3/7) × 11 \u003d -9/7

b "3 \u003d b 3 + k × b 2 \u003d 19 + (-3/7) × 24 \u003d -61/7

The matrix is ​​written again with new values.

1 2 4 12
0 7 11 24
0 0 -9/7 -61/7

As you can see, the resulting matrix already has a stepped form. Therefore, further transformations of the system by the Gauss method are not required. What can be done here is to remove the overall coefficient "-1/7" from the third line.

Now everything is beautiful. The point is small - write the matrix again in the form of a system of equations and calculate the roots

x + 2y + 4z = 12(1)

7y + 11z = 24 (2)

The algorithm by which the roots will now be found is called the reverse move in the Gauss method. Equation (3) contains the value of z:

y = (24 - 11×(61/9))/7 = -65/9

And the first equation allows you to find x:

x = (12 - 4z - 2y)/1 = 12 - 4x(61/9) - 2x(-65/9) = -6/9 = -2/3

We have the right to call such a system joint, and even definite, that is, having a unique solution. The response is written in the following form:

x 1 \u003d -2/3, y \u003d -65/9, z \u003d 61/9.

An example of an indefinite system

The variant of solving a certain system by the Gauss method has been analyzed, now it is necessary to consider the case if the system is indefinite, that is, infinitely many solutions can be found for it.

x 1 + x 2 + x 3 + x 4 + x 5 = 7 (1)

3x 1 + 2x 2 + x 3 + x 4 - 3x 5 = -2 (2)

x 2 + 2x 3 + 2x 4 + 6x 5 = 23 (3)

5x 1 + 4x 2 + 3x 3 + 3x 4 - x 5 = 12 (4)

The very form of the system is already alarming, because the number of unknowns is n = 5, and the rank of the matrix of the system is already exactly less than this number, because the number of rows is m = 4, that is, the largest order of the square determinant is 4. This means that there are an infinite number of solutions, and it is necessary to look for its general form. The Gauss method for linear equations makes it possible to do this.

First, as usual, the augmented matrix is ​​compiled.

Second line: coefficient k = (-a 21 / a 11) = -3. In the third line, the first element is before the transformations, so you don't need to touch anything, you need to leave it as it is. Fourth line: k = (-a 4 1 /a 11) = -5

Multiplying the elements of the first row by each of their coefficients in turn and adding them to the desired rows, we obtain a matrix of the following form:

As you can see, the second, third and fourth rows consist of elements that are proportional to each other. The second and fourth are generally the same, so one of them can be removed immediately, and the rest multiplied by the coefficient "-1" and get line number 3. And again, leave one of two identical lines.

It turned out such a matrix. The system has not yet been written down, it is necessary here to determine the basic variables - standing at the coefficients a 11 \u003d 1 and a 22 \u003d 1, and free - all the rest.

The second equation has only one basic variable - x 2 . Hence, it can be expressed from there, writing through the variables x 3 , x 4 , x 5 , which are free.

We substitute the resulting expression into the first equation.

It turned out an equation in which the only basic variable is x 1. Let's do the same with it as with x 2 .

All basic variables, of which there are two, are expressed in terms of three free ones, now you can write the answer in a general form.

You can also specify one of the particular solutions of the system. For such cases, as a rule, zeros are chosen as values ​​for free variables. Then the answer will be:

16, 23, 0, 0, 0.

An example of an incompatible system

The solution of inconsistent systems of equations by the Gauss method is the fastest. It ends as soon as at one of the stages an equation is obtained that has no solution. That is, the stage with the calculation of the roots, which is quite long and dreary, disappears. The following system is considered:

x + y - z = 0 (1)

2x - y - z = -2 (2)

4x + y - 3z = 5 (3)

As usual, the matrix is ​​​​compiled:

1 1 -1 0
2 -1 -1 -2
4 1 -3 5

And it is reduced to a stepped form:

k 1 \u003d -2k 2 \u003d -4

1 1 -1 0
0 -3 1 -2
0 0 0 7

After the first transformation, the third line contains an equation of the form

having no solution. Therefore, the system is inconsistent, and the answer is the empty set.

Advantages and disadvantages of the method

If you choose which method to solve SLAE on paper with a pen, then the method that was considered in this article looks the most attractive. In elementary transformations, it is much more difficult to get confused than it happens if you have to manually look for a determinant or some tricky inverse matrix. However, if you use programs for working with data of this type, for example, spreadsheets, then it turns out that such programs already contain algorithms for calculating the main parameters of matrices - determinant, minors, inverse, and so on. And if you are sure that the machine will calculate these values ​​itself and will not make a mistake, it is more expedient to use the matrix method or Cramer's formulas, because their application begins and ends with the calculation of determinants and inverse matrices.

Application

Since the Gaussian solution is an algorithm, and the matrix is, in fact, a two-dimensional array, it can be used in programming. But since the article positions itself as a guide "for dummies", it should be said that the easiest place to shove the method into is spreadsheets, for example, Excel. Again, any SLAE entered in a table in the form of a matrix will be considered by Excel as a two-dimensional array. And for operations with them, there are many nice commands: addition (you can only add matrices of the same size!), Multiplication by a number, matrix multiplication (also with certain restrictions), finding the inverse and transposed matrices and, most importantly, calculating the determinant. If this time-consuming task is replaced by a single command, it is much faster to determine the rank of a matrix and, therefore, to establish its compatibility or inconsistency.

Ever since the beginning of the 16th-18th centuries, mathematicians began to intensively study the functions, thanks to which so much has changed in our lives. Computer technology without this knowledge simply would not exist. To solve complex problems, linear equations and functions, various concepts, theorems and solution techniques have been created. One of such universal and rational methods and techniques for solving linear equations and their systems was the Gauss method. Matrices, their rank, determinant - everything can be calculated without using complex operations.

What is SLAU

In mathematics, there is the concept of SLAE - a system of linear algebraic equations. What does she represent? This is a set of m equations with the required n unknowns, usually denoted as x, y, z, or x 1 , x 2 ... x n, or other symbols. To solve this system by the Gaussian method means to find all unknown unknowns. If a system has the same number of unknowns and equations, then it is called an n-th order system.

The most popular methods for solving SLAE

In educational institutions of secondary education, various methods of solving such systems are being studied. Most often, these are simple equations consisting of two unknowns, so any existing method for finding the answer to them will not take much time. It can be like a substitution method, when another equation is derived from one equation and substituted into the original one. Or term by term subtraction and addition. But the Gauss method is considered the easiest and most universal. It makes it possible to solve equations with any number of unknowns. Why is this technique considered rational? Everything is simple. The matrix method is good because it does not require several times to rewrite unnecessary characters in the form of unknowns, it is enough to do arithmetic operations on the coefficients - and you will get a reliable result.

Where are SLAEs used in practice?

The solution of SLAE are the points of intersection of lines on the graphs of functions. In our high-tech computer age, people who are closely involved in the development of games and other programs need to know how to solve such systems, what they represent and how to check the correctness of the resulting result. Most often, programmers develop special linear algebra calculators, this includes a system of linear equations. The Gauss method allows you to calculate all existing solutions. Other simplified formulas and techniques are also used.

SLAE compatibility criterion

Such a system can only be solved if it is compatible. For clarity, we present the SLAE in the form Ax=b. It has a solution if rang(A) equals rang(A,b). In this case, (A,b) is an extended form matrix that can be obtained from matrix A by rewriting it with free terms. It turns out that solving linear equations using the Gaussian method is quite easy.

Perhaps some notation is not entirely clear, so it is necessary to consider everything with an example. Let's say there is a system: x+y=1; 2x-3y=6. It consists of only two equations in which there are 2 unknowns. The system will have a solution only if the rank of its matrix is ​​equal to the rank of the augmented matrix. What is a rank? This is the number of independent lines of the system. In our case, the rank of the matrix is ​​2. Matrix A will consist of the coefficients located near the unknowns, and the coefficients behind the “=” sign will also fit into the expanded matrix.

Why SLAE can be represented in matrix form

Based on the compatibility criterion according to the proven Kronecker-Capelli theorem, the system of linear algebraic equations can be represented in matrix form. Using the Gaussian cascade method, you can solve the matrix and get the only reliable answer for the entire system. If the rank of an ordinary matrix is ​​equal to the rank of its extended matrix, but less than the number of unknowns, then the system has an infinite number of answers.

Matrix transformations

Before moving on to solving matrices, it is necessary to know what actions can be performed on their elements. There are several elementary transformations:

  • By rewriting the system into a matrix form and carrying out its solution, it is possible to multiply all the elements of the series by the same coefficient.
  • In order to convert a matrix to canonical form, two parallel rows can be swapped. The canonical form implies that all elements of the matrix that are located along the main diagonal become ones, and the remaining ones become zeros.
  • The corresponding elements of the parallel rows of the matrix can be added one to the other.

Jordan-Gauss method

The essence of solving systems of linear homogeneous and inhomogeneous equations by the Gauss method is to gradually eliminate the unknowns. Let's say we have a system of two equations in which there are two unknowns. To find them, you need to check the system for compatibility. The Gaussian equation is solved very simply. It is necessary to write out the coefficients located near each unknown in a matrix form. To solve the system, you need to write out the augmented matrix. If one of the equations contains a smaller number of unknowns, then "0" must be put in place of the missing element. All known transformation methods are applied to the matrix: multiplication, division by a number, adding the corresponding elements of the rows to each other, and others. It turns out that in each row it is necessary to leave one variable with the value "1", the rest should be reduced to zero. For a more accurate understanding, it is necessary to consider the Gauss method with examples.

A simple example of solving a 2x2 system

To begin with, let's take a simple system of algebraic equations, in which there will be 2 unknowns.

Let's rewrite it in an augmented matrix.

To solve this system of linear equations, only two operations are required. We need to bring the matrix to the canonical form so that there are units along the main diagonal. So, translating from the matrix form back into the system, we get the equations: 1x+0y=b1 and 0x+1y=b2, where b1 and b2 are the answers obtained in the process of solving.

  1. The first step in solving the augmented matrix will be as follows: the first row must be multiplied by -7 and the corresponding elements added to the second row, respectively, in order to get rid of one unknown in the second equation.
  2. Since the solution of equations by the Gauss method implies bringing the matrix to the canonical form, then it is necessary to do the same operations with the first equation and remove the second variable. To do this, we subtract the second line from the first and get the necessary answer - the solution of the SLAE. Or, as shown in the figure, we multiply the second row by a factor of -1 and add the elements of the second row to the first row. This is the same.

As you can see, our system is solved by the Jordan-Gauss method. We rewrite it in the required form: x=-5, y=7.

An example of solving SLAE 3x3

Suppose we have a more complex system of linear equations. The Gauss method makes it possible to calculate the answer even for the most seemingly confusing system. Therefore, in order to delve deeper into the calculation methodology, we can move on to a more complex example with three unknowns.

As in the previous example, we rewrite the system in the form of an expanded matrix and begin to bring it to the canonical form.

To solve this system, you will need to perform much more actions than in the previous example.

  1. First you need to make in the first column one single element and the rest zeros. To do this, multiply the first equation by -1 and add the second equation to it. It is important to remember that we rewrite the first line in its original form, and the second - already in a modified form.
  2. Next, we remove the same first unknown from the third equation. To do this, we multiply the elements of the first row by -2 and add them to the third row. Now the first and second lines are rewritten in their original form, and the third - already with changes. As you can see from the result, we got the first one at the beginning of the main diagonal of the matrix and the rest are zeros. A few more actions, and the system of equations by the Gauss method will be reliably solved.
  3. Now you need to do operations on other elements of the rows. The third and fourth steps can be combined into one. We need to divide the second and third lines by -1 to get rid of the negative ones on the diagonal. We have already brought the third line to the required form.
  4. Next, we canonicalize the second line. To do this, we multiply the elements of the third row by -3 and add them to the second line of the matrix. It can be seen from the result that the second line is also reduced to the form we need. It remains to do a few more operations and remove the coefficients of the unknowns from the first row.
  5. In order to make 0 from the second element of the row, you need to multiply the third row by -3 and add it to the first row.
  6. The next decisive step is to add the necessary elements of the second row to the first row. So we get the canonical form of the matrix, and, accordingly, the answer.

As you can see, the solution of equations by the Gauss method is quite simple.

An example of solving a 4x4 system of equations

Some more complex systems of equations can be solved by the Gaussian method using computer programs. It is necessary to drive coefficients for unknowns into existing empty cells, and the program will calculate the required result step by step, describing each action in detail.

The step-by-step instructions for solving such an example are described below.

In the first step, free coefficients and numbers for unknowns are entered into empty cells. Thus, we get the same augmented matrix that we write by hand.

And all the necessary arithmetic operations are performed to bring the extended matrix to the canonical form. It must be understood that the answer to a system of equations is not always integers. Sometimes the solution can be from fractional numbers.

Checking the correctness of the solution

The Jordan-Gauss method provides for checking the correctness of the result. In order to find out whether the coefficients are calculated correctly, you just need to substitute the result into the original system of equations. The left side of the equation must match the right side, which is behind the equals sign. If the answers do not match, then you need to recalculate the system or try to apply another method of solving SLAE known to you, such as substitution or term-by-term subtraction and addition. After all, mathematics is a science that has a huge number of different methods of solving. But remember: the result should always be the same, no matter what solution method you used.

Gauss method: the most common errors in solving SLAE

During the solution of linear systems of equations, errors most often occur, such as incorrect transfer of coefficients to a matrix form. There are systems in which some unknowns are missing in one of the equations, then, transferring the data to the expanded matrix, they can be lost. As a result, when solving this system, the result may not correspond to the real one.

Another of the main mistakes can be incorrect writing out the final result. It must be clearly understood that the first coefficient will correspond to the first unknown from the system, the second - to the second, and so on.

The Gauss method describes in detail the solution of linear equations. Thanks to him, it is easy to perform the necessary operations and find the right result. In addition, this is a universal tool for finding a reliable answer to equations of any complexity. Maybe that is why it is so often used in solving SLAE.

Let a system of linear algebraic equations be given, which must be solved (find such values ​​of the unknowns хi that turn each equation of the system into an equality).

We know that a system of linear algebraic equations can:

1) Have no solutions (be incompatible).
2) Have infinitely many solutions.
3) Have a unique solution.

As we remember, Cramer's rule and the matrix method are unsuitable in cases where the system has infinitely many solutions or is inconsistent. Gauss methodthe most powerful and versatile tool for finding solutions to any system of linear equations, which the in every case lead us to the answer! The algorithm of the method in all three cases works the same way. If the Cramer and matrix methods require knowledge of determinants, then the application of the Gauss method requires knowledge of only arithmetic operations, which makes it accessible even to primary school students.

Extended matrix transformations ( this is the matrix of the system - a matrix composed only of the coefficients of the unknowns, plus a column of free terms) systems of linear algebraic equations in the Gauss method:

1) from troky matrices can rearrange places.

2) if there are (or are) proportional (as a special case - identical) rows in the matrix, then it follows delete from the matrix, all these rows except one.

3) if a zero row appeared in the matrix during the transformations, then it also follows delete.

4) the row of the matrix can multiply (divide) to any number other than zero.

5) to the row of the matrix, you can add another string multiplied by a number, different from zero.

In the Gauss method, elementary transformations do not change the solution of the system of equations.

The Gauss method consists of two stages:

  1. "Direct move" - ​​using elementary transformations, bring the extended matrix of the system of linear algebraic equations to a "triangular" stepped form: the elements of the extended matrix located below the main diagonal are equal to zero (top-down move). For example, to this kind:

To do this, perform the following steps:

1) Let us consider the first equation of a system of linear algebraic equations and the coefficient at x 1 is equal to K. The second, third, etc. we transform the equations as follows: we divide each equation (coefficients for unknowns, including free terms) by the coefficient for unknown x 1, which is in each equation, and multiply by K. After that, subtract the first from the second equation (coefficients for unknowns and free terms). We get at x 1 in the second equation the coefficient 0. From the third transformed equation we subtract the first equation, so until all equations, except the first, with unknown x 1 will not have a coefficient 0.

2) Move on to the next equation. Let this be the second equation and the coefficient at x 2 is equal to M. With all the "subordinate" equations, we proceed as described above. Thus, "under" the unknown x 2 in all equations will be zeros.

3) We pass to the next equation and so on until one last unknown and transformed free term remains.

  1. The "reverse move" of the Gauss method is to obtain a solution to a system of linear algebraic equations (the "bottom-up" move). From the last "lower" equation we get one first solution - the unknown x n. To do this, we solve the elementary equation A * x n \u003d B. In the example above, x 3 \u003d 4. We substitute the found value in the “upper” next equation and solve it with respect to the next unknown. For example, x 2 - 4 \u003d 1, i.e. x 2 \u003d 5. And so on until we find all the unknowns.

Example.

We solve the system of linear equations using the Gauss method, as some authors advise:

We write the extended matrix of the system and, using elementary transformations, bring it to a step form:

We look at the upper left "step". There we should have a unit. The problem is that there are no ones in the first column at all, so nothing can be solved by rearranging the rows. In such cases, the unit must be organized using an elementary transformation. This can usually be done in several ways. Let's do it like this:
1 step . To the first line we add the second line, multiplied by -1. That is, we mentally multiplied the second line by -1 and performed the addition of the first and second lines, while the second line did not change.

Now at the top left "minus one", which suits us perfectly. Whoever wants to get +1 can perform an additional action: multiply the first line by -1 (change its sign).

2 step . The first line multiplied by 5 was added to the second line. The first line multiplied by 3 was added to the third line.

3 step . The first line was multiplied by -1, in principle, this is for beauty. The sign of the third line was also changed and moved to the second place, thus, on the second “step, we had the desired unit.

4 step . To the third line, add the second line, multiplied by 2.

5 step . The third line is divided by 3.

A sign that indicates an error in calculations (less often a typo) is a “bad” bottom line. That is, if we got something like (0 0 11 | 23) below, and, accordingly, 11x 3 = 23, x 3 = 23/11, then with a high degree of probability we can say that a mistake was made during elementary transformations.

We perform a reverse move, in the design of examples, the system itself is often not rewritten, and the equations are “taken directly from the given matrix”. The reverse move, I remind you, works "from the bottom up." In this example, the gift turned out:

x 3 = 1
x 2 = 3
x 1 + x 2 - x 3 \u003d 1, therefore x 1 + 3 - 1 \u003d 1, x 1 \u003d -1

Answer:x 1 \u003d -1, x 2 \u003d 3, x 3 \u003d 1.

Let's solve the same system using the proposed algorithm. We get

4 2 –1 1
5 3 –2 2
3 2 –3 0

Divide the second equation by 5 and the third by 3. We get:

4 2 –1 1
1 0.6 –0.4 0.4
1 0.66 –1 0

Multiply the second and third equations by 4, we get:

4 2 –1 1
4 2,4 –1.6 1.6
4 2.64 –4 0

Subtract the first equation from the second and third equations, we have:

4 2 –1 1
0 0.4 –0.6 0.6
0 0.64 –3 –1

Divide the third equation by 0.64:

4 2 –1 1
0 0.4 –0.6 0.6
0 1 –4.6875 –1.5625

Multiply the third equation by 0.4

4 2 –1 1
0 0.4 –0.6 0.6
0 0.4 –1.875 –0.625

Subtract the second equation from the third equation, we get the “stepped” augmented matrix:

4 2 –1 1
0 0.4 –0.6 0.6
0 0 –1.275 –1.225

Thus, since an error accumulated in the process of calculations, we get x 3 \u003d 0.96, or approximately 1.

x 2 \u003d 3 and x 1 \u003d -1.

Solving in this way, you will never get confused in the calculations and, despite the calculation errors, you will get the result.

This method of solving a system of linear algebraic equations is easily programmable and does not take into account the specific features of the coefficients for unknowns, because in practice (in economic and technical calculations) one has to deal with non-integer coefficients.

Wish you success! See you in class! Tutor Dmitry Aistrakhanov.

site, with full or partial copying of the material, a link to the source is required.

Two systems of linear equations are said to be equivalent if the set of all their solutions is the same.

Elementary transformations of the system of equations are:

  1. Deletion from the system of trivial equations, i.e. those for which all coefficients are equal to zero;
  2. Multiplying any equation by a non-zero number;
  3. Addition to any i -th equation of any j -th equation, multiplied by any number.

The variable x i is called free if this variable is not allowed, and the whole system of equations is allowed.

Theorem. Elementary transformations transform the system of equations into an equivalent one.

The meaning of the Gauss method is to transform the original system of equations and obtain an equivalent allowed or equivalent inconsistent system.

So, the Gauss method consists of the following steps:

  1. Consider the first equation. We choose the first non-zero coefficient and divide the whole equation by it. We obtain an equation in which some variable x i enters with a coefficient of 1;
  2. Let us subtract this equation from all the others, multiplying it by numbers such that the coefficients for the variable x i in the remaining equations are set to zero. We get a system that is resolved with respect to the variable x i and is equivalent to the original one;
  3. If trivial equations arise (rarely, but it happens; for example, 0 = 0), we delete them from the system. As a result, the equations become one less;
  4. We repeat the previous steps no more than n times, where n is the number of equations in the system. Each time we select a new variable for “processing”. If conflicting equations arise (for example, 0 = 8), the system is inconsistent.

As a result, after a few steps we obtain either an allowed system (possibly with free variables) or an inconsistent one. Allowed systems fall into two cases:

  1. The number of variables is equal to the number of equations. So the system is defined;
  2. The number of variables is greater than the number of equations. We collect all free variables on the right - we get formulas for allowed variables. These formulas are written in the answer.

That's all! The system of linear equations is solved! This is a fairly simple algorithm, and to master it, you do not need to contact a tutor in mathematics. Consider an example:

A task. Solve the system of equations:

Description of steps:

  1. We subtract the first equation from the second and third - we get the allowed variable x 1;
  2. We multiply the second equation by (−1), and divide the third equation by (−3) - we get two equations in which the variable x 2 enters with a coefficient of 1;
  3. We add the second equation to the first, and subtract from the third. Let's get the allowed variable x 2 ;
  4. Finally, we subtract the third equation from the first - we get the allowed variable x 3 ;
  5. We have received an authorized system, we write down the answer.

The general solution of a joint system of linear equations is a new system, equivalent to the original one, in which all allowed variables are expressed in terms of free ones.

When might a general solution be needed? If you have to take fewer steps than k (k is how many equations in total). However, the reasons why the process ends at some step l< k , может быть две:

  1. After the l -th step, we get a system that does not contain an equation with the number (l + 1). In fact, this is good, because. the resolved system is received anyway - even a few steps earlier.
  2. After the l -th step, an equation is obtained in which all coefficients of the variables are equal to zero, and the free coefficient is different from zero. This is an inconsistent equation, and, therefore, the system is inconsistent.

It is important to understand that the appearance of an inconsistent equation by the Gauss method is a sufficient reason for inconsistency. At the same time, we note that as a result of the l -th step, trivial equations cannot remain - all of them are deleted directly in the process.

Description of steps:

  1. Subtract the first equation times 4 from the second. And also add the first equation to the third - we get the allowed variable x 1;
  2. We subtract the third equation, multiplied by 2, from the second - we get the contradictory equation 0 = −5.

So, the system is inconsistent, since an inconsistent equation has been found.

A task. Investigate compatibility and find the general solution of the system:


Description of steps:

  1. We subtract the first equation from the second (after multiplying by two) and the third - we get the allowed variable x 1;
  2. Subtract the second equation from the third. Since all the coefficients in these equations are the same, the third equation becomes trivial. At the same time, we multiply the second equation by (−1);
  3. We subtract the second equation from the first equation - we get the allowed variable x 2. The entire system of equations is now also resolved;
  4. Since the variables x 3 and x 4 are free, we move them to the right to express the allowed variables. This is the answer.

So, the system is joint and indefinite, since there are two allowed variables (x 1 and x 2) and two free ones (x 3 and x 4).

One of the simplest ways to solve a system of linear equations is a method based on calculating the determinants ( Cramer's rule). Its advantage is that it allows you to immediately record the solution, it is especially convenient in cases where the system coefficients are not numbers, but some parameters. Its disadvantage is the cumbersomeness of calculations in the case of a large number of equations, moreover, Cramer's rule is not directly applicable to systems in which the number of equations does not coincide with the number of unknowns. In such cases, it is usually used Gauss method.

Systems of linear equations that have the same set of solutions are called equivalent. Obviously, the set of solutions of a linear system will not change if any equations are interchanged, or if one of the equations is multiplied by some non-zero number, or if one equation is added to another.

Gauss method (method of successive elimination of unknowns) lies in the fact that, with the help of elementary transformations, the system is reduced to an equivalent stepwise system. First, with the help of the 1st equation, x 1 of all subsequent equations of the system. Then, using the 2nd equation, we eliminate x 2 of the 3rd and all subsequent equations. This process, called direct Gauss method, continues until only one unknown remains on the left side of the last equation x n. After that, it is made Gaussian reverse– solving the last equation, we find x n; after that, using this value, from the penultimate equation we calculate x n-1 etc. Last we find x 1 from the first equation.

It is convenient to carry out Gaussian transformations by performing transformations not with the equations themselves, but with the matrices of their coefficients. Consider the matrix:

called extended matrix system, because in addition to the main matrix of the system, it includes a column of free members. The Gauss method is based on bringing the main matrix of the system to a triangular form (or trapezoidal form in the case of non-square systems) using elementary row transformations (!) of the extended matrix of the system.

Example 5.1. Solve the system using the Gauss method:

Solution. Let's write out the augmented matrix of the system and, using the first row, after that we will set the rest of the elements to zero:

we get zeros in the 2nd, 3rd and 4th rows of the first column:


Now we need all the elements in the second column below the 2nd row to be equal to zero. To do this, you can multiply the second line by -4/7 and add to the 3rd line. However, in order not to deal with fractions, we will create a unit in the 2nd row of the second column and only

Now, to get a triangular matrix, you need to zero out the element of the fourth row of the 3rd column, for this you can multiply the third row by 8/54 and add it to the fourth. However, in order not to deal with fractions, we will swap the 3rd and 4th rows and the 3rd and 4th columns, and only after that we will reset the specified element. Note that when the columns are rearranged, the corresponding variables are swapped, and this must be remembered; other elementary transformations with columns (addition and multiplication by a number) cannot be performed!


The last simplified matrix corresponds to a system of equations equivalent to the original one:

From here, using the reverse course of the Gauss method, we find from the fourth equation x 3 = -1; from the third x 4 = -2, from the second x 2 = 2 and from the first equation x 1 = 1. In matrix form, the answer is written as

We have considered the case when the system is definite, i.e. when there is only one solution. Let's see what happens if the system is inconsistent or indeterminate.

Example 5.2. Explore the system using the Gaussian method:

Solution. We write out and transform the augmented matrix of the system

We write a simplified system of equations:

Here, in the last equation, it turned out that 0=4, i.e. contradiction. Therefore, the system has no solution, i.e. she incompatible. à

Example 5.3. Explore and solve the system using the Gaussian method:

Solution. We write out and transform the extended matrix of the system:

As a result of the transformations, only zeros were obtained in the last line. This means that the number of equations has decreased by one:

Thus, after simplifications, two equations remain, and four unknowns, i.e. two unknown "extra". Let "superfluous", or, as they say, free variables, will x 3 and x 4 . Then

Assuming x 3 = 2a And x 4 = b, we get x 2 = 1–a And x 1 = 2ba; or in matrix form

A solution written in this way is called general, since, by giving the parameters a And b different values, it is possible to describe all possible solutions of the system. a