Matrix Inverse with Gauss-Jordan Elimination

Matrix Inverse with Gauss-Jordan Elimination
Loading the math board and drawing, please wait…
2019-06-22 01:10
This GeoGebra example provides an interactive demonstration of computing a matrix inverse using Gauss-Jordan elimination. It visually shows how to transform an augmented matrix into reduced row echelon form through elementary row operations, thereby obtaining the inverse matrix. The core mathematical concepts include matrix inverse, elementary row operations, augmented matrices, and the Gauss-Jordan elimination algorithm. The construction utilizes GeoGebra commands such as Sequence, Flatten, Take, IndexOf, CountIf, Join, Remove, Insert, If, Sort, Element, Append, Textfield, TableText, and Expand, with objects including matrix elements a_1 through a_41, lists lista1, listaf1, listaf5, matrix matriz11, and variables n and m. This resource is suitable for high school and undergraduate linear algebra courses, helping students understand and verify the steps of matrix inversion.

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. Element(lista18, 3, 2) → r
  27. Element(listac1, Element[lista14, 1]) → p
  28. Append(Sequence[Expand[Element[lista1, i] / a_1(x)], i, 1, m], Expand[Element[listater, 1] / a_1(x)]) → listaf12
  29. Take({"R_1", "R_2", "R_3", "R_4", "R_5", "R_6"}, 1, n) → lista3
  30. Element(lista3, Element[lista13, 1]) → texto38
  31. Element(lista3, Element[lista14, 1]) → texto39
  32. Textfield(a_{21}) → c_{13}
  33. Textfield(a_{28}) → c_{14}
  34. Textfield(a_{35}) → c_{15}
  35. Textfield(a_{42}) → c_{16}
  36. Textfield(a_{28}) → c_{24}
  37. Textfield(a_{35}) → c_{25}
  38. Textfield(a_{42}) → c_{26}
  39. Textfield(a_{35}) → c_{35}
  40. Textfield(a_{42}) → c_{36}
  41. Textfield(a_{42}) → c_{46}
  42. Textfield(a_1) → a_{73}
  43. Textfield(a_2) → a_{74}
  44. Textfield(a_3) → a_{77}
  45. Textfield(a_4) → a_{47}
  46. Textfield(a_5) → a_{75}
  47. Textfield(a_6) → a_{48}
  48. Textfield(a_8) → a_{49}
  49. Textfield(a_9) → a_{76}
  50. Textfield(a_{10}) → a_{67}
  51. Textfield(a_{11}) → a_{68}
  52. Textfield(a_{12}) → a_{69}
  53. Textfield(a_{13}) → a_{70}
  54. Textfield(a_{15}) → a_{50}
  55. Textfield(a_{16}) → a_{57}
  56. Textfield(a_{17}) → a_{58}
  57. Textfield(a_{18}) → a_{59}
  58. Textfield(a_{19}) → a_{60}
  59. Textfield(a_{20}) → a_{78}
  60. Textfield(a_{22}) → a_{71}
  61. Textfield(a_{23}) → a_{72}
  62. Textfield(a_{24}) → a_{43}
  63. Textfield(a_{25}) → a_{44}
  64. Textfield(a_{26}) → a_{45}
  65. Textfield(a_{27}) → a_{46}
  66. Textfield(a_{29}) → a_{51}
  67. Textfield(a_{30}) → a_{52}
  68. Textfield(a_{31}) → a_{53}
  69. Textfield(a_{32}) → a_{54}
  70. Textfield(a_{33}) → a_{55}
  71. Textfield(a_{34}) → a_{56}
  72. Textfield(a_{36}) → a_{61}
  73. Textfield(a_{37}) → a_{62}
  74. Textfield(a_{38}) → a_{63}
  75. Textfield(a_{39}) → a_{64}
  76. Textfield(a_{40}) → a_{65}
  77. Textfield(a_{41}) → a_{66}
  78. Take({a_2, a_9, a_{16}, a_{23}, a_{30}, a_{37}}, 1, n) → listac2
  79. Take({a_3, a_{10}, a_{17}, a_{24}, a_{31}, a_{38}}, 1, n) → listac3
  80. Take({a_4, a_{11}, a_{18}, a_{25}, a_{32}, a_{39}}, 1, n) → listac4
  81. Take({a_5, a_{12}, a_{19}, a_{26}, a_{33}, a_{40}}, 1, n) → listac5
  82. Take({a_6, a_{13}, a_{20}, a_{27}, a_{34}, a_{41}}, 1, n) → listac6
  83. IndexOf(f, listac1) → g
  84. Remove(listac1, {f, f}) → lista12
  85. Element(lista3, 1) → texto41
  86. If(Element[listac1, 1] ≟ f, texto40, texto43) → texto42
  87. If(n ≟ 1, 0, If[n ≟ 2, 4, If[n ≟ 3, 7, If[n ≟ 4, 10, If[n ≟ 5, 10, 12]]]]) → b_1
  88. If(m ≟ 6, 115, If[m ≟ 5, 120, If[m ≟ 4, 155, If[m ≟ 3, 195, If[m ≟ 2, 230]]]]) → w
  89. Textfield(n) → CasillaDeEntrada2
  90. 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
  91. 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
  92. 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
  93. Sequence(If[Element[matriz2, i, 1] ≟ f, " ", (((Expand[(-Element[matriz2, i, 1])] * Element[lista3, 1]) * "+") * Element[lista3, i])], i, 2, n) → lista20
  94. TableText({lista20}, "cv") → texto4
  95. If(k > l ∧ k > 1, -1, If[k < l ∧ k ≥ 1, 1, 0]) → j
  96. 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
  97. Take({lista1, lista2, lista5, lista6, lista7, lista8}, 1, n) → matriz6
  98. Sequence(Sequence[Element[matriz6, j, i], i, 1, n], j, 1, n) → matriz7
  99. 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
  100. If(n ≟ 2 ∧ k > 2, 60, If[n ≟ 3 ∧ k > 2, 285, If[n ≟ 4 ∧ k > 2, 408, 0]]) → a
  101. Element(lista18, 2, 2) → q
  102. 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
  103. 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
  104. Sequence(If[Element[matriz2, i, 1] ≟ f, " ", (((Expand[(-Element[matriz2, i, 1])] * Element[lista3, 1]) * "+") * Element[lista3, i])], i, 2, n) → lista21
  105. 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
  106. TableText({lista22}, "cv") → texto10
  107. If(Element[listac1, 1] ≟ f, texto40, texto43) → texto13
  108. TableText({lista20}, "cv") → texto15
  109. 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
  110. 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
  111. Sort(lista18, {1, 3, 2}) → matriz9
  112. If(Element[lista18, 2, 2] ≟ f, texto21, texto19) → texto22
  113. If(Element[lista18, 2, 2] ≟ f, " ", texto8) → texto26
  114. Sort(lista18, {1, 3, 2}) → matriz12
  115. 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
  116. 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
  117. 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
  118. 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
  119. Expand((-Element[matriz14, 3, 2])) → s
  120. 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
  121. Element(matriz10, 3, 3) → t
  122. 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
  123. 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
  124. 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
  125. 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
  126. Expand((-Element[matriz15, 2, 3])) → f_1
  127. Expand((-Element[matriz15, 1, 3])) → p_1
  128. 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
  129. Expand((-Element[matriz16, 1, 2])) → q_1
  130. 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
  131. If(Element[listac1, 1] ≟ f, texto40, texto43) → texto47
  132. 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
  133. TableText({lista20}, "cv") → texto52
  134. 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
  135. IndexOf(r_1, Sequence[Element[lista18, i, 2], i, 2, 4]) → c
  136. 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
  137. Element(lista18, 4, 2) → s_1
  138. 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
  139. Element(matriz19, 3, 3) → t_1
  140. Element(matriz19, 4, 3) → f_2
  141. If(Element[lista18, 2, 2] ≠ f, texto54, If[Element[lista18, 3, 2] ≠ f, texto55, texto57]) → texto58
  142. If(r ≟ f ∧ s ≟ f, " ", texto66) → texto65
  143. 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
  144. Element(matriz20, 3, 3) → p_2
  145. Element(matriz20, 4, 3) → q_2
  146. If(p_2 ≠ f, {1, 2, 3, 4}, {1, 2, 4, 3}) → lista24
  147. Sort(matriz20, lista24) → matriz21
  148. If(p_2 ≟ f, texto72, texto73) → texto74
  149. 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
  150. 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
  151. Element(matriz23, 4, 4) → s_2
  152. 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
  153. 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
  154. 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
  155. 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

AI Drawing Prompt Reference

Create an interactive diagram demonstrating matrix inversion via Gauss-Jordan elimination. Show an augmented matrix with the original square matrix on the left (elements as editable variables) and the identity matrix on the right. Display step-by-step row operations (row swapping, scaling, addition) using text labels and highlight the active rows. Use input fields for matrix entries so users can modify values and see the inverse update. Arrange the layout to clearly visualize the elimination process, with the final inverse matrix appearing on the right side.
The prompt above was compiled from the original drawing commands and is for reference only.