Answer:
import numpy as np
a = int(input ("Enter a"))
b = int(input ("Enter b"))
c = int(input ("Enter c"))
d = int(input ("Enter d"))
c1 = int(input ("Enter c1"))
c2 = int(input ("Enter c2"))
array1 =[[a, b],[c, d]]
A = np.array (array1)
B = np.array ([c1, c2])
X = np.linalg.inv (A).dot (B)
print (X)
Explanation:
let ax + by =c1
cx + dy =c2
We have used the above NumPy library that has the methods for matrix calculation, and here we have used matrix multiplication, and the inverse of a matrix to find the value of x and y.
We know AX=B
X = inv A. B
And this we have used above. We can calculate inv A and do matrix multiplication using NumPy. And thus we get the above solution.