{"id":39,"date":"2013-11-08T15:46:23","date_gmt":"2013-11-08T15:46:23","guid":{"rendered":"\/\/3dbym.ru\/2013\/11\/the-inverse-of-a-matrix\/"},"modified":"2013-11-08T15:46:23","modified_gmt":"2013-11-08T15:46:23","slug":"the-inverse-of-a-matrix","status":"publish","type":"post","link":"https:\/\/3dbym.ru\/2013\/11\/the-inverse-of-a-matrix\/","title":{"rendered":"The Inverse of a Matrix"},"content":{"rendered":"

Hey, what do you know, the last part of the matrix section is here already. That wasn\u2019t so bad was it? This section is on the inverse of a matrix. The inverse of a matrix satisfies the following equation:<\/p>\n

M(M-1) = I. M is the original matrix, M-1 is the inverse of M, and I is the identity matrix. In graphics programming, you could use the inverse of a transformation matrix to cancel out the effects of a previous transfor\u00admation and return a previous transformation matrix. Not all matrices have an inverse. If a matrix is non-square or has a determinant of zero, it will not have an inverse. In programming it is important to make sure the matrix in question does have an inverse before performing this operation to prevent errors such as divide-by-zero. The inverse of a 3×3 matrix can be calculated as shown in Figure 1.9. In the figure M is the original matrix and the elements in the matrix shown are the cofactors of M, which I explain how to calculate here in a second.<\/p>\n\n\n
\n

1<\/p>\n

det [M]<\/p>\n<\/td>\n<\/tr>\n<\/table>\n\n\n\n\n
\n

\u00ae11<\/p>\n<\/td>\n

\n

\u00a912<\/p>\n<\/td>\n

\n

\u00ae13<\/p>\n<\/td>\n<\/tr>\n

\n

\u00a921<\/p>\n<\/td>\n

\n

\u00a922<\/p>\n<\/td>\n

\n

623<\/p>\n<\/td>\n<\/tr>\n

\n

\u00ae31<\/p>\n<\/td>\n

\n

\u00ae32<\/p>\n<\/td>\n

\n

\u00ae33<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

Figure 1.9 Calculating the inverse of a matrix. To calculate the inverse of a matrix, you first find its accompanying cofactor matrix, and then divide it by the determinant of the original matrix.<\/p>\n

In order to use that formula, you need to know how to calculate cofactors of the elements of the matrices. The principle is simple; you cross out the ith column and the jthrow. Therefore, if the element is M, you would cross out the first row and the first column, leaving a 2×2 matrix. This is called the minor of the element. Now, you take the 2×2 matrix and calculate the determinant of it; the result of that determi\u00adnant is called the cofactor. See Figure 1.10 for more details.<\/p>\n

Now for the last step. Take your newly found cofactor matrix and multiply it by one over the determinant of the original matrix. The determinant in this case is -17, so you multiply the cofactor matrix by — 1\/17. By doing this, you have the final inverted matrix, as shown in Figure 1.11.<\/p>\n

<\/p>\n

<\/p>\n\n\n
\n

3 2 3<\/p>\n

4 5 5 7 1 3<\/p>\n

5 5 1 3<\/p>\n

3 2 3 1<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n\n\n
\n

M =<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n\n\n
\n

= (5×3-1 x 5) = 10<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n\n\n
\n

\u00a911 \u2014<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n\n\n
\n

-55<\/p>\n

— 1 3<\/p>\n

— 2 3<\/p>\n

— 1 3<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n\n\n
\n

= (3 x 1 — 3 x 2) = -3<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n\n\n
\n

\u00a912 \u2014<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n<\/p>\n

<\/p>\n

10 -3 -5 23 -12 -3 -3111 7<\/p>\n

Figure 1.10 Calculating cofactors. Top:The original matrix.<\/p>\n\n\n
\n

1<\/p>\n

-17<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

Middle: Calculating two of the cofactors. Bottom: The matrix with all its cofactors calculated.<\/p>\n\n\n\n\n
\n

~10 -3<\/p>\n<\/td>\n

\n

-5~<\/p>\n<\/td>\n

\n<\/td>\n\n

-0.588<\/p>\n<\/td>\n

\n

0.176<\/p>\n<\/td>\n

\n

0.294 ~<\/p>\n<\/td>\n<\/tr>\n

\n

23 -12<\/p>\n<\/td>\n

\n

-3<\/p>\n<\/td>\n

\n

—<\/p>\n<\/td>\n

\n

-1.353<\/p>\n<\/td>\n

\n

0.706<\/p>\n<\/td>\n

\n

0.177<\/p>\n<\/td>\n<\/tr>\n

\n

-31 11<\/p>\n<\/td>\n

\n

7<\/p>\n<\/td>\n

\n<\/td>\n\n

1.824<\/p>\n<\/td>\n

\n

-0.647<\/p>\n<\/td>\n

\n

-0.418<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

Figure I. II Calculating the inverse of a matrix using the process described in the previous section\u2014results are rounded to three decimal places to save space.<\/p>\n","protected":false},"excerpt":{"rendered":"

Hey, what do you know, the last part of the matrix section is here already. That wasn\u2019t so bad was it? This section is on the inverse of a matrix. The inverse of a matrix satisfies the following equation: M(M-1) = I. M is the original matrix, M-1 is the inverse of M, and I […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/39"}],"collection":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/comments?post=39"}],"version-history":[{"count":0,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/39\/revisions"}],"wp:attachment":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/media?parent=39"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/categories?post=39"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/tags?post=39"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}