Biographies Characteristics Analysis

Gauss method for solving an indefinite system of linear equations. Gauss Method for Dummies: Solution Examples

Let a system of linear algebraic equations, which needs to be solved (find such values ​​of the unknown х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 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 a solution to any system linear equations , which in every case lead us to the answer! The method algorithm itself in all three cases works the same way. If the Cramer and matrix methods require knowledge of determinants, then to apply the Gauss method, knowledge is required only arithmetic operations which makes it accessible even to elementary 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) With troky matrices Can rearrange places.

2) if the matrix has (or has) proportional (as special case are the same) strings, 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 a system of linear algebraic equations to a "triangular" one stepped view: elements of the expanded 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. « Reverse» the Gauss method - obtaining a solution to a system of linear algebraic equations (going "bottom-up"). From the last "lower" equation we get one first solution - the unknown x n. For this we decide 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 for 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 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 received a gift:

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 easy to program and does not take into account specific features coefficients for unknowns, because in practice (in economic and technical calculations) one has to deal with non-integer coefficients.

I wish you success! See you in class! Tutor.

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

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 general view, 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 description of the solution by the Gauss method in the most in 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

None hidden meaning not 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 comes down to building a matrix triangular, 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 (capitals are usually used to denote them) letters) 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 very important characteristic. 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 rectangular matrix you can do the following: from the number of rows and the number of columns, choose the smallest (let it be k), and then randomly mark k columns and k rows in the matrix. Elements located at the intersection of the selected columns and rows will make up 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 about basic minor, we can say that the rank of the 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, so in addition joint systems 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 during the solution.

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 helpful! It can be used to shorten big 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 new second line 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: each next line contains new root, and, having reached the "top" of the system, one can find many solutions . It will be the only one.

When there are no solutions

If in one of matrix rows all elements, except for the free term, are equal to zero, then the equation corresponding to this line 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 given triangular matrix there are no rows with one element-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 ones are those that stand "on the edge" of the lines in 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, as a result, an expression again appears containing only one basic variable, it is again expressed from there, and so on, until each basic variable is written as an expression with free variables. That's what it is common decision SLAU.

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 intermediate results 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 shorten 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 common fraction, and only then, when the answers are received, decide whether to round up and translate into another form of record)

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 from the third line overall ratio "-1/7".

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

Solution certain system has been analyzed by the Gaussian method, 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 appearance 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 greatest order square determinant - 4. Hence, solutions exist infinite set, 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 get the matrix the following kind:

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 the determinant or some tricky inverse matrix. However, if you use programs to work with data of this type, for example, spreadsheets, it turns out that such programs already contain algorithms for calculating the main parameters of matrices - the 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 put the method in 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 would simply not exist. For solutions challenging tasks, linear equations and functions have been created various concepts, theorems and methods of solution. 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. Solve by Gauss method this system- means to find all the required unknowns. If the system has the same number unknowns and equations, then it is called an n-th order system.

The most popular methods for solving SLAE

IN educational institutions secondary education are studying various techniques for solving such systems. Most often this simple equations, consisting of two unknowns, so any existing method it won't take long to find answers to them. 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. Matrix method the good thing is that here it is not required to rewrite unnecessary characters several times 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:

  • Rewriting the system to matrix view and realizing 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 Gaussian 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 lead to zero mind. 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. It 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, you can move on to 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 equations can be solved by the Gaussian method by means of 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.

Described below step-by-step instruction solutions to this example.

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. Left-hand 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 great amount various techniques solutions. 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 universal remedy to search for a reliable answer to equations of any complexity. Maybe that is why it is so often used in solving SLAE.

1. System of linear algebraic equations

1.1 The concept of a system of linear algebraic equations

A system of equations is a condition consisting in the simultaneous execution of several equations in several variables. A system of linear algebraic equations (hereinafter referred to as SLAE) containing m equations and n unknowns is a system of the form:

where the numbers a ij are called the coefficients of the system, the numbers b i are free members, aij And b i(i=1,…, m; b=1,…, n) are some known numbers, and x 1 ,…, x n- unknown. In the notation of the coefficients aij the first index i denotes the number of the equation, and the second index j is the number of the unknown at which this coefficient stands. Subject to finding the number x n . It is convenient to write such a system in a compact matrix form: AX=B. Here A is the matrix of coefficients of the system, called the main matrix;

is a column vector of unknown xj.
is a column vector of free members bi.

The product of matrices A * X is defined, since there are as many columns in matrix A as there are rows in matrix X (n pieces).

The extended matrix of the system is the matrix A of the system, supplemented by a column of free terms

1.2 Solution of a system of linear algebraic equations

The solution of a system of equations is an ordered set of numbers (values ​​of variables), when substituting them instead of variables, each of the equations of the system turns into a true equality.

The solution of the system is n values ​​of the unknowns x1=c1, x2=c2,…, xn=cn, substituting which all equations of the system turn into true equalities. Any solution of the system can be written as a matrix-column

A system of equations is called consistent if it has at least one solution, and inconsistent if it has no solutions.

A joint system is called definite if it has a unique solution, and indefinite if it has more than one solution. IN last case each of its solutions is called a particular solution of the system. The set of all particular solutions is called the general solution.

To solve a system means to find out whether it is consistent or inconsistent. If the system is compatible, find its general solution.

Two systems are called equivalent (equivalent) if they have the same general solution. In other words, systems are equivalent if every solution to one of them is a solution to the other, and vice versa.

A transformation, the application of which turns the system into new system, equivalent to the original one, is called an equivalent or equivalent transformation. Examples equivalent transformations the following transformations can serve: interchanging two equations of the system, interchanging two unknowns together with the coefficients of all equations, multiplying both parts of any equation of the system by a non-zero number.

A system of linear equations is called homogeneous if all free terms are equal to zero:

A homogeneous system is always consistent, since x1=x2=x3=…=xn=0 is a solution to the system. This solution is called null or trivial.

2. Gaussian elimination method

2.1 The essence of the Gaussian elimination method

The classical method for solving systems of linear algebraic equations is the method sequential exclusion unknown - Gauss method(It is also called the Gaussian elimination method). This is a method of successive elimination of variables, when, with the help of elementary transformations, the system of equations is reduced to equivalent system stepwise (or triangular) form, from which all other variables are found sequentially, starting with the last (by number) variables.

The Gaussian solution process consists of two stages: forward and backward moves.

1. Direct move.

At the first stage, the so-called direct move is carried out, when, by means of elementary transformations over rows, the system is brought to a stepped or triangular form, or it is established that the system is inconsistent. Namely, among the elements of the first column of the matrix, a nonzero one is chosen, it is moved to the uppermost position by permuting the rows, and the first row obtained after the permutation is subtracted from the remaining rows, multiplying it by a value equal to the ratio of the first element of each of these rows to the first element of the first row, zeroing thus the column below it.

After the indicated transformations have been made, the first row and the first column are mentally crossed out and continue until a zero-size matrix remains. If at some of the iterations among the elements of the first column there was not found a non-zero one, then go to the next column and perform a similar operation.

At the first stage (forward run), the system is reduced to a stepped (in particular, triangular) form.

The system below is stepwise:

,

The coefficients aii are called the main (leading) elements of the system.

(if a11=0, rearrange the rows of the matrix so that a 11 was not equal to 0. This is always possible, because otherwise the matrix contains a zero column, its determinant is equal to zero and the system is inconsistent).

We transform the system by eliminating the unknown x1 in all equations except the first one (using elementary transformations of the system). To do this, multiply both sides of the first equation by

and add term by term with the second equation of the system (or from the second equation we subtract term by term the first multiplied by ). Then we multiply both parts of the first equation by and add it to the third equation of the system (or subtract the first one multiplied by the third term by term). Thus, we successively multiply the first row by a number and add to i-th line, for i= 2, 3, …,n.

Continuing this process, we get the equivalent system:


– new values ​​of the coefficients for unknowns and free terms in the last m-1 equations of the system, which are determined by the formulas:

Thus, at the first step, all coefficients under the first leading element a 11 are destroyed

0, the second step destroys the elements under the second leading element a 22 (1) (if a 22 (1) 0), and so on. Continuing this process further, we will finally reduce the original system to a triangular system at the (m-1) step.

If, in the process of reducing the system to a stepwise form, zero equations appear, i.e. equalities of the form 0=0, they are discarded. If there is an equation of the form

This indicates the incompatibility of the system.

This completes the direct course of the Gauss method.

2. Reverse move.

At the second stage, the so-called reverse move is carried out, the essence of which is to express all the resulting basic variables in terms of non-basic ones and construct fundamental system solutions, or, if all variables are basic, then express in numerical form the only solution of the system of linear equations.

This procedure begins with the last equation, from which the corresponding basic variable is expressed (it is only one in it) and substituted into the previous equations, and so on, going up the "steps" to the top.

Each line corresponds to exactly one basic variable, so at each step, except for the last (topmost), the situation exactly repeats the case of the last line.

Note: in practice, it is more convenient to work not with the system, but with its extended matrix, performing all elementary transformations on its rows. It is convenient that the coefficient a11 be equal to 1 (rearrange the equations, or divide both sides of the equation by a11).

2.2 Examples of solving SLAE by the Gauss method

IN this section three various examples Let us show how the SLAE can be solved by the Gauss method.

Example 1. Solve SLAE of the 3rd order.

Set the coefficients to zero at

in the second and third lines. To do this, multiply them by 2/3 and 1, respectively, and add them to the first line:

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 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) With 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.

I 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.