Solving matrices using the matrix method. How to solve a system of equations using the matrix method

Topic 2. SYSTEMS OF LINEAR ALGEBRAIC EQUATIONS.

Basic concepts.

Definition 1. System m linear equations With n unknowns is a system of the form:

where and are numbers.

Definition 2. A solution to system (I) is a set of unknowns in which each equation of this system becomes an identity.

Definition 3. System (I) is called joint, if it has at least one solution and non-joint, if it has no solutions. The joint system is called certain, if it has a unique solution, and uncertain otherwise.

Definition 4. Equation of the form

called zero, and the equation is of the form

called incompatible. Obviously, a system of equations containing an incompatible equation is inconsistent.

Definition 5. Two systems of linear equations are called equivalent, if every solution of one system serves as a solution to another and, conversely, every solution of the second system is a solution to the first.

Matrix representation of a system of linear equations.

Let us consider system (I) (see §1).

Let's denote:

Coefficient matrix for unknowns

Matrix - column of free terms

Matrix – column of unknowns

.

Definition 1. The matrix is ​​called main matrix of the system(I), and the matrix is ​​the extended matrix of system (I).

By the definition of equality of matrices, system (I) corresponds to the matrix equality:

.

The right side of this equality by definition of the product of matrices ( see definition 3 § 5 chapter 1) can be factorized:

, i.e.

Equality (2) called matrix notation of system (I).

Solving a system of linear equations using Cramer's method.

Let in system (I) (see §1) m=n, i.e. the number of equations is equal to the number of unknowns, and the main matrix of the system is non-singular, i.e. . Then system (I) from §1 has a unique solution

where Δ = det A called main determinant of the system(I), Δ i is obtained from the determinant Δ by replacing i th column to a column of free members of the system (I).

Example: Solve the system using Cramer's method:

.

By formulas (3) .

We calculate the determinants of the system:

,

,

.

To obtain the determinant, we replaced the first column in the determinant with a column of free terms; replacing the 2nd column in the determinant with a column of free terms, we get ; in a similar way, replacing the 3rd column in the determinant with a column of free terms, we get . System solution:

Solving systems of linear equations using inverse matrix.

Let in system (I) (see §1) m=n and the main matrix of the system is non-singular. Let us write system (I) in matrix form ( see §2):

because matrix A non-singular, then it has an inverse matrix ( see Theorem 1 §6 of Chapter 1). Let's multiply both sides of the equality (2) to the matrix, then

By definition of an inverse matrix. From equality (3) we have

Solve the system using the inverse matrix

.

Let's denote

In example (§ 3) we calculated the determinant, therefore, the matrix A has an inverse matrix. Then in effect (4) , i.e.

. (5)

Let's find the matrix ( see §6 chapter 1)

, , ,

, , ,

,

.

Gauss method.

Let a system of linear equations be given:

. (I)

It is required to find all solutions of system (I) or make sure that the system is inconsistent.

Definition 1.Let us call the elementary transformation of the system(I) any of three actions:

1) crossing out the zero equation;

2) adding to both sides of the equation the corresponding parts of another equation, multiplied by the number l;

3) swapping terms in the equations of the system so that unknowns with the same numbers in all equations occupy the same places, i.e. if, for example, in the 1st equation we changed the 2nd and 3rd terms, then the same must be done in all equations of the system.

The Gauss method consists in the fact that system (I) with the help of elementary transformations is reduced to an equivalent system, the solution of which is found directly or its unsolvability is established.

As described in §2, system (I) is uniquely determined by its extended matrix and any elementary transformation of system (I) corresponds to an elementary transformation of the extended matrix:

.

Transformation 1) corresponds to deleting the zero row in the matrix, transformation 2) is equivalent to adding another row to the corresponding row of the matrix, multiplied by the number l, transformation 3) is equivalent to rearranging the columns in the matrix.

It is easy to see that, on the contrary, each elementary transformation of the matrix corresponds to an elementary transformation of the system (I). Due to the above, instead of operations with system (I), we will work with the extended matrix of this system.

In the matrix, the 1st column consists of coefficients for x 1, 2nd column - from the coefficients for x 2 etc. If the columns are rearranged, it should be taken into account that this condition is violated. For example, if we swap the 1st and 2nd columns, then now the 1st column will contain the coefficients for x 2, and in the 2nd column - the coefficients for x 1.

We will solve system (I) using the Gaussian method.

1. Cross out all zero rows in the matrix, if any (i.e., cross out all zero equations in system (I).

2. Let's check whether among the rows of the matrix there is a row in which all elements except the last one are equal to zero (let's call such a row inconsistent). Obviously, such a line corresponds to an inconsistent equation in system (I), therefore, system (I) has no solutions and this is where the process ends.

3. Let the matrix not contain inconsistent rows (system (I) does not contain inconsistent equations). If a 11 =0, then we find in the 1st row some element (except for the last one) other than zero and rearrange the columns so that in the 1st row there is no zero in the 1st place. We will now assume that (i.e., we will swap the corresponding terms in the equations of system (I)).

4. Multiply the 1st line by and add the result with the 2nd line, then multiply the 1st line by and add the result with the 3rd line, etc. Obviously, this process is equivalent to eliminating the unknown x 1 from all equations of system (I), except the 1st. In the new matrix we get zeros in the 1st column under the element a 11:

.

5. Let’s cross out all zero rows in the matrix, if there are any, and check if there is an inconsistent row (if there is one, then the system is inconsistent and the solution ends there). Let's check if there will be a 22 / =0, if yes, then we find in the 2nd row an element other than zero and rearrange the columns so that . Next, multiply the elements of the 2nd row by and add with the corresponding elements of the 3rd line, then - the elements of the 2nd line and add with the corresponding elements of the 4th line, etc., until we get zeros under a 22/

.

The actions taken are equivalent to eliminating the unknown x 2 from all equations of system (I), except for the 1st and 2nd. Since the number of rows is finite, therefore after a finite number of steps we get that either the system is inconsistent, or we end up with a step matrix ( see definition 2 §7 chapter 1) :

,

Let us write out the system of equations corresponding to the matrix . This system is equivalent to system (I)

.

From the last equation we express; substitute into the previous equation, find, etc., until we get .

Note 1. Thus, when solving system (I) using the Gaussian method, we arrive at one of the following cases.

1. System (I) is inconsistent.

2. System (I) has a unique solution if the number of rows in the matrix is ​​equal to the number of unknowns ().

3. System (I) has an infinite number of solutions if the number of rows in the matrix is ​​less than the number of unknowns ().

Hence the following theorem holds.

Theorem. A system of linear equations is either inconsistent, has a unique solution, or has an infinite number of solutions.

Examples. Solve the system of equations using the Gauss method or prove its inconsistency:

b) ;

a) Let us rewrite the given system in the form:

.

We have swapped the 1st and 2nd equations of the original system to simplify the calculations (instead of fractions, we will only operate with integers using this rearrangement).

Let's create an extended matrix:

.

There are no null lines; there are no incompatible lines, ; Let's exclude the 1st unknown from all equations of the system except the 1st. To do this, multiply the elements of the 1st row of the matrix by “-2” and add them with the corresponding elements of the 2nd row, which is equivalent to multiplying the 1st equation by “-2” and adding it with the 2nd equation. Then we multiply the elements of the 1st line by “-3” and add them with the corresponding elements of the third line, i.e. multiply the 2nd equation of the given system by “-3” and add it to the 3rd equation. We get

.

The matrix corresponds to a system of equations). - (see definition 3§7 of Chapter 1).

The use of equations is widespread in our lives. They are used in many calculations, construction of structures and even sports. Man used equations in ancient times, and since then their use has only increased. The matrix method allows you to find solutions to SLAEs (systems of linear algebraic equations) of any complexity. The entire process of solving SLAEs comes down to two main actions:

Determination of the inverse matrix based on the main matrix:

Multiplying the resulting inverse matrix by a column vector of solutions.

Suppose we are given a SLAE of the following form:

\[\left\(\begin(matrix) 5x_1 + 2x_2 & = & 7 \\ 2x_1 + x_2 & = & 9 \end(matrix)\right.\]

Let's start solving this equation by writing out the system matrix:

Right side matrix:

Let's define the inverse matrix. You can find a 2nd order matrix as follows: 1 - the matrix itself must be non-singular; 2 - its elements that are on the main diagonal are swapped, and for the elements of the secondary diagonal we change the sign to the opposite one, after which we divide the resulting elements by the determinant of the matrix. We get:

\[\begin(pmatrix) 7 \\ 9 \end(pmatrix)=\begin(pmatrix) -11 \\ 31 \end(pmatrix)\Rightarrow \begin(pmatrix) x_1 \\ x_2 \end(pmatrix) =\ begin(pmatrix) -11 \\ 31 \end(pmatrix) \]

2 matrices are considered equal if their corresponding elements are equal. As a result, we have the following answer for the SLAE solution:

Where can I solve a system of equations using the matrix method online?

You can solve the system of equations on our website. The free online solver will allow you to solve online equations of any complexity in a matter of seconds. All you need to do is simply enter your data into the solver. You can also find out how to solve the equation on our website. And if you still have questions, you can ask them in our VKontakte group.

Matrix method SLAU solutions applied to solving systems of equations in which the number of equations corresponds to the number of unknowns. The method is best used for solving low-order systems. The matrix method for solving systems of linear equations is based on the application of the properties of matrix multiplication.

This method, in other words inverse matrix method, so called because the solution reduces to an ordinary matrix equation, to solve which you need to find the inverse matrix.

Matrix solution method A SLAE with a determinant that is greater or less than zero is as follows:

Suppose there is a SLE (system of linear equations) with n unknown (over an arbitrary field):

This means that it can be easily converted into matrix form:

AX=B, Where A— the main matrix of the system, B And X— columns of free terms and solutions of the system, respectively:

Let's multiply this matrix equation from the left by A−1— inverse matrix to matrix A: A −1 (AX)=A −1 B.

Because A −1 A=E, Means, X=A −1 B. The right side of the equation gives the solution column of the initial system. The condition for the applicability of the matrix method is the non-degeneracy of the matrix A. A necessary and sufficient condition for this is that the determinant of the matrix is ​​not equal to zero A:

detA≠0.

For homogeneous system of linear equations, i.e. if vector B=0, performed reverse rule: at the system AX=0 there is a non-trivial (i.e. not equal to zero) solution only when detA=0. This connection between solutions of homogeneous and inhomogeneous systems of linear equations is called Fredholm alternative.

Thus, the solution of the SLAE matrix method produced according to the formula . Or, the solution to the SLAE is found using inverse matrix A−1.

It is known that for a square matrix A order n on n there is an inverse matrix A−1 only if its determinant is nonzero. Thus, the system n linear algebraic equations with n We solve unknowns using the matrix method only if the determinant of the main matrix of the system is not equal to zero.

Despite the fact that there are limitations on the applicability of such a method and the difficulties of calculations for large values ​​of coefficients and high-order systems, the method can be easily implemented on a computer.

An example of solving a non-homogeneous SLAE.

First, let’s check whether the determinant of the coefficient matrix of unknown SLAEs is not equal to zero.

Now we find union matrix, transpose it and substitute it into the formula to determine the inverse matrix.

Substitute the variables into the formula:

Now we find the unknowns by multiplying the inverse matrix and the column of free terms.

So, x=2; y=1; z=4.

When moving from normal looking SLAE to matrix form, be careful with the order of unknown variables in the equations of the system. For example:

It CANNOT be written as:

It is necessary, first, to order the unknown variables in each equation of the system and only after that proceed to matrix notation:

In addition, you need to be careful with the designation of unknown variables, instead x 1, x 2 , …, x n there may be other letters. Eg:

in matrix form we write it like this:

The matrix method is better for solving systems of linear equations in which the number of equations coincides with the number of unknown variables and the determinant of the main matrix of the system is not equal to zero. When there are more than 3 equations in a system, finding the inverse matrix will require more computational effort, therefore, in this case, it is advisable to use the Gaussian method for solving.

(sometimes this method is also called the matrix method or the inverse matrix method) requires preliminary familiarization with such a concept as the matrix form of notation of SLAE. The inverse matrix method is intended for solving those systems of linear algebraic equations in which the determinant of the system matrix is ​​different from zero. Naturally, this assumes that the matrix of the system is square (the concept of a determinant exists only for square matrices). The essence of the inverse matrix method can be expressed in three points:

  1. Write down three matrices: the system matrix $A$, the matrix of unknowns $X$, the matrix of free terms $B$.
  2. Find the inverse matrix $A^(-1)$.
  3. Using the equality $X=A^(-1)\cdot B$, obtain a solution to the given SLAE.

Any SLAE can be written in matrix form as $A\cdot X=B$, where $A$ is the matrix of the system, $B$ is the matrix of free terms, $X$ is the matrix of unknowns. Let the matrix $A^(-1)$ exist. Let's multiply both sides of the equality $A\cdot X=B$ by the matrix $A^(-1)$ on the left:

$$A^(-1)\cdot A\cdot X=A^(-1)\cdot B.$$

Since $A^(-1)\cdot A=E$ ($E$ is the identity matrix), the above equality becomes:

$$E\cdot X=A^(-1)\cdot B.$$

Since $E\cdot X=X$, then:

$$X=A^(-1)\cdot B.$$

Example No. 1

Solve the SLAE $ \left \( \begin(aligned) & -5x_1+7x_2=29;\\ & 9x_1+8x_2=-11. \end(aligned) \right.$ using the inverse matrix.

$$ A=\left(\begin(array) (cc) -5 & 7\\ 9 & 8 \end(array)\right);\; B=\left(\begin(array) (c) 29\\ -11 \end(array)\right);\; X=\left(\begin(array) (c) x_1\\ x_2 \end(array)\right). $$

Let's find the inverse matrix to the system matrix, i.e. Let's calculate $A^(-1)$. In example No. 2

$$ A^(-1)=-\frac(1)(103)\cdot\left(\begin(array)(cc) 8 & -7\\ -9 & -5\end(array)\right) . $$

Now let's substitute all three matrices ($X$, $A^(-1)$, $B$) into the equality $X=A^(-1)\cdot B$. Then we perform matrix multiplication

$$ \left(\begin(array) (c) x_1\\ x_2 \end(array)\right)= -\frac(1)(103)\cdot\left(\begin(array)(cc) 8 & -7\\ -9 & -5\end(array)\right)\cdot \left(\begin(array) (c) 29\\ -11 \end(array)\right)=\\ =-\frac (1)(103)\cdot \left(\begin(array) (c) 8\cdot 29+(-7)\cdot (-11)\\ -9\cdot 29+(-5)\cdot (- 11) \end(array)\right)= -\frac(1)(103)\cdot \left(\begin(array) (c) 309\\ -206 \end(array)\right)=\left( \begin(array) (c) -3\\ 2\end(array)\right). $$

So, we got the equality $\left(\begin(array) (c) x_1\\ x_2 \end(array)\right)=\left(\begin(array) (c) -3\\ 2\end(array )\right)$. From this equality we have: $x_1=-3$, $x_2=2$.

Answer: $x_1=-3$, $x_2=2$.

Example No. 2

Solve SLAE $ \left\(\begin(aligned) & x_1+7x_2+3x_3=-1;\\ & -4x_1+9x_2+4x_3=0;\\ & 3x_2+2x_3=6. \end(aligned)\right .$ using the inverse matrix method.

Let us write down the matrix of the system $A$, the matrix of free terms $B$ and the matrix of unknowns $X$.

$$ A=\left(\begin(array) (ccc) 1 & 7 & 3\\ -4 & 9 & 4 \\0 & 3 & 2\end(array)\right);\; B=\left(\begin(array) (c) -1\\0\\6\end(array)\right);\; X=\left(\begin(array) (c) x_1\\ x_2 \\ x_3 \end(array)\right). $$

Now it’s the turn to find the inverse matrix to the system matrix, i.e. find $A^(-1)$. In example No. 3 on the page dedicated to finding inverse matrices, the inverse matrix has already been found. Let's use the finished result and write $A^(-1)$:

$$ A^(-1)=\frac(1)(26)\cdot \left(\begin(array) (ccc) 6 & -5 & 1 \\ 8 & 2 & -16 \\ -12 & - 3 & 37\end(array)\right). $$

Now let's substitute all three matrices ($X$, $A^(-1)$, $B$) into the equality $X=A^(-1)\cdot B$, and then perform matrix multiplication on the right side of this equality.

$$ \left(\begin(array) (c) x_1\\ x_2 \\ x_3 \end(array)\right)= \frac(1)(26)\cdot \left(\begin(array) (ccc) 6 & -5 & 1 \\ 8 & 2 & -16 \\ -12 & -3 & 37\end(array) \right)\cdot \left(\begin(array) (c) -1\\0\ \6\end(array)\right)=\\ =\frac(1)(26)\cdot \left(\begin(array) (c) 6\cdot(-1)+(-5)\cdot 0 +1\cdot 6 \\ 8\cdot (-1)+2\cdot 0+(-16)\cdot 6 \\ -12\cdot (-1)+(-3)\cdot 0+37\cdot 6 \end(array)\right)=\frac(1)(26)\cdot \left(\begin(array) (c) 0\\-104\\234\end(array)\right)=\left( \begin(array) (c) 0\\-4\\9\end(array)\right) $$

So, we got the equality $\left(\begin(array) (c) x_1\\ x_2 \\ x_3 \end(array)\right)=\left(\begin(array) (c) 0\\-4\ \9\end(array)\right)$. From this equality we have: $x_1=0$, $x_2=-4$, $x_3=9$.

Purpose of the service. Using this online calculator, unknowns (x 1, x 2, ..., x n) are calculated in a system of equations. The decision is carried out inverse matrix method. Wherein:
  • the determinant of the matrix A is calculated;
  • through algebraic additions the inverse matrix A -1 is found;
  • a solution template is created in Excel;
The decision is carried out directly on the website (online) and is free. The calculation results are presented in a Word report (see sample format).

Instructions. To obtain a solution using the inverse matrix method, you need to specify the dimension of the matrix. Next, in a new dialog box, fill in the matrix A and the vector of results B.

Number of variables 2 3 4 5 6 7 8 9 10
See also Solving matrix equations.

Solution algorithm

  1. The determinant of the matrix A is calculated. If the determinant is zero, then the solution is over. The system has an infinite number of solutions.
  2. When the determinant is different from zero, the inverse matrix A -1 is found through algebraic additions.
  3. The solution vector X =(x 1, x 2, ..., x n) is obtained by multiplying the inverse matrix by the result vector B.
Example. Find a solution to the system using the matrix method. Let's write the matrix in the form:
Algebraic additions.
A 1,1 = (-1) 1+1
1 2
0 -2
∆ 1,1 = (1 (-2)-0 2) = -2

A 1,2 = (-1) 1+2
3 2
1 -2
∆ 1,2 = -(3 (-2)-1 2) = 8

A 1.3 = (-1) 1+3
3 1
1 0
∆ 1,3 = (3 0-1 1) = -1

A 2,1 = (-1) 2+1
-2 1
0 -2
∆ 2,1 = -(-2 (-2)-0 1) = -4

A 2,2 = (-1) 2+2
2 1
1 -2
∆ 2,2 = (2 (-2)-1 1) = -5

A 2,3 = (-1) 2+3
2 -2
1 0
∆ 2,3 = -(2 0-1 (-2)) = -2

A 3.1 = (-1) 3+1
-2 1
1 2
∆ 3,1 = (-2 2-1 1) = -5

·
3
-2
-1

X T = (1,0,1)
x 1 = -21 / -21 = 1
x 2 = 0 / -21 = 0
x 3 = -21 / -21 = 1
Examination:
2 1+3 0+1 1 = 3
-2 1+1 0+0 1 = -2
1 1+2 0+-2 1 = -1