1 solve the system using Cramer's formulas. Cramer's method: solving systems of linear algebraic equations (slough). Examples of solving systems of linear equations using the Cramer method

With the same number of equations 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 there is only one).

Cramer's theorem.

When the determinant of the matrix of a square system is non-zero, 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 system matrix, in which instead of i The th column contains the column of right sides.

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

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

Description of the Cramer method.

There is a system of equations:

A system of 3 equations can be solved using the Cramer method, which was discussed above for a system of 2 equations.

We compose a determinant from the coefficients of the unknowns:

It will be system determinant. When D≠0, which means the system is consistent. Now let's create 3 additional determinants:

,,

We solve the system by Cramer's formulas:

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

Example 1.

Given system:

Let's solve it using Cramer's method.

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

Because Δ≠0, which means that 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 Δ by replacing its first column with a column of free coefficients. We get:

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

Methods Kramer And Gauss- one of the most popular solution methods SLAU. In addition, in some cases it is advisable to use specific methods. The session is close, and now is the time to repeat or master them from scratch. Today we’ll look at the solution using Cramer’s method. After all, solving a system of linear equations using the Cramer method is a very useful skill.

Systems of linear algebraic equations

A system of linear algebraic equations is a system of equations of the form:

Value set x , in which the equations of the system turn into identities, is called a solution of the system, a And b are real coefficients. A simple system consisting of two equations with two unknowns can be solved in your head or by expressing one variable in terms of the other. But there can be much more than two variables (xes) in a SLAE, and here simple school manipulations are not enough. What to do? For example, solve SLAEs using Cramer's method!

So, let the system consist of n equations with n unknown.

Such a system can be rewritten in matrix form

Here A – the main matrix of the system, X And B , respectively, column matrices of unknown variables and free terms.

Solving SLAEs using Cramer's method

If the determinant of the main matrix is ​​not equal to zero (the matrix is ​​non-singular), the system can be solved using Cramer's method.

According to Cramer's method, the solution is found using the formulas:

Here delta is the determinant of the main matrix, and delta x nth – determinant obtained from the determinant of the main matrix by replacing the nth column with a column of free terms.

This is the whole essence of the Cramer method. Substituting the values ​​found using the above formulas x into the desired system, we are convinced of the correctness (or vice versa) of our solution. To help you quickly grasp the essence, we give below an example of a detailed solution of SLAE using Cramer’s method:

Even if you don't succeed the first time, don't be discouraged! With a little practice, you will start cracking SLAUs like nuts. Moreover, now it is absolutely not necessary to pore over a notebook, solving cumbersome calculations and writing up the core. You can easily solve SLAEs using Cramer's method online, just by substituting the coefficients into the finished form. You can try an online solution calculator using Cramer’s method, for example, on this website.


And if the system turns out to be stubborn and does not give up, you can always turn to our authors for help, for example, to buy a synopsis. If there are at least 100 unknowns in the system, we will definitely solve it correctly and on time!

This online calculator finds the solution to a system of linear equations (SLE) using the Cramer method. A detailed solution is given. To calculate, select the number of variables. Then enter the data into the cells and click on the "Calculate" button.

×

Warning

Clear all cells?

Close Clear

Data entry instructions. Numbers are entered as integers (examples: 487, 5, -7623, etc.), decimals (ex. 67., 102.54, etc.) or fractions. The fraction must be entered in the form a/b, where a and b (b>0) are integers or decimal numbers. Examples 45/5, 6.6/76.4, -7/6.7, etc.

Cramer method

The Cramer method is a method for solving a quadratic system of linear equations with a nonzero determinant of the main matrix. Such a system of linear equations has a unique solution.

Let the following system of linear equations be given:

Where A-main matrix of the system:

the first of which needs to be found, and the second is given.

Since we assume that the determinant Δ of the matrix A is different from zero, then there is an inverse to A matrix A-1 . Then multiplying identity (2) from the left by the inverse matrix A-1 , we get:

The inverse matrix has the following form:

Algorithm for solving a system of linear equations using the Cramer method

  1. Calculate the determinant Δ of the main matrix A.
  2. Replacing column 1 of a matrix A to the vector of free members b.
  3. Calculation of the determinant Δ 1 of the resulting matrix A 1 .
  4. Calculate Variable x 1 =Δ 1 /Δ.
  5. Repeat steps 2−4 for columns 2, 3, ..., n matrices A.

Examples of solving SLEs using Cramer's method

Example 1. Solve the following system of linear equations using the Cramer method:

Let's replace column 1 of the matrix A per column vector b:

Replace column 2 of the matrix A per column vector b:

Replace column 3 of the matrix A per column vector b:

The solution to a system of linear equations is calculated as follows:

Let's write it in matrix form: Ax=b, Where

We select the largest modulo leading element of column 2. To do this, we swap rows 2 and 4. In this case, the sign of the determinant changes to “−”.

We select the leading element of column 3, largest in modulus. To do this, we swap rows 3 and 4. In this case, the sign of the determinant changes to “+”.

We have reduced the matrix to upper triangular form. The determinant of the matrix is ​​equal to the product of all elements of the main diagonal:

To calculate the determinant of a matrix A 1, we reduce the matrix to upper triangular form, similar to the above procedure. We get the following matrix:

Replace column 2 of the matrix A per column vector b, we reduce the matrix to upper triangular form and calculate the determinant of the matrix:

,,,.

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

First, we will take a closer look at Cramer's rule for a system of two linear equations in two unknowns. For what? – After all, the simplest system can be solved using the school method, the method of term-by-term addition!

The fact is that, albeit sometimes, such a task occurs - to solve a system of two linear equations with two unknowns using Cramer's formulas. Secondly, 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 are advisable to solve using 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 using the formulas:
,

Example 7

Solve a system of linear equations

Solution: We see that the coefficients of the equation are quite large; on the right side there are decimal fractions with a comma. The comma is a rather rare guest in practical tasks 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 probably end up with terrible fancy fractions that are extremely inconvenient to work with, and the design of the solution will look simply terrible. You can multiply the second equation by 6 and subtract term by term, but the same fractions will arise here too.

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 commonplace) for econometrics problems.

Comments are not needed here, since the task is solved using ready-made formulas, however, there is one caveat. When using this method, compulsory A fragment of the task design is the following fragment: “This means that the system has a unique solution”. Otherwise, the reviewer may punish you for disrespect for Cramer's theorem.

It would not be superfluous to check, which can be conveniently carried out on a calculator: we substitute approximate values ​​into the left side of each equation of the system. As a result, with a small error, you should get numbers that are on the right sides.

Example 8

Present the answer in ordinary improper fractions. Do a check.

This is an example for you to solve on your own (an example of the final design and the answer at the end of the lesson).

Let's move on to consider Cramer's rule for a system of three equations with three unknowns:

We 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 Gauss 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 “three by three” case is fundamentally no different from the “two by two” case; the column of free terms 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 the system has a unique solution.

Answer: .

Actually, here again there is nothing special to comment on, due to the fact that the solution follows ready-made formulas. But there are a couple of comments.

It happens that as a result of calculations, “bad” irreducible fractions are obtained, for example: .
I recommend the following “treatment” algorithm. If you don’t have a computer at hand, do this:

1) There may be an error in the calculations. As soon as you encounter a “bad” fraction, you immediately need to check Is the condition rewritten correctly?. If the condition is rewritten without errors, then you need to recalculate the determinants using expansion in another row (column).

2) If no errors are identified as a result of checking, then most likely there was a typo in the task conditions. In this case, calmly and CAREFULLY work through the task to the end, and then be sure to check and we draw it up on a clean sheet after the decision. Of course, checking a fractional answer is an unpleasant task, but it will be a disarming argument for the teacher, who really likes to give a minus for any bullshit like . How to handle fractions is described in detail in the answer to Example 8.

If you have a computer at hand, then use an automated program to check, 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 where you made a mistake! The same calculator automatically calculates the solution of the system using the matrix method.

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

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

Example 10

Solve the system using Cramer's formulas.

This is an example for an independent solution (a sample of the final design 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. You can see a live example in the lesson Properties of Determinants. Reducing the order of the determinant - five 4th order determinants are quite solvable. Although the task is already very reminiscent of a professor’s shoe on the chest of a lucky student.


Solving the system using an inverse matrix

The inverse matrix method is essentially a special case matrix equation(See Example No. 3 of the specified lesson).

To study this section, you must be able to expand determinants, find the inverse of a matrix, and perform matrix multiplication. Relevant links will be provided as the explanations progress.

Example 11

Solve the system using the matrix method

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

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

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

First, let's look at the determinant:

Here the determinant is expanded on the first line.

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

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

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

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

During the solution, it is better to describe the calculation of minors in detail, although with some experience you can get used to calculating them with errors orally.

Cramer's method or the so-called Cramer's rule is a method of searching for 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 rows, 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 to 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 using Cramer's method, first of all we calculate the main determinant of the matrix $D$. When the calculated determinant of the main matrix, when calculated by Cramer's method, turns out to be equal to 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 use the Gaussian method.
  2. Then you need to replace the outermost column of the main matrix with a column of free terms and calculate the determinant $D_1$.
  3. Repeat the same for all columns, obtaining determinants from $D_1$ to $D_n$, where $n$ is the number of the rightmost column.
  4. After all determinants $D_1$...$D_n$ have been found, the unknown variables can be calculated using 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, reminiscent of the same rule. The essence of the triangle method is that when calculating the determinant, the products of all numbers connected in the figure by the red line on the right are written with a plus sign, and all numbers connected in a similar way in the figure on the left are written with a minus sign. Both rules are suitable for matrices of size 3 x 3. In the case of the Sarrus rule, the matrix itself is first rewritten, and next to it its first and second columns are rewritten again. Diagonals are drawn through the matrix and these additional columns; matrix members lying on the main diagonal or parallel to it are written with a plus sign, and elements lying on or parallel to the secondary diagonal are written with a minus sign.

Figure 1. Triangle rule for calculating the determinant for Cramer's method

  • Using a method known as the Gaussian method, this method is also sometimes called reducing the order of the determinant. In this case, the matrix is ​​transformed and reduced to triangular form, and then all the numbers on the main diagonal are multiplied. It should be remembered that when searching for a determinant in this way, you cannot multiply or divide rows or columns by numbers without taking them out as a multiplier or divisor. In the case of searching for a determinant, it is only possible to subtract and add rows and columns to each other, having previously multiplied the subtracted row by a non-zero factor. Also, whenever you rearrange the rows or columns of the matrix, you should remember the need to change the final sign of the matrix.
  • When solving a SLAE with 4 unknowns using the Cramer method, it is best to use the Gauss method to search and find determinants or determine the determinant by searching for minors.

Solving systems of equations using Cramer's method

Let's apply Cramer's method for a system of 2 equations and two required 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 expanded 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 equal to zero, then to solve the slough using Cramer’s method it is necessary to calculate a couple more determinants from two matrices with the columns of the main matrix replaced by a row 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 a main matrix of 3rd order (3 x 3) and three unknown 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 rule stated above under point 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 quantities:

$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)$



Read also: