Solving systems by the Kramer method examples. Linear Equations


2. Solving systems of equations by the matrix method (using the inverse matrix).
3. Gauss method for solving systems of equations.

Cramer's method.

Cramer's method is used to solve systems of linear algebraic equations (SLAU).

Formulas for the example of a system of two equations in two variables.
Given: Solve the system by Cramer's method

Variables NS and at.
Solution:
Let us find the determinant of the matrix, composed of the coefficients of the system Calculation of determinants. :




We apply Cramer's formulas and find the values ​​of the variables:
and .
Example 1:
Solve the system of equations:

regarding variables NS and at.
Solution:


Let's replace the first column in this determinant with the column of coefficients from the right-hand side of the system and find its value:

Let's do a similar action, replacing the second column in the first determinant:

Applicable Cramer's formulas and find the values ​​of the variables:
and .
Answer:
Comment: This method can be used to solve systems of higher dimensions.

Comment: If it turns out that, and it is impossible to divide by zero, then they say that the system does not have a single solution. In this case, the system has either infinitely many solutions or no solutions at all.

Example 2(infinite number of solutions):

Solve the system of equations:

regarding variables NS and at.
Solution:
Let us find the determinant of the matrix, composed of the coefficients of the system:

Solution of systems by substitution method.

The first of the equations in the system is equality, which is true for any values ​​of the variables (because 4 is always equal to 4). So there is only one equation left. This is the equation for the relationship between variables.
Obtained, the solution of the system is any pair of values ​​of variables related by equality.
Common decision will be written like this:
Particular solutions can be determined by choosing an arbitrary value of y and calculating x using this connection equality.

etc.
There are infinitely many such solutions.
Answer: common decision
Private solutions:

Example 3(no solutions, the system is incompatible):

Solve the system of equations:

Solution:
Let us find the determinant of the matrix, composed of the coefficients of the system:

Cramer's formulas cannot be applied. Let's solve this system by the substitution method

The second equation of the system is equality, which is not true for any values ​​of the variables (of course, since -15 is not equal to 2). If one of the equations of the system is not true for any values ​​of the variables, then the entire system has no solutions.
Answer: no solutions

Consider a system of 3 equations with three unknowns

Using determinants of the third order, the solution of such a system can be written in the same form as for a system of two equations, i.e.

(2.4)

if 0. Here

It is Cramer's rule solutions of the system of three linear equations with three unknowns.

Example 2.3. Solve a system of linear equations using Cramer's rule:

Solution ... Find the determinant of the main matrix of the system

Since 0, we can apply Cramer's rule to find a solution to the system, but we will first calculate three more determinants:

Examination:

Therefore, the solution was found correctly. 

Cramer's rules obtained for linear systems 2nd and 3rd order, suggest that the same rules can be formulated for linear systems of any order. Indeed takes place

Cramer's theorem. Quadratic system of linear equations with a nonzero determinant of the main matrix of the system (0) has one and only one solution, and this solution is calculated by the formulas

(2.5)

where  – determinant of the main matrix,  ideterminant of a matrix, derived from the main, replacementith column by the column of free members.

Note that if  = 0, then Cramer's rule does not apply. This means that the system either has no solutions at all, or has infinitely many solutions.

Having formulated Cramer's theorem, the question naturally arises of calculating determinants of higher orders.

2.4. Determinants of the nth order

Additional minor M ij element a ij is called the determinant obtained from the given by deleting i th line and j th column. Algebraic complement A ij element a ij is called the minor of this element, taken with a sign (–1) i + j, i.e. A ij = (–1) i + j M ij .

For example, find the minors and complements of the elements a 23 and a 31 determinants

We get

Using the concept of an algebraic complement, we can formulate Determinant Decomposition Theoremnth order by row or column.

Theorem 2.1. Determinant of a matrixAis equal to the sum of the products of all elements of a certain row (or column) by their algebraic complements:

(2.6)

This theorem underlies one of the main methods for calculating determinants, the so-called. order reduction method... As a result of the expansion of the determinant n-th order in any row or column, we get n determinants ( n–1) th order. To reduce the number of such determinants, it is advisable to select the row or column with the most zeros. In practice, the formula for the expansion of the determinant is usually written in the form:

those. algebraic complements are written explicitly in terms of minors.

Examples 2.4. Calculate determinants by first expanding them in any row or column. Typically, in such cases, select the column or row that has the most zeros. The selected row or column will be denoted by an arrow.

2.5. Basic properties of determinants

Expanding the determinant in any row or column, we get n determinants ( n–1) th order. Then each of these determinants ( n–1) -th order can also be expanded into the sum of determinants ( n–2) th order. Continuing this process, one can reach determinants of the 1st order, i.e. to the elements of the matrix, the determinant of which is calculated. So, to calculate the determinants of the 2nd order, it is necessary to calculate the sum of two terms, for determinants of the 3rd order - the sum of 6 terms, for determinants of the 4th order - 24 terms. The number of terms will increase sharply as the order of the determinant increases. This means that the calculation of determinants of very high orders becomes a rather laborious task, beyond the strength of even a computer. However, it is possible to calculate determinants in another way, using the properties of determinants.

Property 1 . The determinant will not change if the rows and columns are swapped in it, i.e. when transposed matrix:

.

This property indicates the equality of the rows and columns of the determinant. In other words, any statement about the columns of the determinant is true for its rows and vice versa.

Property 2 . The determinant changes sign when two rows (columns) are swapped.

Consequence . If the determinant has two identical rows (columns), then it is zero.

Property 3 . The common factor of all elements in any row (column) can be moved beyond the sign of the determinant.

For example,

Consequence . If all elements of some row (column) of the determinant are equal to zero, then the determinant itself is equal to zero.

Property 4 . The determinant will not change if to the elements of one row (column), add the elements of another row (column) multiplied by some number.

For example,

Property 5 . The determinant of the matrix product is equal to the product of the determinants of the matrices:

With the number of equations the same as the number of unknowns with the main determinant of the matrix, which is not equal to zero, the coefficients of the system (for such equations there is a solution and it is only one).

Cramer's theorem.

When the determinant of the matrix of a square system is nonzero, it means that the system is consistent and it has one solution and it can be found by Cramer's formulas:

where Δ - determinant of the system matrix,

Δ i is the determinant of the matrix of the system, in which instead of i The th column contains the column of the right-hand sides.

When the determinant of a system is zero, it means that the system can become joint or incompatible.

This method is usually used for small systems with large calculations and when it is necessary to determine one of the unknowns. The complexity of the method is that many determinants need to be calculated.

Description of Cramer's method.

There is a system of equations:

The system of 3 equations can be solved by the Cramer method, which was considered above for a system of 2 equations.

We compose the determinant from the coefficients of the unknowns:

This will system identifier... When D ≠ 0, then the system is compatible. Now let's compose 3 additional determinants:

,,

We solve the system of Cramer's formulas:

Examples of solving systems of equations by Cramer's method.

Example 1.

Given the system:

Let's solve it using Cramer's method.

First, you need to calculate the determinant of the matrix of the system:

Because Δ ≠ 0, hence from Cramer's theorem the system is consistent and it has one solution. We calculate additional determinants. The determinant Δ 1 is obtained from the determinant Δ, replacing its first column with the column of free coefficients. We get:

In the same way, we obtain the determinant Δ 2 from the determinant of the matrix of the system by replacing the second column with the column of free coefficients:

In order to master this paragraph, you must be able to open the qualifiers "two by two" and "three by three". If the qualifiers are bad, please study the lesson How to calculate the determinant?

First, we consider in detail Cramer's rule for a system of two linear equations in two unknowns. What for? - After all the simplest system can be solved by the school method, the method of term addition!

The fact is that, even if sometimes, such a task is encountered - to solve a system of two linear equations with two unknowns according to Cramer's formulas. Second, a simpler example will help you understand how to use Cramer's rule for a more complex case - a system of three equations with three unknowns.

In addition, there are systems of linear equations with two variables, which it is advisable to solve exactly according to Cramer's rule!

Consider the system of equations

At the first step, we calculate the determinant, it is called main determinant of the system.

Gauss method.

If, then the system has a unique solution, and to find the roots, we must calculate two more determinants:
and

In practice, the above qualifiers can also be denoted by a Latin letter.

We find the roots of the equation by the formulas:
,

Example 7

Solve a system of linear equations

Solution: We see that the coefficients of the equation are large enough, on the right side there are decimals with a comma. The comma is a rather rare guest in practical assignments in mathematics, I took this system from an econometric problem.

How to solve such a system? You can try to express one variable in terms of another, but in this case you will surely get terrible fancy fractions, which are extremely inconvenient to work with, and the design of the solution will look just awful. You can multiply the second equation by 6 and perform term-by-term subtraction, but the same fractions will appear here.

What to do? In such cases, Cramer's formulas come to the rescue.

;

;

Answer: ,

Both roots have infinite tails, and are found approximately, which is quite acceptable (and even common) for econometric problems.

Comments are not needed here, since the task is solved according to ready-made formulas, however, there is one caveat. When you use this method, compulsory a fragment of the assignment is the following fragment: "Which means that the system has the only solution"... Otherwise, the reviewer may punish you for disrespecting Cramer's theorem.

It will not be superfluous to check, which is convenient to carry out on a calculator: we substitute approximate values ​​into the left side of each equation in the system. As a result, with a small error, you should get numbers that are in the right parts.

Example 8

The answer is presented in ordinary irregular fractions. Make a check.

This is an example for independent decision(example of finishing and the answer at the end of the lesson).

We now turn to the consideration of Cramer's rule for a system of three equations with three unknowns:

Find the main determinant of the system:

If, then the system has infinitely many solutions or is inconsistent (has no solutions). In this case, Cramer's rule will not help; you need to use the Gaussian method.

If, then the system has a unique solution, and to find the roots, we must calculate three more determinants:
, ,

And finally, the answer is calculated using the formulas:

As you can see, the case "three by three" is fundamentally no different from the case "two by two", the column of free members sequentially "walks" from left to right along the columns of the main determinant.

Example 9

Solve the system using Cramer's formulas.

Solution: Let's solve the system using Cramer's formulas.

, which means that the system has a unique solution.

Answer: .

Actually, there is nothing special to comment on here again, in view of the fact that the decision is made according to ready-made formulas. But there are a couple of things to note.

It so happens that as a result of calculations "bad" irreducible fractions are obtained, for example:.
I recommend the following "cure" algorithm. If you don't have a computer at hand, we do this:

1) There may be a calculation error. As soon as you are faced with a "bad" fraction, you should immediately check is the condition rewritten correctly... If the condition is rewritten without errors, then it is necessary to recalculate the determinants using the expansion by another row (column).

2) If no errors were found as a result of checking, then most likely there was a typo in the task condition. In this case, calmly and CAREFULLY we solve the task to the end, and then be sure to check and make it out on a clean copy after the decision. Of course, checking a fractional answer is an unpleasant task, but it will be a disarming argument for a teacher who, well, very much loves to put a minus for any byaka like. How to handle fractions is detailed in the answer for Example 8.

If you have a computer at hand, then use an automated program to check it, which can be downloaded for free at the very beginning of the lesson. By the way, it is most profitable to use the program right away (even before starting the solution), you will immediately see the intermediate step at which you made a mistake! The same calculator automatically calculates the solution of the system matrix method.

Second remark. From time to time, there are systems in the equations of which some variables are missing, for example:

Here, the first equation is missing a variable, the second is missing a variable. In such cases, it is very important to correctly and CAREFULLY write down the main determinant:
- zeros are put in place of missing variables.
By the way, it is rational to open determinants with zeros according to the row (column) in which there is zero, since the calculations are much less.

Example 10

Solve the system using Cramer's formulas.

This is an example for an independent solution (a sample of finishing and the answer at the end of the lesson).

For the case of a system of 4 equations with 4 unknowns, Cramer's formulas are written according to similar principles. A live example can be found in the Determinant Properties lesson. Lowering the order of the determinant - five determinants of the 4th order are quite solvable. Although the task is already quite reminiscent of the professor's boot on the chest of a lucky student.


Solving the system using the inverse matrix

Method inverse matrix Is essentially a special case matrix equation(see Example # 3 of the specified lesson).

To study this section, you must be able to expand determinants, find the inverse matrix, and perform matrix multiplication. Relevant links will be provided along the way.

Example 11

Solve system with matrix method

Solution: Let's write the system in matrix form:
, where

Please take a look at the system of equations and the matrices. By what principle we write elements into matrices, I think everyone understands. The only comment: if some variables were missing in the equations, then zeros would have to be put in the corresponding places in the matrix.

We find the inverse matrix by the formula:
, where is the transposed matrix of algebraic complements of the corresponding elements of the matrix.

First, we deal with the determinant:

Here the qualifier is expanded on the first line.

Attention! If, then the inverse matrix does not exist, and it is impossible to solve the system by the matrix method. In this case, the system is solved by the method of elimination of unknowns (Gauss method).

Now you need to calculate 9 minors and write them into the matrix of minors

Reference: It is useful to know the meaning of double subscripts in linear algebra. The first digit is the line number in which this element is located. The second digit is the number of the column in which this element is located:

That is, a double subscript indicates that the item is on the first row, third column, and, for example, the item is on row 3, column 2

In the course of the solution, it is better to describe the calculation of the minors in detail, although, with some experience, they can be accustomed to counting with errors orally.

Cramer's method or the so-called Cramer's rule is a way of finding unknown quantities from systems of equations. It can be used only if the number of sought values ​​is equivalent to the number of algebraic equations in the system, that is, the main matrix formed from the system must be square and not contain zero lines, and also if its determinant must not be zero.

Theorem 1

Cramer's theorem If the main determinant $ D $ of the main matrix, compiled on the basis of the coefficients of the equations, is not equal to zero, then the system of equations is consistent, and it has a unique solution. The solution of such a system is calculated through the so-called Cramer formulas for solving systems of linear equations: $ x_i = \ frac (D_i) (D) $

What is the Cramer method

The essence of Cramer's method is as follows:

  1. To find a solution to the system by Cramer's method, we first calculate the main determinant of the matrix $ D $. When the calculated determinant of the main matrix, when calculated by Cramer's method, turned out to be zero, then the system does not have a single solution or has an infinite number of solutions. In this case, to find a general or some basic answer for the system, it is recommended to apply the Gaussian method.
  2. Then you need to replace the extreme column of the main matrix with a column of free members and calculate the determinant of $ D_1 $.
  3. Repeat the same for all columns, getting determinants from $ D_1 $ to $ D_n $, where $ n $ is the number of the rightmost column.
  4. After finding all the determinants of $ D_1 $ ... $ D_n $, you can calculate the unknown variables by the formula $ x_i = \ frac (D_i) (D) $.

Techniques for calculating the determinant of a matrix

To calculate the determinant of a matrix with a dimension greater than 2 by 2, you can use several methods:

  • The Rule of Triangles, or Sarrus's Rule, resembles the same rule. The essence of the triangle method is that when calculating the determinant of the product of all numbers connected in the figure with a red line on the right, they are written with a plus sign, and all numbers connected in the same way in the figure on the left - with a minus sign. B, both rules are suitable for 3 x 3 matrices. In the case of the Sarrus rule, the matrix itself is first rewritten, and next to it, next to it, its first and second columns are rewritten again. Diagonals are drawn through the matrix and these additional columns, the members of the matrix lying on the main diagonal or on the parallel to it are written with a plus sign, and the elements lying on the side diagonal or parallel to it are written with a minus sign.

Figure 1. The rule of triangles for calculating the determinant for Cramer's method

  • Using a technique known as the Gaussian method, this technique is also sometimes referred to as determinant de-ordering. In this case, the matrix is ​​transformed and reduced to a triangular form, and then all the numbers on the main diagonal are multiplied. It should be remembered that in such a search for a determinant, you cannot multiply or divide rows or columns by numbers without taking them out as a factor or divisor. In the case of searching for a determinant, it is only possible to subtract and add strings and pillars together, having previously multiplied the subtracted string by a nonzero factor. Also, with each permutation of rows or columns of the matrix in places, you should remember about the need to change the final sign of the matrix.
  • When solving SLAEs with 4 unknowns by Cramer's method, it is best to use the Gauss method to find and find determinants or to determine the determinants through the search for minors.

Solving systems of equations by Cramer's method

We apply Cramer's method for a system of 2 equations and two desired quantities:

$ \ begin (cases) a_1x_1 + a_2x_2 = b_1 \\ a_3x_1 + a_4x_2 = b_2 \\ \ end (cases) $

Let's display it in an extended form for convenience:

$ A = \ begin (array) (cc | c) a_1 & a_2 & b_1 \\ a_3 & a_4 & b_1 \\ \ end (array) $

Let's find the determinant of the main matrix, also called the main determinant of the system:

$ D = \ begin (array) (| cc |) a_1 & a_2 \\ a_3 & a_4 \\ \ end (array) = a_1 \ cdot a_4 - a_3 \ cdot a_2 $

If the main determinant is not zero, then to solve the slough by Cramer's method, it is necessary to calculate a couple more determinants from two matrices with replaced columns of the main matrix per line of free terms:

$ D_1 = \ begin (array) (| cc |) b_1 & a_2 \\ b_2 & a_4 \\ \ end (array) = b_1 \ cdot a_4 - b_2 \ cdot a_4 $

$ D_2 = \ begin (array) (| cc |) a_1 & b_1 \\ a_3 & b_2 \\ \ end (array) = a_1 \ cdot b_2 - a_3 \ cdot b_1 $

Now let's find the unknowns $ x_1 $ and $ x_2 $:

$ x_1 = \ frac (D_1) (D) $

$ x_2 = \ frac (D_2) (D) $

Example 1

Cramer's method for solving SLAEs with the main matrix of the 3rd order (3 x 3) and three required ones.

Solve the system of equations:

$ \ begin (cases) 3x_1 - 2x_2 + 4x_3 = 21 \\ 3x_1 + 4x_2 + 2x_3 = 9 \\ 2x_1 - x_2 - x_3 = 10 \\ \ end (cases) $

Let's calculate the main determinant of the matrix using the above rule under item number 1:

$ D = \ begin (array) (| ccc |) 3 & -2 & 4 \\ 3 & 4 & -2 \\ 2 & -1 & 1 \\ \ end (array) = 3 \ cdot 4 \ cdot ( -1) + 2 \ cdot (-2) \ cdot 2 + 4 \ cdot 3 \ cdot (-1) - 4 \ cdot 4 \ cdot 2 - 3 \ cdot (-2) \ cdot (-1) - (- 1) \ cdot 2 \ cdot 3 = - 12 - 8 -12 -32 - 6 + 6 = - 64 $

And now three other determinants:

$ D_1 = \ begin (array) (| ccc |) 21 & 2 & 4 \\ 9 & 4 & 2 \\ 10 & 1 & 1 \\ \ end (array) = 21 \ cdot 4 \ cdot 1 + (- 2) \ cdot 2 \ cdot 10 + 9 \ cdot (-1) \ cdot 4 - 4 \ cdot 4 \ cdot 10 - 9 \ cdot (-2) \ cdot (-1) - (-1) \ cdot 2 \ cdot 21 = - 84 - 40 - 36 - 160 - 18 + 42 = - $ 296

$ D_2 = \ begin (array) (| ccc |) 3 & 21 & 4 \\ 3 & 9 & 2 \\ 2 & 10 & 1 \\ \ end (array) = 3 \ cdot 9 \ cdot (- 1) + 3 \ cdot 10 \ cdot 4 + 21 \ cdot 2 \ cdot 2 - 4 \ cdot 9 \ cdot 2 - 21 \ cdot 3 \ cdot (-1) - 2 \ cdot 10 \ cdot 3 = - 27 + 120 + 84 - 72 + 63 - 60 = 108 $

$ D_3 = \ begin (array) (| ccc |) 3 & -2 & 21 \\ 3 & 4 & 9 \\ 2 & 1 & 10 \\ \ end (array) = 3 \ cdot 4 \ cdot 10 + 3 \ cdot (-1) \ cdot 21 + (-2) \ cdot 9 \ cdot 2 - 21 \ cdot 4 \ cdot 2 - (-2) \ cdot 3 \ cdot 10 - (-1) \ cdot 9 \ cdot 3 = 120 - 63 - 36 - 168 + 60 + 27 = - 60 $

Let's find the required values:

$ x_1 = \ frac (D_1) (D) = \ frac (- 296) (- 64) = 4 \ frac (5) (8) $

$ x_2 = \ frac (D_1) (D) = \ frac (108) (-64) = - 1 \ frac (11) (16) $

$ x_3 = \ frac (D_1) (D) = \ frac (-60) (-64) = \ frac (15) (16) $