Inverse Matrix: Gauss-Jordan

Inverse Matrix: Gauss-Jordan
Loading the math board and drawing, please wait…
2017-07-27 20:04
This example demonstrates how to find the inverse of a matrix using the Gauss-Jordan elimination method. Key mathematical concepts include matrix operations and linear algebra. It uses GeoGebra commands such as Sequence, Flatten, and Take. Suitable for high school and above students learning matrix operations and linear algebra.

GeoGebra Commands & Parameters

  1. Sequence(Sequence[If[i ≟ j, 1, 0], i, 1, n], j, 1, n) → matriz11
  2. Flatten(Append[Take[lista1, 1, m], Element[matriz11, 1]]) → listaf1
  3. Flatten(Append[Take[lista7, 1, m], Element[matriz11, 5]]) → listaf5
  4. Flatten(Append[Take[lista8, 1, m], Element[matriz11, 6]]) → listaf6
  5. Flatten(Append[Take[lista2, 1, m], Element[matriz11, 2]]) → listaf2
  6. Flatten(Append[Take[lista5, 1, m], Element[matriz11, 3]]) → listaf3
  7. Take({a_1, a_8, a_{15}, a_{22}, a_{29}, a_{36}}, 1, n) → listac1
  8. Flatten(Append[Take[lista6, 1, m], Element[matriz11, 4]]) → listaf4
  9. IndexOf(f, listac1) → h
  10. CountIf(t ≟ f, t, listac1) → e
  11. Sequence((f(x) * i / i), i, 1, e) → lista4
  12. Sequence(Take[lista4, 1, i], i, 1, e - 1) → lista9
  13. Sequence(IndexOf[f, Remove[listac1, Element[lista9, i]]], i, 1, e - 1) → lista10
  14. Sequence(Element[lista10, i] + i, i, 1, e - 1) → lista11
  15. Join({{h}, lista11}) → lista13
  16. Remove(Sequence[i, i, 1, n], lista13) → lista14
  17. Remove(Sequence[i, i, 1, n], {Element[lista14, 1], Element[lista13, 1]}) → lista15
  18. Insert(Element[lista14, 1], lista15, 1) → lista16
  19. If(Element[listac1, 1] ≟ f, Insert[Element[lista13, 1], lista16, Element[lista14, 1]], Sequence[i, i, 1, n]) → lista17
  20. Sort(Take[{listaf1, listaf2, listaf3, listaf4, listaf5, listaf6}, 1, n], lista17) → matriz1
  21. Sequence(If[i ≟ 1, Sequence[Expand[Element[matriz1, i, j] / Element[matriz1, 1, 1]], j, 1, (2 * n)], Element[matriz1, i]], i, 1, n) → matriz2
  22. Sequence(If[Element[matriz2, i, 1] ≠ f, Sequence[Expand[((-Element[matriz2, i, 1]) * Element[matriz2, 1, j]) + Element[matriz2, i, j]], j, 1, (2 * n)], Element[matriz1, i]], i, 2, n) → matriz3
  23. Insert({Element[matriz2, 1]}, matriz3, 1) → lista18
  24. If(Element[lista18, 2, 2] ≠ f, {1, 2, 3, 4}, If[Element[lista18, 3, 2] ≠ f, {1, 3, 2, 4}, {1, 4, 3, 2}]) → r_1
  25. Sort(lista18, r_1) → matriz18
  26. Sequence(If[i ≟ 2, Sequence[Expand[Element[matriz18, i, j] / Element[matriz18, 2, 2]], j, 1, (2 * n)], Element[matriz18, i]], i, 1, n) → matriz19
  27. Expand((-Element[matriz19, 3, 2])) → h_2
  28. Expand((-Element[matriz19, 4, 2])) → g_2
  29. Element(lista18, 3, 2) → r
  30. Element(listac1, Element[lista14, 1]) → p
  31. Append(Sequence[Expand[Element[lista1, i] / a_1(x)], i, 1, m], Expand[Element[listater, 1] / a_1(x)]) → listaf12
  32. Take({"f_1", "f_2", "f_3", "f_4", "f_5", "f_6"}, 1, n) → lista3
  33. Element(lista3, Element[lista13, 1]) → texto38
  34. Element(lista3, Element[lista14, 1]) → texto39
  35. Textfield(a_{21}) → c_{13}
  36. Textfield(a_{28}) → c_{14}
  37. Textfield(a_{35}) → c_{15}
  38. Textfield(a_{42}) → c_{16}
  39. Textfield(a_{28}) → c_{24}
  40. Textfield(a_{35}) → c_{25}
  41. Textfield(a_{42}) → c_{26}
  42. Textfield(a_{35}) → c_{35}
  43. Textfield(a_{42}) → c_{36}
  44. Textfield(a_{42}) → c_{46}
  45. Textfield(a_1) → a_{73}
  46. Textfield(a_2) → a_{74}
  47. Textfield(a_3) → a_{77}
  48. Textfield(a_4) → a_{47}
  49. Textfield(a_5) → a_{75}
  50. Textfield(a_6) → a_{48}
  51. Textfield(a_8) → a_{49}
  52. Textfield(a_9) → a_{76}
  53. Textfield(a_{10}) → a_{67}
  54. Textfield(a_{11}) → a_{68}
  55. Textfield(a_{12}) → a_{69}
  56. Textfield(a_{13}) → a_{70}
  57. Textfield(a_{15}) → a_{50}
  58. Textfield(a_{16}) → a_{57}
  59. Textfield(a_{17}) → a_{58}
  60. Textfield(a_{18}) → a_{59}
  61. Textfield(a_{19}) → a_{60}
  62. Textfield(a_{20}) → a_{78}
  63. Textfield(a_{22}) → a_{71}
  64. Textfield(a_{23}) → a_{72}
  65. Textfield(a_{24}) → a_{43}
  66. Textfield(a_{25}) → a_{44}
  67. Textfield(a_{26}) → a_{45}
  68. Textfield(a_{27}) → a_{46}
  69. Textfield(a_{29}) → a_{51}
  70. Textfield(a_{30}) → a_{52}
  71. Textfield(a_{31}) → a_{53}
  72. Textfield(a_{32}) → a_{54}
  73. Textfield(a_{33}) → a_{55}
  74. Textfield(a_{34}) → a_{56}
  75. Textfield(a_{36}) → a_{61}
  76. Textfield(a_{37}) → a_{62}
  77. Textfield(a_{38}) → a_{63}
  78. Textfield(a_{39}) → a_{64}
  79. Textfield(a_{40}) → a_{65}
  80. Textfield(a_{41}) → a_{66}
  81. Take({a_2, a_9, a_{16}, a_{23}, a_{30}, a_{37}}, 1, n) → listac2
  82. Take({a_3, a_{10}, a_{17}, a_{24}, a_{31}, a_{38}}, 1, n) → listac3
  83. Take({a_4, a_{11}, a_{18}, a_{25}, a_{32}, a_{39}}, 1, n) → listac4
  84. Take({a_5, a_{12}, a_{19}, a_{26}, a_{33}, a_{40}}, 1, n) → listac5
  85. Take({a_6, a_{13}, a_{20}, a_{27}, a_{34}, a_{41}}, 1, n) → listac6
  86. IndexOf(f, listac1) → g
  87. Remove(listac1, {f, f}) → lista12
  88. Element(lista3, 1) → texto41
  89. If(Element[listac1, 1] ≟ f, texto40, texto43) → texto42
  90. If(n ≟ 1, 0, If[n ≟ 2, 4, If[n ≟ 3, 7, If[n ≟ 4, 10, If[n ≟ 5, 10, 12]]]]) → b_1
  91. If(m ≟ 6, 115, If[m ≟ 5, 120, If[m ≟ 4, 155, If[m ≟ 3, 195, If[m ≟ 2, 230]]]]) → w
  92. Textfield(n) → CasillaDeEntrada2
  93. TableText(Take[{listaf1, listaf2, listaf3, listaf4, listaf5, listaf6}, 1, n], If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → matriz1_1
  94. TableText(matriz2, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto1
  95. TableText(lista18, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto2
  96. Sequence(If[Element[matriz2, i, 1] ≟ f, " ", (((Expand[(-Element[matriz2, i, 1])] * Element[lista3, 1]) * "+") * Element[lista3, i])], i, 2, n) → lista20
  97. TableText({lista20}, "cv") → texto4
  98. If((k > l) ∧ (k > 1), -1, If[(k < l) ∧ (k ≥ 1), 1, 0]) → j
  99. Sequence(If[i ≟ 2, Sequence[Expand[Element[lista18, i, j] / Element[lista18, 2, 2]], j, 1, (2 * n)], Element[lista18, i]], i, 1, n) → matriz5
  100. Take({lista1, lista2, lista5, lista6, lista7, lista8}, 1, n) → matriz6
  101. Sequence(Sequence[Element[matriz6, j, i], i, 1, n], j, 1, n) → matriz7
  102. TableText(matriz5, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto3
  103. If(n ≟ 2 ∧ (k > 2), 60, If[n ≟ 3 ∧ (k > 2), 285, If[n ≟ 4 ∧ (k > 2), 408, 0]]) → a
  104. Element(lista18, 2, 2) → q
  105. Sequence(If[i ≟ 2, Element[matriz5, 2], Sequence[Expand[((-Element[matriz5, i, 2]) * Element[matriz5, 2, j]) + Element[matriz5, i, j]], j, 1, (2 * n)]], i, 1, n) → matriz8
  106. TableText(matriz8, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto7
  107. Sequence(If[Element[matriz2, i, 1] ≟ f, " ", (((Expand[(-Element[matriz2, i, 1])] * Element[lista3, 1]) * "+") * Element[lista3, i])], i, 2, n) → lista21
  108. Sequence(If[Element[matriz5, i, 2] ≟ f, " ", If[i ≟ 2, " ", (((Expand[(-Element[matriz5, i, 2])] * Element[lista3, 2]) * "+") * Element[lista3, i])]], i, 1, n) → lista22
  109. TableText({lista22}, "cv") → texto10
  110. If(Element[listac1, 1] ≟ f, texto40, texto43) → texto13
  111. TableText({lista20}, "cv") → texto15
  112. TableText(matriz2, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto16
  113. TableText(lista18, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto17
  114. Sort(lista18, {1, 3, 2}) → matriz9
  115. If(Element[lista18, 2, 2] ≟ f, texto21, texto19) → texto22
  116. If(Element[lista18, 2, 2] ≟ f, " ", texto8) → texto26
  117. Sort(lista18, {1, 3, 2}) → matriz12
  118. Sequence(If[i ≟ 1, Sequence[Expand[Element[matriz1, i, j] / Element[matriz1, 1, 1]], j, 1, (2 * n)], Element[matriz1, i]], i, 1, n) → matriz13
  119. Sequence(If[i ≟ 2, Sequence[Expand[Element[If[q ≟ f, matriz9, lista18], i, j] / Element[If[q ≟ f, matriz9, lista18], 2, 2]], j, 1, (2 * n)], Element[If[q ≟ f, matriz9, lista18], i]], i, 1, n) → matriz14
  120. TableText(matriz14, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto25
  121. Sequence(If[i ≟ 3, Sequence[Expand[(Element[matriz14, 2, j] * (-Element[matriz14, 3, 2])) + Element[matriz14, 3, j]], j, 1, (2 * n)], Element[matriz14, i]], i, 1, n) → matriz10
  122. Expand((-Element[matriz14, 3, 2])) → s
  123. TableText(matriz10, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto24
  124. Element(matriz10, 3, 3) → t
  125. Sequence(If[i ≟ 3, Sequence[Expand[Element[matriz10, 3, j] / If[Element[matriz10, 3, 3] ≟ f, 1, Element[matriz10, 3, 3]]], j, 1, (2 * n)], Element[matriz10, i]], i, 1, n) → matriz15
  126. TableText(matriz15, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto30
  127. Sequence(If[i ≠ 3, Sequence[Expand[((-Element[matriz15, i, 3]) * Element[matriz15, 3, j]) + Element[matriz15, i, j]], j, 1, (2 * n)], Element[matriz15, i]], i, 1, n) → matriz16
  128. TableText(matriz16, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto33
  129. Expand((-Element[matriz15, 2, 3])) → f_1
  130. Expand((-Element[matriz15, 1, 3])) → p_1
  131. Sequence(If[i ≟ 1, Sequence[Expand[((-Element[matriz16, 1, 2]) * Element[matriz16, 2, j]) + Element[matriz16, i, j]], j, 1, (2 * n)], Element[matriz16, i]], i, 1, n) → matriz17
  132. Expand((-Element[matriz16, 1, 2])) → q_1
  133. TableText(matriz17, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto37
  134. If(Element[listac1, 1] ≟ f, texto40, texto43) → texto47
  135. TableText(matriz2, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto49
  136. TableText({lista20}, "cv") → texto52
  137. TableText(lista18, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto53
  138. IndexOf(r_1, Sequence[Element[lista18, i, 2], i, 2, 4]) → c
  139. If(Element[lista18, 2, 2] ≠ f, {1, 2, 3, 4}, If[Element[lista18, 3, 2] ≠ f, {1, 3, 2, 4}, {1, 4, 3, 2}]) → lista23
  140. Element(lista18, 4, 2) → s_1
  141. TableText(matriz19, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto61
  142. Element(matriz19, 3, 3) → t_1
  143. Element(matriz19, 4, 3) → f_2
  144. If(Element[lista18, 2, 2] ≠ f, texto54, If[Element[lista18, 3, 2] ≠ f, texto55, texto57]) → texto58
  145. Sequence(If[i > 2, Sequence[Expand[((-Element[matriz19, i, 2]) * Element[matriz19, 2, j]) + Element[matriz19, i, j]], j, 1, (2 * n)], Element[matriz19, i]], i, 1, n) → matriz20
  146. If(r ≟ f ∧ s ≟ f, " ", texto66) → texto65
  147. TableText(matriz20, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto68
  148. Element(matriz20, 3, 3) → p_2
  149. Element(matriz20, 4, 3) → q_2
  150. If(p_2 ≠ f, {1, 2, 3, 4}, {1, 2, 4, 3}) → lista24
  151. Sort(matriz20, lista24) → matriz21
  152. Sequence(If[i ≟ 3, Sequence[Expand[Element[matriz21, i, j] / Element[matriz21, 3, 3]], j, 1, (2 * n)], Element[matriz21, i]], i, 1, n) → matriz22
  153. If(p_2 ≟ f, texto72, texto73) → texto74
  154. TableText(matriz22, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto77
  155. Sequence(If[i > 3, Sequence[Expand[((-Element[matriz22, i, 3]) * Element[matriz22, 3, j]) + Element[matriz22, i, j]], j, 1, (2 * n)], Element[matriz22, i]], i, 1, n) → matriz23
  156. Expand((-Element[matriz23, 4, 4])) → r_2
  157. TableText(matriz23, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto83
  158. Element(matriz23, 4, 4) → s_2
  159. Sequence(If[i ≟ 4, Sequence[Expand[Element[matriz23, i, j] / Element[matriz23, 4, 4]], j, 1, (2 * n)], Element[matriz23, i]], i, 1, n) → matriz24
  160. TableText(matriz24, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto87
  161. Sequence(If[i < 4, Sequence[Expand[((-Element[matriz24, i, 4]) * Element[matriz24, 4, j]) + Element[matriz24, i, j]], j, 1, (2 * n)], Element[matriz24, i]], i, 1, n) → matriz25
  162. TableText(matriz25, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto90
  163. Expand((-Element[matriz24, 1, 4])) → t_2
  164. Expand((-Element[matriz24, 2, 4])) → f_3
  165. Expand((-Element[matriz24, 3, 4])) → g_3
  166. Sequence(If[i < 3, Sequence[Expand[((-Element[matriz25, i, 3]) * Element[matriz25, 3, j]) + Element[matriz25, i, j]], j, 1, (2 * n)], Element[matriz25, i]], i, 1, n) → matriz26
  167. Expand((-Element[matriz25, 1, 3])) → h_3
  168. Expand((-Element[matriz25, 2, 3])) → p_3
  169. TableText(matriz26, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto94
  170. Sequence(If[i < 2, Sequence[Expand[((-Element[matriz26, i, 2]) * Element[matriz26, 2, j]) + Element[matriz26, i, j]], j, 1, (2 * n)], Element[matriz26, i]], i, 1, n) → matriz27
  171. Expand((-Element[matriz26, 1, 2])) → q_3
  172. TableText(matriz27, If[m ≟ 6, "c() |0000001000000", If[m ≟ 5, "c() |00000100000", If[m ≟ 4, "c() |000010000", If[m ≟ 3, "c() |0001000", If[m ≟ 2, "c() |00100", "c() |010"]]]]]) → texto97
  173. Expand((-Element[matriz22, 4, 3])) → r_3