Solve the equation using matrix calculus online. Matrix method online


In the first part, we looked at some theoretical material, the substitution method, as well as the method of term-by-term addition of system equations. I recommend everyone who accessed the site through this page to read the first part. Perhaps some visitors will find the material too simple, but as we solve the systems linear equations I made a number of very important comments and conclusions regarding the solution of mathematical problems in general.

Now we will analyze Cramer’s rule, as well as solving a system of linear equations using an inverse matrix (matrix method). All materials are presented simply, in detail and clearly; almost all readers will be able to learn how to solve systems using the above methods.

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 to more complex case– systems 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 only decision, 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 decimals with a comma. Comma - enough 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.

No comments are needed here, since the task is solved according to 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 independent decision(example of finishing and 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 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 algebraic additions corresponding matrix elements.

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

A system of m linear equations with n unknowns called a system of the form

Where a ij And b i (i=1,…,m; b=1,…,n) are some known numbers, and x 1 ,…,x n– unknown. In the designation of coefficients a ij first index i denotes the equation number, and the second j– the number of the unknown at which this coefficient stands.

We will write the coefficients for the unknowns in the form of a matrix , which we'll call matrix of the system.

The numbers on the right side of the equations are b 1 ,…,b m are called free members.

Totality n numbers c 1 ,…,c n called decision of a given system, if each equation of the system becomes an equality after substituting numbers into it c 1 ,…,c n instead of the corresponding unknowns x 1 ,…,x n.

Our task will be to find solutions to the system. In this case, three situations may arise:

A system of linear equations that has at least one solution is called joint. Otherwise, i.e. if the system has no solutions, then it is called non-joint.

Let's consider ways to find solutions to the system.


MATRIX METHOD FOR SOLVING SYSTEMS OF LINEAR EQUATIONS

Matrices make it possible to briefly write down a system of linear equations. Let a system of 3 equations with three unknowns be given:

Consider the system matrix and matrices columns of unknown and free terms

Let's find the work

those. as a result of the product, we obtain the left-hand sides of the equations of this system. Then using the definition of matrix equality this system can be written in the form

or shorter AX=B.

Here are the matrices A And B are known, and the matrix X unknown. It is necessary to find it, because... its elements are the solution to this system. This equation is called matrix equation.

Let the determinant of the matrix be different from zero | A| ≠ 0. Then matrix equation is solved as follows. Multiply both sides of the equation on the left by the matrix A-1, inverse of the matrix A: . Because the A -1 A = E And EX = X, then we obtain a solution to the matrix equation in the form X = A -1 B .

Note that since the inverse matrix can only be found for square matrices, the matrix method can only solve those systems in which the number of equations coincides with the number of unknowns. However, matrix recording of the system is also possible in the case when the number of equations is not equal to the number of unknowns, then the matrix A will not be square and therefore it is impossible to find a solution to the system in the form X = A -1 B.

Examples. Solve systems of equations.

CRAMER'S RULE

Consider a system of 3 linear equations with three unknowns:

Third-order determinant corresponding to the system matrix, i.e. composed of coefficients for unknowns,

called determinant of the system.

Let's compose three more determinants as follows: replace sequentially 1, 2 and 3 columns in the determinant D with a column of free terms

Then we can prove the following result.

Theorem (Cramer's rule). If the determinant of the system Δ ≠ 0, then the system under consideration has one and only one solution, and

Proof. So, let's consider a system of 3 equations with three unknowns. Let's multiply the 1st equation of the system by the algebraic complement A 11 element a 11, 2nd equation – on A 21 and 3rd – on A 31:

Let's add these equations:

Let's look at each of the brackets and the right side of this equation. By the theorem on the expansion of the determinant in elements of the 1st column

Similarly, it can be shown that and .

Finally, it is easy to notice that

Thus, we obtain the equality: .

Hence, .

The equalities and are derived similarly, from which the statement of the theorem follows.

Thus, we note that if the determinant of the system Δ ≠ 0, then the system has a unique solution and vice versa. If the determinant of the system is equal to zero, then the system either has an infinite number of solutions or has no solutions, i.e. incompatible.

Examples. Solve system of equations


GAUSS METHOD

The previously discussed methods can be used to solve only those systems in which the number of equations coincides with the number of unknowns, and the determinant of the system must be different from zero. The Gauss method is more universal and suitable for systems with any number of equations. It consists in the consistent elimination of unknowns from the equations of the system.

Consider again a system of three equations with three unknowns:

.

We will leave the first equation unchanged, and from the 2nd and 3rd we will exclude the terms containing x 1. To do this, divide the second equation by A 21 and multiply by – A 11, and then add it to the 1st equation. Similarly, we divide the third equation by A 31 and multiply by – A 11, and then add it with the first one. As a result, the original system will take the form:

Now from the last equation we eliminate the term containing x 2. To do this, divide the third equation by, multiply by and add with the second. Then we will have a system of equations:

From here, from the last equation it is easy to find x 3, then from the 2nd equation x 2 and finally, from 1st - x 1.

When using the Gaussian method, the equations can be swapped if necessary.

Often instead of writing new system equations, are limited to writing out the extended matrix of the system:

and then bring it to a triangular or diagonal form using elementary transformations.

TO elementary transformations matrices include the following transformations:

  1. rearranging rows or columns;
  2. multiplying a string by a number other than zero;
  3. adding other lines to one line.

Examples: Solve systems of equations using the Gauss method.


Thus, the system has an infinite number of solutions.

Equations in general, linear algebraic equations and their systems, as well as methods for solving them, occupy a special place in mathematics, both theoretical and applied.

This is due to the fact that the vast majority of physical, economic, technical and even pedagogical problems can be described and solved using a variety of equations and their systems. IN Lately has gained particular popularity among researchers, scientists and practitioners math modeling in almost all subject areas, which is explained by its obvious advantages over other known and proven methods for studying objects of various natures, in particular, the so-called complex systems. There is a great variety of different definitions of a mathematical model given by scientists at different times, but in our opinion, the most successful is the following statement. Mathematical model is an idea expressed by an equation. Thus, the ability to compose and solve equations and their systems is an integral characteristic of a modern specialist.

To solve systems of linear algebraic equations, the most commonly used methods are Cramer, Jordan-Gauss and the matrix method.

Matrix solution method is a method for solving systems of linear algebraic equations with a nonzero determinant using an inverse matrix.

If we write out the coefficients for the unknown quantities xi in matrix A, collect the unknown quantities in the vector column X, and the free terms in the vector column B, then the system of linear algebraic equations can be written in the form of the following matrix equation A · X = B, which has a unique solution only when the determinant of matrix A is not equal to zero. In this case, the solution to the system of equations can be found in the following way X = A-1 · B, Where A -1 - inverse matrix.

The matrix solution method is as follows.

Let us be given a system of linear equations with n unknown:

It can be rewritten in 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 - matrix inverse of matrix A: A -1 (AX) = A -1 B

Because A -1 A = E, we get X= A -1 B. The right side of this equation will give the solution column of the original system. The condition for the applicability of this method (as well as the general existence of a solution to an inhomogeneous system of linear equations with the number of equations equal to the number of unknowns) is the nondegeneracy of the matrix A. A necessary and sufficient condition for this is that the determinant of the matrix is ​​not equal to zero A:det A≠ 0.

For a homogeneous system of linear equations, that is, when the vector B = 0 , indeed the opposite rule: the system AX = 0 has a non-trivial (that is, non-zero) solution only if det A= 0. Such a connection between solutions of homogeneous and inhomogeneous systems of linear equations is called the Fredholm alternative.

Example solutions to an inhomogeneous system of linear algebraic equations.

Let us make sure that the determinant of the matrix, composed of the coefficients of the unknowns of the system of linear algebraic equations, is not equal to zero.

The next step is to calculate the algebraic complements for the elements of the matrix consisting of the coefficients of the unknowns. They will be needed to find the inverse matrix.

This is a concept that summarizes everything possible operations, produced with matrices. Mathematical matrix - table of elements. About a table where m lines and n columns, this matrix is ​​said to have the dimension m on n.

General view of the matrix:

For matrix solutions It is necessary to understand what a matrix is ​​and know its main parameters. Main elements of the matrix:

  • The main diagonal, consisting of elements a 11, a 22…..a mn.
  • Side diagonal consisting of elements a 1n , a 2n-1 .....a m1.

Main types of matrices:

  • Square is a matrix where the number of rows = the number of columns ( m=n).
  • Zero - where all matrix elements = 0.
  • Transposed matrix - matrix IN, which was obtained from the original matrix A by replacing rows with columns.
  • Unity - all elements of the main diagonal = 1, all others = 0.
  • An inverse matrix is ​​a matrix that, when multiplied by the original matrix, results in an identity matrix.

The matrix can be symmetrical with respect to the main and secondary diagonals. That is, if a 12 = a 21, a 13 =a 31,….a 23 =a 32…. a m-1n =a mn-1, then the matrix is ​​symmetrical about the main diagonal. Only square matrices can be symmetric.

Methods for solving matrices.

Almost all matrix solving methods consist in finding its determinant n-th order and most of them are quite cumbersome. To find the determinant of the 2nd and 3rd order there are other, more rational methods.

Finding 2nd order determinants.

To calculate the determinant of a matrix A 2nd order, it is necessary to subtract the product of the elements of the secondary diagonal from the product of the elements of the main diagonal:

Methods for finding 3rd order determinants.

Below are the rules for finding the 3rd order determinant.

Simplified rule of triangle as one of matrix solving methods, can be depicted this way:

In other words, the product of elements in the first determinant that are connected by straight lines is taken with a “+” sign; Also, for the 2nd determinant, the corresponding products are taken with the “-” sign, that is, according to the following scheme:

At solving matrices using Sarrus' rule, to the right of the determinant, add the first 2 columns and the products of the corresponding elements on the main diagonal and on the diagonals that are parallel to it are taken with a “+” sign; and the products of the corresponding elements of the secondary diagonal and the diagonals that are parallel to it, with the sign “-”:

Decomposing the determinant in a row or column when solving matrices.

The determinant is equal to the sum of the products of the elements of the row of the determinant and their algebraic complements. Typically, the row/column that contains zeros is selected. The row or column along which the decomposition is carried out will be indicated by an arrow.

Reducing the determinant to triangular form when solving matrices.

At solving matrices method of reducing the determinant to a triangular form, they work like this: using the simplest transformations on rows or columns, the determinant becomes triangular in form and then its value, in accordance with the properties of the determinant, will be equal to the product of the elements that are on the main diagonal.

Laplace's theorem for solving matrices.

When solving matrices using Laplace's theorem, you need to know the theorem itself. Laplace's theorem: Let Δ - this is a determinant n-th order. We select any k rows (or columns), provided kn - 1. In this case, the sum of the products of all minors k-th order contained in the selected k rows (columns), by their algebraic complements will be equal to the determinant.

Solving the inverse matrix.

Sequence of actions for inverse matrix solutions:

  1. Determine whether a given matrix is ​​square. If the answer is negative, it becomes clear that there cannot be an inverse matrix for it.
  2. We calculate algebraic complements.
  3. We compose a union (mutual, adjoint) matrix C.
  4. We compose the inverse matrix from algebraic additions: all elements of the adjoint matrix C divide by the determinant of the initial matrix. The final matrix will be the required inverse matrix relative to the given one.
  5. We check the work done: multiply the initial matrix and the resulting matrix, the result should be an identity matrix.

Solving matrix systems.

For solutions of matrix systems The Gaussian method is most often used.

The Gauss method is a standard method for solving systems of linear algebraic equations (SLAEs) and it consists in the fact that variables are sequentially eliminated, i.e., with the help of elementary changes, the system of equations is brought to an equivalent system of triangular form and from it, sequentially, starting from the latter (by number), find each element of the system.

Gauss method is the most versatile and the best tool to find the solution of the matrices. If a system has an infinite number of solutions or the system is incompatible, then it cannot be solved using Cramer’s rule and the matrix method.

The Gauss method also implies direct (reducing the extended matrix to a stepwise form, i.e., obtaining zeros under the main diagonal) and reverse (obtaining zeros above the main diagonal of the extended matrix) moves. The forward move is the Gauss method, the reverse move is the Gauss-Jordan method. The Gauss-Jordan method differs from the Gauss method only in the sequence of eliminating variables.

(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$.

Editor's Choice
Your Zodiac sign makes up only 50% of your personality. The remaining 50% cannot be known by reading general horoscopes. You need to create an individual...

Description of the white mulberry plant. Composition and calorie content of berries, beneficial properties and expected harm. Delicious recipes and uses...

Like most of his colleagues, Soviet children's writers and poets, Samuil Marshak did not immediately begin writing for children. He was born in 1887...

Breathing exercises using the Strelnikova method help cope with attacks of high blood pressure. Correct execution of exercises -...
About the university Bryansk State University named after academician I.G. Petrovsky is the largest university in the region, with more than 14...