In this article, the method is considered as a way to solve systems linear equations(SLAU). 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 an infinite number of solutions. Or they don't have it at all.
What does it mean to solve using the Gaussian method?
First, we need to write our system of equations in It looks like this. Take the system:
The coefficients are written in the form of a table, and the free terms are written in a separate column on the right. The column with free terms is separated for convenience. The matrix that includes this column is called extended.
Next, the main matrix with coefficients must be reduced to an upper triangular form. This is the main point of solving the system using the Gaussian method. Simply put, after certain manipulations, the matrix should look so that its lower left part contains only zeros:
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 Gaussian method in the most general outline. What happens if suddenly the system has no solution? Or are there infinitely many of them? To answer these and many other questions, it is necessary to consider separately all the elements used in solving the Gaussian method.
Matrices, their properties
None hidden meaning not in the matrix. This is simply a convenient way to record data for subsequent operations with it. Even schoolchildren do not need to be afraid of them.
The matrix is always rectangular, because it is more convenient. Even in the Gauss method, where everything comes down to constructing a matrix of a triangular form, a rectangle appears in the entry, only with zeros in the place where there are no numbers. Zeros may not be written, but they are implied.
The matrix has a size. Its “width” is the number of rows (m), “length” is the number of columns (n). Then the size of the matrix A (capital letters are usually used to denote them) latin 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 matrix A can be denoted by its row and column numbers: a xy ; x - row number, changes, y - column number, changes.
B is not the main point of the decision. In principle, all operations can be performed directly with the equations themselves, but the notation will 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 characteristic. There is no need to find out its meaning now; 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 from 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 at the intersection of the selected columns and rows will form a new square matrix. If the determinant of such a matrix is a non-zero number, it is called the basis minor of the original rectangular matrix.
Before you start solving a system of equations using the Gaussian method, it doesn’t 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 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 (if we remember about the basis minor, we can say that the rank of a matrix is the order of the basis minor).
Based on the situation with rank, SLAE can be divided into:
- Joint. U In joint systems, the rank of the main matrix (consisting only of coefficients) coincides with the rank of the extended matrix (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 single 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;
- - undefined - with an infinite number of solutions. The rank of matrices in such systems is less than the number of unknowns.
- Incompatible. U In such systems, the ranks of the main and extended matrices do not coincide. Incompatible systems have no solution.
The Gauss method is good because during the solution it allows one to obtain either an unambiguous proof of the inconsistency of the system (without calculating the determinants of large matrices), or a solution in general form for a system with an infinite number of solutions.
Elementary transformations
Before proceeding directly to solving the system, you can 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 given elementary transformations are valid only for matrices, the source of which was the SLAE. Here is a list of these transformations:
- Rearranging lines. Obviously, if you change the order of the equations in the system record, this will not affect the solution in any way. Consequently, rows in the matrix of this system can also be swapped, not forgetting, of course, the column of free terms.
- Multiplying all elements of a string by a certain coefficient. Very useful! It can be used to shorten big numbers in the matrix or remove zeros. Many decisions, as usual, will not change, but further operations will become more convenient. The main thing is that the coefficient is not equal to zero.
- Removing rows with proportional factors. This partly follows from the previous paragraph. If two or more rows in a matrix have proportional coefficients, then when one of the rows is multiplied/divided by the proportionality coefficient, two (or, again, more) absolutely identical rows are obtained, and the extra ones can be removed, leaving only one.
- Removing a null line. If, during the transformation, a row is obtained somewhere in which all elements, including the free term, are zero, then such a row can be called zero and thrown out of the matrix.
- Adding to the elements of one row the elements of another (in the corresponding columns), multiplied by a certain coefficient. The most unobvious 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 breaking down 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
Let's say you need to add the first to the second, multiplied by the coefficient "-2".
a" 21 = a 21 + -2×a 11
a" 22 = a 22 + -2×a 12
a" 2n = a 2n + -2×a 1n
Then the second row in the matrix is replaced with a new one, and the first remains unchanged.
a 11 a 12 ... a 1n | b1
a" 21 a" 22 ... a" 2n | b 2
It should be noted that the multiplication coefficient can be selected in such a way that, as a result of adding two rows, one of the elements of the new row is equal to zero. Therefore, it is possible to obtain an equation in a 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 contain two fewer unknowns. And if each time you turn one coefficient of all rows that are below the original one to zero, then you can, like stairs, 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 as follows:
The main matrix is compiled from the system coefficients. A column of free terms is added to the extended matrix and, for convenience, separated by a line.
- 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, at each step of the algorithm, 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 zero. Now you need to forget about line number one and perform the same algorithm, starting from line two:
- coefficient k = (-a 32 /a 22);
- the second modified line is added to the “current” line;
- the result of the addition is substituted into 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 in last time the algorithm was performed only for the lower equation. Now the matrix looks like a triangle, or has a stepped shape. In the bottom line there is 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 line 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 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 happen that in the given triangular matrix there are no rows with one coefficient element of the equation and one free term. There are only lines 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 this?
All variables in the matrix are divided into basic and free. Basic ones are those that stand “on the edge” of the rows in the step matrix. The rest are free. In the general solution, the basic variables are written through free ones.
For convenience, the matrix is first rewritten back into a system of equations. Then in the last of them, where exactly there is only one basic variable left, it remains on one side, and everything else is transferred to the other. This is done for every equation with one basic variable. Then, in the remaining equations, where possible, the expression obtained for it is substituted instead of the basic variable. If the result is again an expression 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. 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 specific case calculate the values of the basic variables. There are an infinite number of particular solutions that can be given.
Solution with specific examples
Here is a system of equations.
For convenience, it is better to immediately create its matrix
It is known that when solved by the Gaussian 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 row in place of the first one.
second line: k = (-a 21 /a 11) = (-3/1) = -3
a" 21 = a 21 + k×a 11 = 3 + (-3)×1 = 0
a" 22 = a 22 + k×a 12 = -1 + (-3)×2 = -7
a" 23 = a 23 + k×a 13 = 1 + (-3)×4 = -11
b" 2 = b 2 + k×b 1 = 12 + (-3)×12 = -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 = b 3 + k×b 1 = 3 + (-5)×12 = -57
Now, in order not to get confused, you need to write down a matrix with the intermediate results of the transformations.
Obviously, such a matrix can be made more convenient for perception using certain 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 line 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 the first line alone and work with the second and third. The task is to add the second line to the third line, multiplied by such a coefficient that the element a 32 becomes equal to zero.
k = (-a 32 /a 22) = (-3/7) = -3/7 (if during some transformations the answer does not turn out to be an integer, it is recommended to maintain the accuracy of the calculations to leave it “as is”, in the form common fraction, and only then, when the answers are received, decide whether to round and convert to another form of recording)
a" 32 = a 32 + k×a 22 = 3 + (-3/7)×7 = 3 + (-3) = 0
a" 33 = a 33 + k×a 23 = 6 + (-3/7)×11 = -9/7
b" 3 = b 3 + k×b 2 = 19 + (-3/7)×24 = -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 using the Gaussian method are not required. What you can do here is to remove the overall coefficient "-1/7" from the third line.
Now everything is beautiful. All that’s left to do is 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 Gaussian method. Equation (3) contains the z value:
y = (24 - 11×(61/9))/7 = -65/9
And the first equation allows us to find x:
x = (12 - 4z - 2y)/1 = 12 - 4×(61/9) - 2×(-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 answer is written in the following form:
x 1 = -2/3, y = -65/9, z = 61/9.
An example of an uncertain system
The variant of solving a certain system using the Gauss method has been analyzed; now it is necessary to consider the case if the system is uncertain, 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 system matrix is already exactly less than this number, because the number of rows is m = 4, that is, the largest order of the determinant-square is 4. This means that there are an infinite number of solutions, and you need to look for its general appearance. The Gauss method for linear equations allows you to do this.
First, as usual, an extended 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 is. Fourth line: k = (-a 4 1 /a 11) = -5
By multiplying the elements of the first row by each of their coefficients in turn and adding them to the required rows, we obtain a matrix of the following form:
As you can see, the second, third and fourth rows consist of elements proportional to each other. The second and fourth are generally identical, so one of them can be removed immediately, and the remaining one can be multiplied by the coefficient “-1” and get line number 3. And again, out of two identical lines, leave one.
The result is a matrix like this. While the system has not yet been written down, it is necessary to determine the basic variables here - those standing at the coefficients a 11 = 1 and a 22 = 1, and free ones - all the rest.
In the second equation there is only one basic variable - x 2. This means that it can be expressed from there by writing it through the variables x 3 , x 4 , x 5 , which are free.
We substitute the resulting expression into the first equation.
The result is 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 we can write the answer in general form.
You can also specify one of the particular solutions of the system. For such cases, zeros are usually chosen as values for free variables. Then the answer will be:
16, 23, 0, 0, 0.
An example of a non-cooperative system
Solving incompatible systems of equations using the Gauss method is the fastest. It ends immediately as soon as at one of the stages an equation is obtained that has no solution. That is, the stage of calculating the roots, which is quite long and tedious, is eliminated. 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 stepwise form:
k 1 = -2k 2 = -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
without a solution. Consequently, the system is inconsistent, and the answer will be the empty set.
Advantages and disadvantages of the method
If you choose which method to solve SLAEs on paper with a pen, then the method that was discussed in this article looks the most attractive. It is much more difficult to get confused in elementary transformations than if you have to manually search 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 advisable to use the matrix method or Cramer’s formulas, because their use begins and ends with the calculation of determinants and inverse matrices.
Application
Since the Gaussian solution is an algorithm, and the matrix is actually 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 into is spreadsheets, for example, Excel. Again, any SLAE entered into 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, multiplication of matrices (also with certain restrictions), finding the inverse and transposed matrices and, most importantly, calculating the determinant. If this time-consuming task is replaced with a single command, it is possible to determine the rank of the matrix much more quickly and, therefore, establish its compatibility or incompatibility.
Let a system of linear algebraic equations, which needs to be solved (find such values of the unknowns xi that turn each equation of the system into equality).
We know that a system of linear algebraic equations can:
1) Have no solutions (be non-joint).
2) Have infinitely many solutions.
3) Have a single solution.
As we remember, Cramer's rule and the matrix method are not suitable in cases where the system has infinitely many solutions or is inconsistent. Gauss method – the most powerful and versatile tool for finding solutions to any system of linear equations, which in every case will lead us to the answer! The method algorithm itself works the same in all three cases. If the Cramer and matrix methods require knowledge of determinants, then to apply the Gauss method you only need knowledge of arithmetic operations, which makes it accessible even to primary school students.
Augmented 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 troki matrices Can rearrange in some places.
2) if proportional (as a special case – identical) rows appear (or exist) in the matrix, then you should delete All these rows are from the matrix except one.
3) if a zero row appears in the matrix during transformations, then it should also be delete.
4) a row of the matrix can be multiply (divide) to any number other than zero.
5) to a 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:
- “Direct move” - using elementary transformations, bring the extended matrix of a system of linear algebraic equations to a “triangular” step form: the elements of the extended matrix located below the main diagonal are equal to zero (top-down move). For example, to this type:
To do this, perform the following steps:
1) Let us consider the first equation of a system of linear algebraic equations and the coefficient for 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 the unknown x 1, which is in each equation, and multiply by K. After this, we subtract the first from the second equation (coefficients for unknowns and free terms). For x 1 in the second equation we obtain the coefficient 0. From the third transformed equation we subtract the first equation until all equations except the first, for unknown x 1, have a coefficient 0.
2) Let's move on to the next equation. Let this be the second equation and the coefficient for x 2 equal to M. We proceed with all “lower” equations as described above. Thus, “under” the unknown x 2 there will be zeros in all equations.
3) Move on to the next equation and so on until one last unknown and the transformed free term remain.
- 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 obtain one first solution - the unknown x n. To do this, we solve the elementary equation A * x n = B. In the example given above, x 3 = 4. We substitute the found value into the “upper” next equation and solve it with respect to the next unknown. For example, x 2 – 4 = 1, i.e. x 2 = 5. And so on until we find all the unknowns.
Example.
Let's solve the system of linear equations using the Gauss method, as some authors advise:
Let us write down the extended matrix of the system and, using elementary transformations, bring it to a stepwise form:
We look at the upper left “step”. We should have a unit there. The problem is that there are no units in the first column at all, so rearranging the rows will not solve anything. In such cases, the unit must be organized using an elementary transformation. This can usually be done in several ways. Let's do 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 added the first and second lines, while the second line did not change.
Now at the top left there is “minus one”, which suits us quite well. Anyone who wants to get +1 can perform an additional action: multiply the first line by –1 (change its sign).
Step 2 . The first line, multiplied by 5, was added to the second line. The first line, multiplied by 3, was added to the third line.
Step 3 . The first line was multiplied by –1, in principle, this is for beauty. The sign of the third line was also changed and it was moved to second place, so that on the second “step” we had the required unit.
Step 4 . The third line was added to the second line, multiplied by 2.
Step 5 . The third line was divided by 3.
A sign that indicates an error in calculations (more rarely, 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 an error was made during elementary transformations.
Let’s do the reverse; in the design of examples, the system itself is often not rewritten, but the equations are “taken directly from the given matrix.” The reverse move, I remind you, works from the bottom up. IN in this example it turned out to be a gift:
x 3 = 1
x 2 = 3
x 1 + x 2 – x 3 = 1, therefore x 1 + 3 – 1 = 1, x 1 = –1
Answer:x 1 = –1, x 2 = 3, x 3 = 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
Multiplying 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
Subtracting 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
Subtracting the second from the third equation, we obtain a “stepped” extended matrix:
4 2 –1 1
0 0.4 –0.6 0.6
0 0 –1.275 –1.225
Thus, since the error accumulated during the calculations, we obtain x 3 = 0.96 or approximately 1.
x 2 = 3 and x 1 = –1.
By 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 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 Aystrakhanov.
website, when copying material in full or in part, a link to the source is required.
The Gaussian method is easy! Why? The famous German mathematician Johann Carl Friedrich Gauss, during his lifetime, received recognition as the greatest mathematician of all time, a genius, and even the nickname “King of Mathematics.” And everything ingenious, as you know, is simple! By the way, not only suckers get money, but also geniuses - Gauss’s portrait was on the 10 Deutschmark banknote (before the introduction of the euro), and Gauss still smiles mysteriously at the Germans from ordinary postage stamps.
The Gauss method is simple in that the KNOWLEDGE OF A FIFTH-GRADE STUDENT IS ENOUGH to master it. You must know how to add and multiply! It is no coincidence that teachers often consider the method of sequential exclusion of unknowns in school mathematics electives. It’s a paradox, but students find the Gaussian method the most difficult. Nothing surprising - it’s all about the methodology, and I will try to talk about the algorithm of the method in an accessible form.
First, let's systematize a little knowledge about systems of linear equations. A system of linear equations can:
1) Have a unique solution.
2) Have infinitely many solutions.
3) Have no solutions (be non-joint).
The Gauss method is the most powerful and universal tool for finding a solution any systems of linear equations. As we remember, Cramer's rule and matrix method are unsuitable in cases where the system has infinitely many solutions or is inconsistent. And the method of sequential elimination of unknowns Anyway will lead us to the answer! On this lesson We will again consider the Gauss method for case No. 1 (the only solution to the system), the article is devoted to the situations of points No. 2-3. I note that the algorithm of the method itself works the same in all three cases.
Let's return to the simplest system from the lesson How to solve a system of linear equations?
and solve it using the Gaussian method.
The first step is to write down extended system matrix:
. I think everyone can see by what principle the coefficients are written. The vertical line inside the matrix does not have any mathematical meaning - it is simply a strikethrough for ease of design.
Reference :I recommend you remember terms linear algebra. System Matrix is a matrix composed only of coefficients for unknowns, in this example the matrix of the system: . Extended System Matrix is the same matrix of the system plus a column of free terms, in in this case: . For brevity, any of the matrices can be simply called a matrix.
After the extended system matrix is written, it is necessary to perform some actions with it, which are also called elementary transformations.
The following elementary transformations exist:
1) Strings matrices Can rearrange in some places. For example, in the matrix under consideration, you can painlessly rearrange the first and second rows:
2) If there are (or have appeared) proportional (as a special case - identical) rows in the matrix, then you should delete All these rows are from the matrix except one. Consider, for example, the matrix . In this matrix, the last three rows are proportional, so it is enough to leave only one of them:
.
3) If a zero row appears in the matrix during transformations, then it should also be delete. I won’t draw, of course, the zero line is the line in which all zeros.
4) The matrix row can be multiply (divide) to any number non-zero. Consider, for example, the matrix . Here it is advisable to divide the first line by –3, and multiply the second line by 2: . This action is very useful because it simplifies further transformations of the matrix.
5) This transformation causes the most difficulties, but in fact there is nothing complicated either. To a row of a matrix you can add another string multiplied by a number, different from zero. Let's look at our matrix from a practical example: . First I'll describe the transformation in great detail. Multiply the first line by –2: , And to the second line we add the first line multiplied by –2:
. Now the first line can be divided “back” by –2: . As you can see, the line that ADD LI – hasn't changed. Always the line TO WHICH IS ADDED changes UT.
In practice, of course, they don’t write it in such detail, but write it briefly:
Once again: to the second line added the first line multiplied by –2. A line is usually multiplied orally or on a draft, with the mental calculation process going something like this:
“I rewrite the matrix and rewrite the first line: »
“First column. At the bottom I need to get zero. Therefore, I multiply the one at the top by –2: , and add the first one to the second line: 2 + (–2) = 0. I write the result in the second line: »
“Now the second column. At the top, I multiply -1 by -2: . I add the first to the second line: 1 + 2 = 3. I write the result in the second line: »
“And the third column. At the top I multiply -5 by -2: . I add the first to the second line: –7 + 10 = 3. I write the result in the second line: »
Please carefully understand this example and understand the sequential calculation algorithm, if you understand this, then the Gaussian method is practically in your pocket. But, of course, we will still work on this transformation.
Elementary transformations do not change the solution of the system of equations
! ATTENTION: considered manipulations cannot be used, if you are offered a task where the matrices are given “by themselves.” For example, with “classical” operations with matrices Under no circumstances should you rearrange anything inside the matrices!
Let's return to our system. It is practically taken to pieces.
Let us write down the extended matrix of the system and, using elementary transformations, reduce it to stepped view:
(1) The first line was added to the second line, multiplied by –2. And again: why do we multiply the first line by –2? In order to get zero at the bottom, which means getting rid of one variable in the second line.
(2) Divide the second line by 3.
The purpose of elementary transformations –
reduce the matrix to stepwise form: . In the assignment form it is clearly stated that with a simple pencil“stairs”, and also circle the numbers that are located on the “steps”. The term “stepped view” itself is not entirely theoretical, in scientific and educational literature it is often called trapezoidal view or triangular view.
As a result of elementary transformations, we obtained equivalent original system of equations:
Now the system needs to be “unwinded” in the opposite direction - from bottom to top, this process is called inverse of the Gaussian method.
In the lower equation we already have a ready-made result: .
Let's consider the first equation of the system and substitute into it already known value"Y":
Let's consider the most common situation, when the Gaussian method requires solving a system of three linear equations with three unknowns.
Example 1
Solve the system of equations using the Gauss method:
Let's write the extended matrix of the system:
Now I will immediately draw the result that we will come to during the solution:
And I repeat, our goal is to bring the matrix to a stepwise form using elementary transformations. Where to start?
First, look at the top left number:
Should almost always be here unit. Generally speaking, –1 (and sometimes other numbers) will do, but somehow it has traditionally happened that one is usually placed there. How to organize a unit? We look at the first column - we have a finished unit! Transformation one: swap the first and third lines:
Now the first line will remain unchanged until the end of the solution. It's already easier.
Unit in left top corner organized. Now you need to get zeros in these places:
We get zeros using a “difficult” transformation. First we deal with the second line (2, –1, 3, 13). What needs to be done to get zero in the first position? Need to to the second line add the first line multiplied by –2. Mentally or on a draft, multiply the first line by –2: (–2, –4, 2, –18). And we consistently carry out (again mentally or on a draft) addition, to the second line we add the first line, already multiplied by –2:
We write the result in the second line:
We deal with the third line in the same way (3, 2, –5, –1). To get a zero in the first position, you need to the third line add the first line multiplied by –3. Mentally or on a draft, multiply the first line by –3: (–3, –6, 3, –27). AND to the third line we add the first line multiplied by –3:
We write the result in the third line:
In practice, these actions are usually performed orally and written down in one step:
No need to count everything at once and at the same time. The order of calculations and “writing in” the results consistent and usually it’s like this: first we rewrite the first line, and slowly puff on ourselves - CONSISTENTLY and ATTENTIVELY:
And I have already discussed the mental process of the calculations themselves above.
In this example, this is easy to do; we divide the second line by –5 (since all numbers there are divisible by 5 without a remainder). At the same time, we divide the third line by –2, because the smaller the number, the simpler solution:
On final stage elementary transformations you need to get another zero here:
For this to the third line we add the second line multiplied by –2:
Try to figure out this action yourself - mentally multiply the second line by –2 and perform the addition.
The last action performed is the hairstyle of the result, divide the third line by 3.
As a result of elementary transformations, an equivalent system of linear equations was obtained:
Cool.
Now the reverse of the Gaussian method comes into play. The equations “unwind” from bottom to top.
In the third equation we already have a ready result:
Let's look at the second equation: . The meaning of "zet" is already known, thus:
And finally, the first equation: . “Igrek” and “zet” are known, it’s just a matter of little things:
Answer:
As has been repeatedly noted, for any system of equations it is possible and necessary to check the solution found, fortunately, this is easy and quick.
Example 2
This is an example for an independent solution, a sample of the final design and an answer at the end of the lesson.
It should be noted that your progress of the decision may not coincide with my decision process, and this is a feature of the Gauss method. But the answers must be the same!
Example 3
Solve a system of linear equations using the Gauss method
Let us write down the extended matrix of the system and, using elementary transformations, bring it to a stepwise form:
We look at the upper left “step”. We should have a unit there. The problem is that there are no units in the first column at all, so rearranging the rows will not solve anything. In such cases, the unit must be organized using an elementary transformation. This can usually be done in several ways. I did this:
(1) To the first line we add the second line, multiplied by –1. That is, we mentally multiplied the second line by –1 and added the first and second lines, while the second line did not change.
Now at the top left there is “minus one”, which suits us quite well. Anyone who wants to get +1 can perform an additional movement: multiply the first line by –1 (change its sign).
(2) 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) The first line was multiplied by –1, in principle, this is for beauty. The sign of the third line was also changed and it was moved to second place, so that on the second “step” we had the required unit.
(4) The second line was added to the third line, multiplied by 2.
(5) The third line was divided by 3.
A bad sign that indicates an error in calculations (more rarely, a typo) is a “bad” bottom line. That is, if we got something like , below, and, accordingly, , then with a high degree of probability we can say that an error was made during elementary transformations.
We charge the reverse, in the design of examples they often do not rewrite the system itself, but the equations are “taken directly from the given matrix.” The reverse stroke, I remind you, works from bottom to top. Yes, here is a gift:
Answer: .
Example 4
Solve a system of linear equations using the Gauss method
This is an example for you to solve on your own, it is somewhat more complicated. It's okay if someone gets confused. Full solution and sample design at the end of the lesson. Your solution may be different from my solution.
In the last part we will look at some features of the Gaussian algorithm.
The first feature is that sometimes some variables are missing from the system equations, for example:
How to correctly write the extended system matrix? I already talked about this point in class. Cramer's rule. Matrix method. In the extended matrix of the system, we put zeros in place of missing variables:
By the way, this is a fairly easy example, since the first column already has one zero, and there are fewer elementary transformations to perform.
The second feature is this. In all the examples considered, we placed either –1 or +1 on the “steps”. Could there be other numbers there? In some cases they can. Consider the system: .
Here on the upper left “step” we have a two. But we notice the fact that all the numbers in the first column are divisible by 2 without a remainder - and the other is two and six. And the two at the top left will suit us! In the first step, you need to perform the following transformations: add the first line multiplied by –1 to the second line; to the third line add the first line multiplied by –3. This way we will get the required zeros in the first column.
Or another conventional example: . Here the three on the second “step” also suits us, since 12 (the place where we need to get zero) is divisible by 3 without a remainder. It is necessary to carry out the following transformation: add the second line to the third line, multiplied by –4, as a result of which the zero we need will be obtained.
Gauss's method is universal, but there is one peculiarity. You can confidently learn to solve systems using other methods (Cramer’s method, matrix method) literally the first time - they have a very strict algorithm. But in order to feel confident in the Gaussian method, you need to get good at it and solve at least 5-10 systems. Therefore, at first there may be confusion and errors in calculations, and there is nothing unusual or tragic about this.
Rainy autumn weather outside the window.... Therefore, for everyone who wants more complex example for independent solution:
Example 5
Solve by Gaussian method system of four linear equations with four unknowns.
Such a task is not so rare in practice. I think even a teapot who has thoroughly studied this page will understand the algorithm for solving such a system intuitively. Fundamentally, everything is the same - there are just more actions.
Cases when the system has no solutions (inconsistent) or has infinitely many solutions are discussed in the lesson Incompatible systems and systems with a general solution. There you can fix the considered algorithm of the Gaussian method.
I wish you success!
Solutions and answers:
Example 2: Solution
:
Let us write down the extended matrix of the system and, using elementary transformations, bring it to a stepwise form.
Elementary transformations performed:
(1) The first line was added to the second line, multiplied by –2. The first line was added to the third line, multiplied by –1. Attention! Here you may be tempted to subtract the first from the third line; I highly recommend not subtracting it - the risk of error greatly increases. Just fold it!
(2) The sign of the second line was changed (multiplied by –1). The second and third lines have been swapped. Please note, that on the “steps” we are satisfied not only with one, but also with –1, which is even more convenient.
(3) The second line was added to the third line, multiplied by 5.
(4) The sign of the second line was changed (multiplied by –1). The third line was divided by 14.
Reverse:
Answer: .
Example 4: Solution
:
Let us write down the extended matrix of the system and, using elementary transformations, bring it to a stepwise form:
Conversions performed:
(1) A second line was added to the first line. Thus, the desired unit is organized on the upper left “step”.
(2) The first line multiplied by 7 was added to the second line. The first line multiplied by 6 was added to the third line.
With the second “step” everything gets worse , the “candidates” for it are the numbers 17 and 23, and we need either one or –1. Transformations (3) and (4) will be aimed at obtaining the desired unit
(3) The second line was added to the third line, multiplied by –1.
(4) The third line was added to the second line, multiplied by –3.
(3) The second line was added to the third line, multiplied by 4. The second line was added to the fourth line, multiplied by –1.
(4) The sign of the second line was changed. The fourth line was divided by 3 and placed in place of the third line.
(5) The third line was added to the fourth line, multiplied by –5.
Reverse:
Two systems of linear equations are called equivalent if the set of all their solutions coincides.
Elementary transformations of a system of equations are:
- Deleting trivial equations from the system, i.e. those for which all coefficients are equal to zero;
- Multiplying any equation by a number other than zero;
- Adding to any i-th equation any j-th equation multiplied by any number.
A variable x i is called free if this variable is not allowed, but the entire system of equations is allowed.
Theorem. Elementary transformations transform a system of equations into an equivalent one.
The meaning of the Gaussian method is to transform the original system of equations and obtain an equivalent resolved or equivalent inconsistent system.
So, the Gaussian method consists of the following steps:
- Let's look at the first equation. Let's choose the first non-zero coefficient and divide the entire equation by it. We obtain an equation in which some variable x i enters with a coefficient of 1;
- Let's subtract this equation from all the others, multiplying it by such numbers that the coefficients of the variable x i in the remaining equations are zeroed. We obtain a system resolved with respect to the variable x i and equivalent to the original one;
- If trivial equations arise (rarely, but it happens; for example, 0 = 0), we cross them out of the system. As a result, there are one fewer equations;
- 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 inconsistent equations arise (for example, 0 = 8), the system is inconsistent.
As a result, after a few steps we will obtain either a resolved system (possibly with free variables) or an inconsistent one. Allowed systems fall into two cases:
- The number of variables is equal to the number of equations. This means that the system is defined;
- The number of variables is greater than the number of equations. We collect all the free variables on the right - we get formulas for the allowed variables. These formulas are written in the answer.
That's it! System of linear equations solved! This is a fairly simple algorithm, and to master it you do not have to contact a higher mathematics tutor. Let's look at an example:
Task. Solve the system of equations:
![](https://i1.wp.com/berdov.com/img/works/algebra/gauss/formula2.png)
Description of steps:
- Subtract the first equation from the second and third - we get the allowed variable x 1;
- 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;
- We add the second equation to the first, and subtract from the third. We get the allowed variable x 2 ;
- Finally, we subtract the third equation from the first - we get the allowed variable x 3;
- We have received an approved system, write down the response.
The general solution to a simultaneous system of linear equations is 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 do fewer steps than k (k is how many equations there are). However, the reasons why the process ends at some step l< k , может быть две:
- After the lth step, we obtained a system that does not contain an equation with number (l + 1). In fact, this is good, because... the authorized system is still obtained - even a few steps earlier.
- After the lth step, we obtained an equation in which all coefficients of the variables are equal to zero, and the free coefficient is different from zero. This is a contradictory equation, and, therefore, the system is inconsistent.
It is important to understand that the emergence of an inconsistent equation using the Gaussian method is a sufficient basis for inconsistency. At the same time, we note that as a result of the lth step, no trivial equations can remain - all of them are crossed out right in the process.
![](https://i2.wp.com/berdov.com/img/works/algebra/gauss/formula4.png)
Description of steps:
- Subtract the first equation, multiplied by 4, from the second. We also add the first equation to the third - we get the allowed variable x 1;
- Subtract the third equation, multiplied by 2, from the second - we get the contradictory equation 0 = −5.
So, the system is inconsistent because an inconsistent equation has been discovered.
Task. Explore compatibility and find a general solution to the system:
![](https://i1.wp.com/berdov.com/img/works/algebra/gauss/formula6.png)
Description of steps:
- We subtract the first equation from the second (after multiplying by two) and the third - we get the allowed variable x 1;
- Subtract the second equation from the third. Since all the coefficients in these equations are the same, the third equation will become trivial. At the same time, multiply the second equation by (−1);
- Subtract the second from the first equation - we get the allowed variable x 2. The entire system of equations is now also resolved;
- 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 consistent and indeterminate, since there are two allowed variables (x 1 and x 2) and two free ones (x 3 and x 4).
In this article, the method is considered as a method for solving systems of linear equations (SLAEs). 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 an infinite number of solutions. Or they don't have it at all.
What does it mean to solve using the Gaussian method?
First, we need to write our system of equations in It looks like this. Take the system:
The coefficients are written in the form of a table, and the free terms are written in a separate column on the right. The column with free terms is separated for convenience. The matrix that includes this column is called extended.
Next, the main matrix with coefficients must be reduced to an upper triangular form. This is the main point of solving the system using the Gaussian method. Simply put, after certain manipulations, the matrix should look so that its lower left part contains only zeros:
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 Gaussian method in the most general terms. What happens if suddenly the system has no solution? Or are there infinitely many of them? To answer these and many other questions, it is necessary to consider separately all the elements used in solving the Gaussian method.
Matrices, their properties
There is no hidden meaning in the matrix. This is simply a convenient way to record data for subsequent operations with it. Even schoolchildren do not need to be afraid of them.
The matrix is always rectangular, because it is more convenient. Even in the Gauss method, where everything comes down to constructing a matrix of a triangular form, a rectangle appears in the entry, only with zeros in the place where there are no numbers. Zeros may not be written, but they are implied.
The matrix has a size. Its “width” is the number of rows (m), “length” is the number of columns (n). Then the size of the matrix A (capital Latin letters are usually used to denote them) 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 matrix A can be denoted by its row and column numbers: a xy ; x - row number, changes, y - column number, changes.
B is not the main point of the decision. In principle, all operations can be performed directly with the equations themselves, but the notation will 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 characteristic. There is no need to find out its meaning now; 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 from 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 at the intersection of the selected columns and rows will form a new square matrix. If the determinant of such a matrix is a non-zero number, it is called the basis minor of the original rectangular matrix.
Before you start solving a system of equations using the Gaussian method, it doesn’t 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 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 (if we remember about the basis minor, we can say that the rank of a matrix is the order of the basis minor).
Based on the situation with rank, SLAE can be divided into:
- Joint. U In joint systems, the rank of the main matrix (consisting only of coefficients) coincides with the rank of the extended matrix (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 single 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;
- - undefined - with an infinite number of solutions. The rank of matrices in such systems is less than the number of unknowns.
- Incompatible. U In such systems, the ranks of the main and extended matrices do not coincide. Incompatible systems have no solution.
The Gauss method is good because during the solution it allows one to obtain either an unambiguous proof of the inconsistency of the system (without calculating the determinants of large matrices), or a solution in general form for a system with an infinite number of solutions.
Elementary transformations
Before proceeding directly to solving the system, you can 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 given elementary transformations are valid only for matrices, the source of which was the SLAE. Here is a list of these transformations:
- Rearranging lines. Obviously, if you change the order of the equations in the system record, this will not affect the solution in any way. Consequently, rows in the matrix of this system can also be swapped, not forgetting, of course, the column of free terms.
- Multiplying all elements of a string by a certain coefficient. Very useful! It can be used to reduce large numbers in a matrix or remove zeros. Many decisions, as usual, will not change, but further operations will become more convenient. The main thing is that the coefficient is not equal to zero.
- Removing rows with proportional factors. This partly follows from the previous paragraph. If two or more rows in a matrix have proportional coefficients, then when one of the rows is multiplied/divided by the proportionality coefficient, two (or, again, more) absolutely identical rows are obtained, and the extra ones can be removed, leaving only one.
- Removing a null line. If, during the transformation, a row is obtained somewhere in which all elements, including the free term, are zero, then such a row can be called zero and thrown out of the matrix.
- Adding to the elements of one row the elements of another (in the corresponding columns), multiplied by a certain coefficient. The most unobvious 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 breaking down 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
Let's say you need to add the first to the second, multiplied by the coefficient "-2".
a" 21 = a 21 + -2×a 11
a" 22 = a 22 + -2×a 12
a" 2n = a 2n + -2×a 1n
Then the second row in the matrix is replaced with a new one, and the first remains unchanged.
a 11 a 12 ... a 1n | b1
a" 21 a" 22 ... a" 2n | b 2
It should be noted that the multiplication coefficient can be selected in such a way that, as a result of adding two rows, one of the elements of the new row is equal to zero. Therefore, it is possible to obtain an equation in a 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 contain two fewer unknowns. And if each time you turn one coefficient of all rows that are below the original one to zero, then you can, like stairs, 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 as follows:
The main matrix is compiled from the system coefficients. A column of free terms is added to the extended matrix and, for convenience, separated by a line.
- 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, at each step of the algorithm, 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 zero. Now you need to forget about line number one and perform the same algorithm, starting from line two:
- coefficient k = (-a 32 /a 22);
- the second modified line is added to the “current” line;
- the result of the addition is substituted into 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 last time the algorithm was executed was only for the lower equation. Now the matrix looks like a triangle, or has a stepped shape. In the bottom line there is 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 line 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 subsequent 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 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 happen that in the given triangular matrix there are no rows with one coefficient element of the equation and one free term. There are only lines 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 this?
All variables in the matrix are divided into basic and free. Basic ones are those that stand “on the edge” of the rows in the step matrix. The rest are free. In the general solution, the basic variables are written through free ones.
For convenience, the matrix is first rewritten back into a system of equations. Then in the last of them, where exactly there is only one basic variable left, it remains on one side, and everything else is transferred to the other. This is done for every equation with one basic variable. Then, in the remaining equations, where possible, the expression obtained for it is substituted instead of the basic variable. If the result is again an expression 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. 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 specific case calculate the values of the basic variables. There are an infinite number of particular solutions that can be given.
Solution with specific examples
Here is a system of equations.
For convenience, it is better to immediately create its matrix
It is known that when solved by the Gaussian 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 row in place of the first one.
second line: k = (-a 21 /a 11) = (-3/1) = -3
a" 21 = a 21 + k×a 11 = 3 + (-3)×1 = 0
a" 22 = a 22 + k×a 12 = -1 + (-3)×2 = -7
a" 23 = a 23 + k×a 13 = 1 + (-3)×4 = -11
b" 2 = b 2 + k×b 1 = 12 + (-3)×12 = -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 = b 3 + k×b 1 = 3 + (-5)×12 = -57
Now, in order not to get confused, you need to write down a matrix with the intermediate results of the transformations.
Obviously, such a matrix can be made more convenient for perception using certain 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 line 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 the first line alone and work with the second and third. The task is to add the second line to the third line, multiplied by such a coefficient that the element a 32 becomes equal to zero.
k = (-a 32 /a 22) = (-3/7) = -3/7 (if during some transformations the answer does not turn out to be an integer, it is recommended to maintain the accuracy of the calculations to leave it “as is”, in the form of an ordinary fractions, and only then, when the answers are received, decide whether to round and convert to another form of recording)
a" 32 = a 32 + k×a 22 = 3 + (-3/7)×7 = 3 + (-3) = 0
a" 33 = a 33 + k×a 23 = 6 + (-3/7)×11 = -9/7
b" 3 = b 3 + k×b 2 = 19 + (-3/7)×24 = -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 using the Gaussian method are not required. What you can do here is to remove the overall coefficient "-1/7" from the third line.
Now everything is beautiful. All that’s left to do is 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 Gaussian method. Equation (3) contains the z value:
y = (24 - 11×(61/9))/7 = -65/9
And the first equation allows us to find x:
x = (12 - 4z - 2y)/1 = 12 - 4×(61/9) - 2×(-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 answer is written in the following form:
x 1 = -2/3, y = -65/9, z = 61/9.
An example of an uncertain system
The variant of solving a certain system using the Gauss method has been analyzed; now it is necessary to consider the case if the system is uncertain, 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 system matrix is already exactly less than this number, because the number of rows is m = 4, that is, the largest order of the determinant-square is 4. This means that there are an infinite number of solutions, and you need to look for its general appearance. The Gauss method for linear equations allows you to do this.
First, as usual, an extended 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 is. Fourth line: k = (-a 4 1 /a 11) = -5
By multiplying the elements of the first row by each of their coefficients in turn and adding them to the required rows, we obtain a matrix of the following form:
As you can see, the second, third and fourth rows consist of elements proportional to each other. The second and fourth are generally identical, so one of them can be removed immediately, and the remaining one can be multiplied by the coefficient “-1” and get line number 3. And again, out of two identical lines, leave one.
The result is a matrix like this. While the system has not yet been written down, it is necessary to determine the basic variables here - those standing at the coefficients a 11 = 1 and a 22 = 1, and free ones - all the rest.
In the second equation there is only one basic variable - x 2. This means that it can be expressed from there by writing it through the variables x 3 , x 4 , x 5 , which are free.
We substitute the resulting expression into the first equation.
The result is 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 we can write the answer in general form.
You can also specify one of the particular solutions of the system. For such cases, zeros are usually chosen as values for free variables. Then the answer will be:
16, 23, 0, 0, 0.
An example of a non-cooperative system
Solving incompatible systems of equations using the Gauss method is the fastest. It ends immediately as soon as at one of the stages an equation is obtained that has no solution. That is, the stage of calculating the roots, which is quite long and tedious, is eliminated. 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 stepwise form:
k 1 = -2k 2 = -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
without a solution. Consequently, the system is inconsistent, and the answer will be the empty set.
Advantages and disadvantages of the method
If you choose which method to solve SLAEs on paper with a pen, then the method that was discussed in this article looks the most attractive. It is much more difficult to get confused in elementary transformations than if you have to manually search 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 advisable to use the matrix method or Cramer’s formulas, because their use begins and ends with the calculation of determinants and inverse matrices.
Application
Since the Gaussian solution is an algorithm, and the matrix is actually 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 into is spreadsheets, for example, Excel. Again, any SLAE entered into 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, multiplication of matrices (also with certain restrictions), finding the inverse and transposed matrices and, most importantly, calculating the determinant. If this time-consuming task is replaced with a single command, it is possible to determine the rank of the matrix much more quickly and, therefore, establish its compatibility or incompatibility.