How to set up smartphones and PCs. Informational portal

Large power matrix how to find. Matrix exponentiation

Matrix A -1 is called the inverse matrix with respect to matrix A, if A * A -1 \u003d E, where E is the identity matrix of the nth order. The inverse matrix can only exist for square matrices.

Service assignment. Using this service online, you can find algebraic additions, transposed matrix A T , union matrix and inverse matrix. The solution is carried out directly on the site (online) and is free. The calculation results are presented in a report in Word format and in Excel format (that is, it is possible to check the solution). see design example.

Instruction. To obtain a solution, you must specify the dimension of the matrix. Next, in the new dialog box, fill in the matrix A .

Matrix dimension 2 3 4 5 6 7 8 9 10

See also Inverse Matrix by the Jordan-Gauss Method

Algorithm for finding the inverse matrix

  1. Finding the transposed matrix A T .
  2. Definition of algebraic additions. Replace each element of the matrix with its algebraic complement.
  3. Compilation of an inverse matrix from algebraic additions: each element of the resulting matrix is ​​divided by the determinant of the original matrix. The resulting matrix is ​​the inverse of the original matrix.
Next inverse matrix algorithm similar to the previous one, except for some steps: first, the algebraic complements are calculated, and then the union matrix C is determined.
  1. Determine if the matrix is ​​square. If not, then there is no inverse matrix for it.
  2. Calculation of the determinant of the matrix A . If it is not equal to zero, we continue the solution, otherwise, the inverse matrix does not exist.
  3. Definition of algebraic additions.
  4. Filling in the union (mutual, adjoint) matrix C .
  5. Compilation of the inverse matrix from algebraic additions: each element of the adjoint matrix C is divided by the determinant of the original matrix. The resulting matrix is ​​the inverse of the original matrix.
  6. Make a check: multiply the original and the resulting matrices. The result should be an identity matrix.

Example #1. We write the matrix in the form:


Algebraic additions.
A 1.1 = (-1) 1+1
-1 -2
5 4

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

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

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

∆ 2,1 = -(2 4-5 3) = 7
A 2.2 = (-1) 2+2
-1 3
-2 4

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

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

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

∆ 3,2 = -(-1 (-2)-2 3) = 4
A 3.3 = (-1) 3+3
-1 2
2 -1

∆ 3,3 = (-1 (-1)-2 2) = -3
Then inverse matrix can be written as:
A -1 = 1 / 10
6 -4 8
7 2 1
-1 4 -3

A -1 =
0,6 -0,4 0,8
0,7 0,2 0,1
-0,1 0,4 -0,3

Another algorithm for finding the inverse matrix

We present another scheme for finding the inverse matrix.
  1. Find the determinant of the given square matrix A .
  2. We find algebraic additions to all elements of the matrix A .
  3. We write the algebraic complements of the elements of the rows into the columns (transposition).
  4. We divide each element of the resulting matrix by the determinant of the matrix A .
As you can see, the transposition operation can be applied both at the beginning, over the original matrix, and at the end, over the resulting algebraic additions.

A special case: The inverse, with respect to the identity matrix E , is the identity matrix E .

Here we will continue the topic of operations on matrices that we started in the first part and analyze a couple of examples in which we need to apply several operations at once.

Raising a matrix to a power.

Let k be a non-negative integer. For any square matrix $A_(n\times n)$ we have: $$ A^k=\underbrace(A\cdot A\cdot \ldots \cdot A)_(k \; times) $$

Here we assume that $A^0=E$, where $E$ is the identity matrix of the corresponding order.

Example #4

The matrix $ A=\left(\begin(array) (cc) 1 & 2 \\ -1 & -3 \end(array) \right)$ is given. Find matrices $A^2$ and $A^6$.

According to the definition of $A^2=A\cdot A$, i.e. to find $A^2$ we just need to multiply the matrix $A$ by itself. The operation of matrix multiplication was considered in the first part of the topic, so here we simply write down the solution process without detailed explanations:

$$ A^2=A\cdot A=\left(\begin(array) (cc) 1 & 2 \\ -1 & -3 \end(array) \right)\cdot \left(\begin(array) (cc) 1 & 2 \\ -1 & -3 \end(array) \right)= \left(\begin(array) (cc) 1\cdot 1+2\cdot (-1) & 1\cdot 2 +2\cdot (-3) \\ -1\cdot 1+(-3)\cdot (-1) & -1\cdot 2+(-3)\cdot (-3) \end(array) \right )= \left(\begin(array) (cc) -1 & -4 \\ 2 & 7 \end(array) \right). $$

To find the matrix $A^6$ we have two options. Option one: it is trivial to continue multiplying $A^2$ by the matrix $A$:

$$ A^6=A^2\cdot A\cdot A\cdot A\cdot A. $$

However, it is possible to go in a slightly simpler way, using the associativity property of matrix multiplication. Let's place brackets in the expression for $A^6$:

$$ A^6=A^2\cdot A\cdot A\cdot A\cdot A=A^2\cdot (A\cdot A)\cdot (A\cdot A)=A^2\cdot A^2 \cdot A^2. $$

If the solution of the first method would require four multiplication operations, then for the second method - only two. So let's go the second way:

$$ A^6=A^2\cdot A^2\cdot A^2=\left(\begin(array) (cc) -1 & -4 \\ 2 & 7 \end(array) \right)\ cdot \left(\begin(array) (cc) -1 & -4 \\ 2 & 7 \end(array) \right)\cdot \left(\begin(array) (cc) -1 & -4 \\ 2 & 7 \end(array) \right)=\\= \left(\begin(array) (cc) -1\cdot (-1)+(-4)\cdot 2 & -1\cdot (-4 )+(-4)\cdot 7 \\ 2\cdot (-1)+7\cdot 2 & 2\cdot (-4)+7\cdot 7 \end(array) \right)\cdot \left(\ begin(array) (cc) -1 & -4 \\ 2 & 7 \end(array) \right)= \left(\begin(array) (cc) -7 & -24 \\ 12 & 41 \end( array) \right)\cdot \left(\begin(array) (cc) -1 & -4 \\ 2 & 7 \end(array) \right)=\\= \left(\begin(array) (cc ) -7\cdot(-1)+(-24)\cdot 2 & -7\cdot (-4)+(-24)\cdot 7 \\ 12\cdot (-1)+41\cdot 2 & 12 \cdot (-4)+41\cdot 7 \end(array) \right)= \left(\begin(array) (cc) -41 & -140 \\ 70 & 239 \end(array) \right). $$

Answer: $A^2=\left(\begin(array) (cc) -1 & -4 \\ 2 & 7 \end(array) \right)$, $A^6=\left(\begin(array) (cc) -41 & -140 \\ 70 & 239 \end(array) \right)$.

Example #5

Given matrices $ A=\left(\begin(array) (cccc) 1 & 0 & -1 & 2 \\ 3 & -2 & 5 & 0 \\ -1 & 4 & -3 & 6 \end(array) \right)$, $ B=\left(\begin(array) (ccc) -9 & 1 & 0 \\ 2 & -1 & 4 \\ 0 & -2 & 3 \\ 1 & 5 & 0 \end (array) \right)$, $ C=\left(\begin(array) (ccc) -5 & -20 & 13 \\ 10 & 12 & 9 \\ 3 & -15 & 8 \end(array) \ right)$. Find the matrix $D=2AB-3C^T+7E$.

We start calculating the matrix $D$ by finding the result of the product $AB$. Matrices $A$ and $B$ can be multiplied because the number of columns of matrix $A$ is equal to the number of rows of matrix $B$. Denote $F=AB$. In this case, the matrix $F$ will have three columns and three rows, i.e. will be square (if this derivation seems non-obvious, see the description of matrix multiplication in the first part of this topic). Find the matrix $F$ by calculating all its elements:

$$ F=A\cdot B=\left(\begin(array) (cccc) 1 & 0 & -1 & 2 \\ 3 & -2 & 5 & 0 \\ -1 & 4 & -3 & 6 \ end(array) \right)\cdot \left(\begin(array) (ccc) -9 & 1 & 0 \\ 2 & -1 & 4 \\ 0 & -2 & 3 \\ 1 & 5 & 0 \ end(array) \right)\\ \begin(aligned) & f_(11)=1\cdot (-9)+0\cdot 2+(-1)\cdot 0+2\cdot 1=-7; \\ & f_(12)=1\cdot 1+0\cdot (-1)+(-1)\cdot (-2)+2\cdot 5=13; \\ & f_(13)=1\cdot 0+0\cdot 4+(-1)\cdot 3+2\cdot 0=-3;\\ \\ & f_(21)=3\cdot (-9 )+(-2)\cdot 2+5\cdot 0+0\cdot 1=-31;\\ & f_(22)=3\cdot 1+(-2)\cdot (-1)+5\cdot (-2)+0\cdot 5=-5;\\ & f_(23)=3\cdot 0+(-2)\cdot 4+5\cdot 3+0\cdot 0=7;\\ \\ & f_(31)=-1\cdot (-9)+4\cdot 2+(-3)\cdot 0+6\cdot 1=23; \\ & f_(32)=-1\cdot 1+4\cdot (-1)+(-3)\cdot (-2)+6\cdot 5=31;\\ & f_(33)=-1 \cdot 0+4\cdot 4+(-3)\cdot 3+6\cdot 0=7. \end(aligned) $$

So $F=\left(\begin(array) (ccc) -7 & 13 & -3 \\ -31 & -5 & 7 \\ 23 & 31 & 7 \end(array) \right)$. Let's go further. The matrix $C^T$ is the transposed matrix for the matrix $C$, i.e. $ C^T=\left(\begin(array) (ccc) -5 & 10 & 3 \\ -20 & 12 & -15 \\ 13 & 9 & 8 \end(array) \right) $. As for the matrix $E$, it is the identity matrix. In this case, the order of this matrix is ​​three, i.e. $E=\left(\begin(array) (ccc) 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end(array) \right)$.

In principle, we can go further step by step, but it is better to consider the remaining expression as a whole, without being distracted by auxiliary actions. In fact, we are left with only the operations of multiplying matrices by a number, as well as the operations of addition and subtraction.

$$ D=2AB-3C^T+7E=2\cdot \left(\begin(array) (ccc) -7 & 13 & -3 \\ -31 & -5 & 7 \\ 23 & 31 & 7 \ end(array) \right)-3\cdot \left(\begin(array) (ccc) -5 & 10 & 3 \\ -20 & 12 & -15 \\ 13 & 9 & 8 \end(array) \ right)+7\cdot \left(\begin(array) (ccc) 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end(array) \right) $$

Let's multiply the matrices on the right side of the equality by the corresponding numbers (i.e. by 2, 3 and 7):

$$ 2\cdot \left(\begin(array) (ccc) -7 & 13 & -3 \\ -31 & -5 & 7 \\ 23 & 31 & 7 \end(array) \right)-3\ cdot \left(\begin(array) (ccc) -5 & 10 & 3 \\ -20 & 12 & -15 \\ 13 & 9 & 8 \end(array) \right)+7\cdot \left(\ begin(array) (ccc) 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end(array) \right)=\\= \left(\begin(array) (ccc) - 14 & 26 & -6 \\ -62 & -10 & 14 \\ 46 & 62 & 14 \end(array) \right)-\left(\begin(array) (ccc) -15 & 13 & 9 \\ -60 & 36 & -45 \\ 39 & 27 & 24 \end(array) \right)+\left(\begin(array) (ccc) 7 & 0 & 0 \\ 0 & 7 & 0 \\ 0 & 0 & 7 \end(array) \right) $$

Let's do the last steps: subtraction and addition:

$$ \left(\begin(array) (ccc) -14 & 26 & -6 \\ -62 & -10 & 14 \\ 46 & 62 & 14 \end(array) \right)-\left(\begin (array) (ccc) -15 & 30 & 9 \\ -60 & 36 & -45 \\ 39 & 27 & 24 \end(array) \right)+\left(\begin(array) (ccc) 7 & 0 & 0 \\ 0 & 7 & 0 \\ 0 & 0 & 7 \end(array) \right)=\\ =\left(\begin(array) (ccc) -14-(-15)+7 & 26-30+0 & -6-9+0 \\ -62-(-60)+0 & -10-36+7 & 14-(-45)+0 \\ 46-39+0 & 62-27 +0 & 14-24+7 \end(array) \right)= \left(\begin(array) (ccc) 8 & -4 & -15 \\ -2 & -39 & 59 \\ 7 & 35 & -3 \end(array)\right). $$

Problem solved, $D=\left(\begin(array) (ccc) 8 & -4 & -15 \\ -2 & -39 & 59 \\ 7 & 35 & -3 \end(array) \right)$ .

Answer: $D=\left(\begin(array) (ccc) 8 & -4 & -15 \\ -2 & -39 & 59 \\ 7 & 35 & -3 \end(array) \right)$.

Example #6

Let $f(x)=2x^2+3x-9$ and matrix $ A=\left(\begin(array) (cc) -3 & 1 \\ 5 & 0 \end(array) \right) $. Find the value of $f(A)$.

If $f(x)=2x^2+3x-9$, then $f(A)$ is a matrix:

$$ f(A)=2A^2+3A-9E. $$

This is how a polynomial in a matrix is ​​defined. So, we need to substitute the matrix $A$ into the expression for $f(A)$ and get the result. Since all the actions were analyzed in detail earlier, here I will simply give a solution. If the process of performing the operation $A^2=A\cdot A$ is not clear to you, then I advise you to look at the description of matrix multiplication in the first part of this topic.

$$ f(A)=2A^2+3A-9E=2A\cdot A+3A-9E=2 \left(\begin(array) (cc) -3 & 1 \\ 5 & 0 \end(array) \right)\cdot \left(\begin(array) (cc) -3 & 1 \\ 5 & 0 \end(array) \right)+3 \left(\begin(array) (cc) -3 & 1 \\ 5 & 0 \end(array) \right)-9\left(\begin(array) (cc) 1 & 0 \\ 0 & 1 \end(array) \right)=\\ =2 \left( \begin(array) (cc) (-3)\cdot(-3)+1\cdot 5 & (-3)\cdot 1+1\cdot 0 \\ 5\cdot(-3)+0\cdot 5 & 5\cdot 1+0\cdot 0 \end(array) \right)+3 \left(\begin(array) (cc) -3 & 1 \\ 5 & 0 \end(array) \right)-9 \left(\begin(array) (cc) 1 & 0 \\ 0 & 1 \end(array) \right)=\\ =2 \left(\begin(array) (cc) 14 & -3 \\ - 15 & 5 \end(array) \right)+3 \left(\begin(array) (cc) -3 & 1 \\ 5 & 0 \end(array) \right)-9\left(\begin(array ) (cc) 1 & 0 \\ 0 & 1 \end(array) \right) =\left(\begin(array) (cc) 28 & -6 \\ -30 & 10 \end(array) \right) +\left(\begin(array) (cc) -9 & 3 \\ 15 & 0 \end(array) \right)-\left(\begin(array) (cc) 9 & 0 \\ 0 & 9 \ end(array) \right)=\left(\begin(array) (cc) 10 & -3 \\ -15 & 1 \end(array) \right). $$

Answer: $f(A)=\left(\begin(array) (cc) 10 & -3 \\ -15 & 1 \end(array) \right)$.

How to insert mathematical formulas on the site?

If you ever need to add one or two mathematical formulas to a web page, then the easiest way to do this is as described in the article: mathematical formulas are easily inserted into the site in the form of pictures that Wolfram Alpha automatically generates. In addition to simplicity, this universal method will help improve the visibility of the site in search engines. It has been working for a long time (and I think it will work forever), but it is morally outdated.

If, on the other hand, you constantly use mathematical formulas on your site, then I recommend that you use MathJax, a special JavaScript library that displays mathematical notation in web browsers using MathML, LaTeX, or ASCIIMathML markup.

There are two ways to start using MathJax: (1) using a simple code, you can quickly connect a MathJax script to your site, which will be automatically loaded from a remote server at the right time (list of servers); (2) upload the MathJax script from a remote server to your server and connect it to all pages of your site. The second method is more complicated and time consuming and will allow you to speed up the loading of your site's pages, and if the parent MathJax server becomes temporarily unavailable for some reason, this will not affect your own site in any way. Despite these advantages, I chose the first method, as it is simpler, faster and does not require technical skills. Follow my example, and within 5 minutes you will be able to use all the features of MathJax on your site.

You can connect the MathJax library script from a remote server using two code options taken from the main MathJax website or from the documentation page:

One of these code options needs to be copied and pasted into the code of your web page, preferably between the tags and or right after the tag . According to the first option, MathJax loads faster and slows down the page less. But the second option automatically tracks and loads the latest versions of MathJax. If you insert the first code, then it will need to be updated periodically. If you paste the second code, then the pages will load more slowly, but you will not need to constantly monitor MathJax updates.

The easiest way to connect MathJax is in Blogger or WordPress: in the site control panel, add a widget designed to insert third-party JavaScript code, copy the first or second version of the load code presented above into it, and place the widget closer to the beginning of the template (by the way, this is not at all necessary , since the MathJax script is loaded asynchronously). That's all. Now learn the MathML, LaTeX, and ASCIIMathML markup syntax and you're ready to embed math formulas into your web pages.

Any fractal is built according to a certain rule, which is consistently applied an unlimited number of times. Each such time is called an iteration.

The iterative algorithm for constructing a Menger sponge is quite simple: the original cube with side 1 is divided by planes parallel to its faces into 27 equal cubes. One central cube and 6 cubes adjacent to it along the faces are removed from it. It turns out a set consisting of 20 remaining smaller cubes. Doing the same with each of these cubes, we get a set consisting of 400 smaller cubes. Continuing this process indefinitely, we get the Menger sponge.

The operation of raising to the power n can be formally applied to square matrices. For this, n must be an integer. The result of this operation is given in table. 9.1. You can enter the operator for raising a matrix m to the power n in the same way as for a scalar value: by clicking the Raise to Power button on the Calculator panel (Calculator) or by pressing the key<А>. After the placeholder appears, enter the value of the power n into it.

Table 9.1. Results of raising a matrix to a power

0 identity matrix of the dimension of the matrix M

1 matrix M itself

1 M -1 - matrix inverse of M

2,3,... MM, (MM)M, ...

2, -3, ... M -1 M -1 , (M -1 M -1)M -1 , ...

Some examples of raising matrices to a power are shown in Listing 9.15.

Listing 9.15. Examples of raising a square matrix to an integer power

Array vectorization

Mathcad vector algebra includes a somewhat unusual operator called the vectorize operator. This operator is intended, as a rule, to work with arrays. It allows you to perform the same type of operation on all elements of an array (i.e., a matrix or vector), thereby simplifying loop programming. For example, sometimes it is required to multiply each element of one vector by the corresponding element of another vector. There is no such operation directly in Mathcad, but it is easy to implement using vectorization (Listing 9.16). For this:

· Enter a vector expression as shown in the second line of the listing (note that in this form the multiplication symbol denotes the operator of the dot product of vectors).

· Move the cursor so that the input lines highlight the entire expression that you want to vectorize (Fig. 9.3).

· Enter the vectorization operator by pressing the button Vectorize (Vectorization) on the panel Matrix (Matrix) (Fig. 9.3), or by using a keyboard shortcut +<->.

Enter<=>to get the result.

Rice. 9.3. Vectorization operator

Listing 9.16. Using Vectorization to Multiply Vector Elements



The vectorize operator can only be used with vectors and matrices of the same size.

Most non-specific Mathcad functions do not require vectorization to perform the same operation on all vector elements. For example, the argument of trigonometric functions is, by definition, a scalar. If you try to calculate the sine of a vector quantity, Mathcad will default to vectorization by calculating the sine of each element and returning the corresponding vector as the result. An example is shown in Listing 9.17.

Listing 9.17. Vectorization is optional for most Mathcad functions

Symbolic Matrix Operations

All matrix and vector operators discussed above can be used in symbolic calculations. The power of symbolic operations lies in the ability to perform them not only on specific numbers, but also on variables. A few examples are shown in Listing 9.18.

Listing 9.18. Examples of symbolic operations on vectors and matrices

Feel free to use the symbolic processor as a powerful mathematical reference. For example, when you want to recall some definition from the field of linear algebra (for example, the rules for multiplication and matrix inversion are shown in the first lines of listing 9.18).

Matrix functions

We list the main built-in functions designed to facilitate the work with vectors and matrices. They are needed for creating matrices, merging and extracting part of matrices, obtaining the main properties of matrices, etc.

Matrix creation functions

The most obvious way to create a matrix or vector is to use the first button on the Matrix toolbar. However, in most cases, in particular when programming complex projects, it is more convenient to create arrays using built-in functions.

Determining Matrix Elements Through a Function

matrix(M,N,f) - creating a matrix of size M*N, each i, j element of which is f(i, j) (Listing 9.19);

o M - number of lines;

o N - number of columns;

o f (i, j) - function.

Listing 9.19. Creating a Matrix

To create matrices, there are two more specific functions that are used mainly for the quick and effective presentation of any dependencies in the form of three-dimensional graphs (such as a surface or a spatial curve). All of their arguments except the first one (the function) are optional. Let's consider the first of the functions.

· СgeateSpace(F(or f1, f2, f3), t0, t1, tgrid, fmap) - creating a nested array representing the x-, y- and z-coordinates of the parametric spatial curve given by the p function;

      • F(t) is a three-element vector function defined parametrically with respect to a single argument t;
      • f1(t) ,f2(t), f3(t) - scalar functions;
      • t0 - lower limit t (default -5);
      • t1 - upper limit t (default 5);
      • tgrid - number of grid points by variable t (default 2о);
      • fmap is a three-argument vector function specifying a coordinate transformation.

Rice. 9.4. Using the CreateSpace function with a different set of parameters

An example of using the CreateSpace function is shown in fig. 9.4. Note that no additional code was required to plot the spiral, except for defining the parametric dependence in the vector function F.

The function to create a matrix for a 3D surface plot is exactly the same, with the exception that not one, but two variables are required to define the surface. An example of its use is illustrated in Fig. 9.5.

Rice. 9.5. Using the CreateMesh function with a different set of parameters

· CreateMesh(F(or g, or f1, f2, f3) , s0, s1, t0, t1, sgrid, tgrid, fmap) - creating a nested array representing the x-, y- and z-coordinates of the parametric surface given by the function F;

      • F(s,t) is a three-element vector function defined parametrically with respect to two arguments s and t;
      • g (s, t) - scalar function;
      • f1(s,t),f2(s,t),f3(s,t) - scalar functions;
      • s0, t0 - lower limits of s, t arguments (default -5);
      • s1, t1 - upper limits of s, t arguments (5 by default);
      • sgrid, tgrid - number of grid points by variables s and t (default 20);
      • fmap is a three-element vector function of three arguments that defines a coordinate transformation.

Examples of nested arrays that are created by the CreateMesh and CreateSpace functions are shown in Listing 9-20. Each matrix of the three nested matrices that make up the array defines the x-, y-, and z-coordinates of points on a surface or curve, respectively.

Listing 9.20. The result of the action of the CreateMesh and CreateSpace functions (Fig. 9.4 - 9.5)

Creating Matrices of a Special Kind

Mathcad makes it easy to create matrices of a particular kind using one of the built-in functions. Examples of these functions are shown in Listing 9.21.

· identity (N) - identity matrix of size N*N;

· diag(v) - diagonal matrix, on the diagonal of which there are elements of the vector v;

geninv(A) - creation of a matrix inverse (on the left) to matrix A;

· rref (A) - transformation of a matrix or vector A into a stepped form;

      • N is an integer;
      • v - vector;
      • A is a matrix of real numbers.

The size N*M of the matrix A for the geninv function must be such that N>M.

Listing 9.21. Creating Matrices of a Special Kind

Top Related Articles