A system of linear equations can be represented using matrices. If we have a system of equations in the form of AX = B, where A is the coefficient matrix, X is the unknown variables matrix, and B is the constant matrix, we can solve for X by multiplying both sides by the inverse of A: X = A^(-1) * B.
Example code:
import numpy as np
# Coefficient matrix
A = np.array([[2, 3], [4, 1]])
# Constant matrix
B = np.array([8, 9])
# Solving the system of linear equations
X = np.linalg.solve(A, B)
print("Solution:")
print(X)
Output:
Solution:
[1.8 2.4]