Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. Say you have some m equations in n variables, x1, x2, ... xn
  2.  
  3. lhs1 = rhs1
  4. lhs2 = rhs2
  5. ...
  6. lhs_m = rhs_m
  7.  
  8. You can pick some variable, let's just say x1, and solve each equation for that variable and get an equivalent system:
  9. x1 = rearranged1
  10. x1 = rearranged2
  11. ...
  12. x1 = rearranged_m
  13.  
  14. rearranged1...m only contain variables x2, ..., xn
  15.  
  16. You can "hold on" to the first equation, x1 = rearranged1, and then reduce this system to:
  17.  
  18. rearranged1 = rearranged2
  19. ...
  20. rearranged1 = rearranged_m
  21.  
  22. This is now just a linear system w/ (m-1) equations and (n-1) variables. So you can just repeat the process until you run out of either equations or variables
  23.  
  24. If m = n, then you eventually get down to 1 equation in 1 variable, and you can solve for that variable like normal.
  25.  
  26. You can then substitute this back into each of the previous equations that you "held onto". This should reduce the previous equation you held onto to an equation in 1 variable, and you can then solve for that one, and repeat, all the way back up to x1 = rearranged1, at which point the system is solved.
  27.  
  28. Some different considerations need to be made if m > n, or m < n, that's what I'm working on now.
  29.  
  30. Example:
  31. x + y + z = 5
  32. x + 2y + 3z = 7
  33. x + 3y + 4z = 9
  34.  
  35. Solve for x in each equation:
  36. x = 5 - y - z
  37. x = 7 - 2y - 3z
  38. x = 9 - 3y - 4z
  39.  
  40. Hold onto x = 5 - y - z
  41.  
  42. Equate the RHSs, reduce to a system with 2 equations in just y and z:
  43.  
  44. 5 - y - z = 7 - 2y - 3z
  45. 5 - y - z = 9 - 3y - 4z
  46.  
  47. Repeat:
  48. y = 2 - 2z
  49. y = 2 - (3/2)z
  50.  
  51. Hold onto y = 2 - 2z
  52.  
  53. Equate the RHSs, reduce to a system w/ 1 equation in just z:
  54. 2 - 2z = 2 - (3/2)z
  55.  
  56. Solve for z:
  57. z = 0
  58.  
  59. Substitute z back into y = 2 - 2z:
  60. y = 2
  61.  
  62. Substitute y and z back into x = 5 - y - z:
  63. x = 3
  64.  
  65. Solution:
  66. x = 3
  67. y = 2
  68. z = 0
  69.  
  70. Verify against Wolfram Alpha:
  71.  
  72. https://www.wolframalpha.com/input/?i=row+reduce+%7B%7B1%2C+1%2C+1%2C+5%7D%2C+%7B1%2C+2%2C+3%2C+7%7D%2C+%7B1%2C+3%2C+4%2C+9%7D%7D
  73.  
  74. * The right-most column in the "Result" matrix
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement