Respuesta :

Answer:

import numpy as np

a = [[1,1],[1,-1]]

A = np.array(a)

B = np.array([15, 4.5])

X= np.linalg.inv(A).dot(B)

print(X)

Explanation:

In the above program, we have used the matrix method and the NumPy library to solve a simultaneous equation.

We know AX=B

or X= inverseA.B

inverse A is found using np.linalg.inv(matrix). and matrix multiplication by A.dot(matrix B)

We need to get A and B from a simultaneous equation. were A is the coefficient of X and Y and the B is the C like as ax + b =c. here a and b are coefficients and c is the constant. And this is given in both equation like

here, x + y =15

and x - y =4.5

and this gives as matrixes as used above in the program.