My understanding is that I can use Python to initialize my matrix and then apply an inverse function to find the solution.
2026-03-27 00:54:58.1774572898
On
On
Inverse Matrix in Python
1.1k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
4
There are 4 best solutions below
0
On
I'm not sure I understand your notation:
deltaz = [-1 1 0][z1] = [z2 - z1] = [b1] = b [0 -1 1] [z2] [z3 - z2] [b2] [0 0 -1] [z3] [0 - z3] [b3]
Are you attempting Python pseudocode or are you defining a matrix? If the latter, please use MathJax for a more readable format.
0
On
Inverting a matrix:
import numpy as np
a = np.matrix([[-1, 1, 0],[0,-1,1],[0,0,-1]])
b = numpy.linalg.inv(a)
print(a)
print(b)
print(a*b)
the output should be:
[[-1 1 0]
[ 0 -1 1]
[ 0 0 -1]]
[[-1. -1. -1.]
[-0. -1. -1.]
[-0. -0. -1.]]
[[1. 0. 0.]
[0. 1. 0.]
[0. 0. 1.]]
In case of a system of linear equations use an NumPy-Array for your vector:
import numpy as np
a = np.matrix([[-1, 1, 0],[0,-1,1],[0,0,-1]])
b = np.array([20,26,33])
solution = np.linalg.inv(a).dot(b)
```

You can use matlab but:
1.) you will get a numerical approximation of the inverse,
2.) you won't learn anything from that.
Rather, try doing what the question asks you - work out what $z_1, z_2, z_3$ are in terms of $b_1, b_2, b_3$ (by writing out the equations and rewriting them a bit) or use any other technique to calculate an inverse of $3\times3$ matrix.