# np.linalg.solve¶

np.linalg.solve(x)

Solves the system of linear equations.

References

Examples

```In [1]: GF = galois.GF(31)

# Ensure A is full rank and invertible
In [2]: while True:
...:     A = GF.Random((4,4))
...:     if np.linalg.matrix_rank(A) == 4:
...:         break
...:

In [3]: A
Out[3]:
GF([[23, 17, 10,  9],
[20, 29,  9, 11],
[ 2,  8,  1, 21],
[13,  5,  8,  0]], order=31)

In [4]: b = GF.Random(4); b
Out[4]: GF([ 7, 19,  3, 22], order=31)

In [5]: x = np.linalg.solve(A, b); x
Out[5]: GF([14,  3, 13,  0], order=31)

In [6]: A @ x
Out[6]: GF([ 7, 19,  3, 22], order=31)
```
```In [7]: GF = galois.GF(31)

# Ensure A is full rank and invertible
In [8]: while True:
...:     A = GF.Random((4,4))
...:     if np.linalg.matrix_rank(A) == 4:
...:         break
...:

In [9]: A
Out[9]:
GF([[28,  6, 26,  1],
[25,  3, 14, 25],
[20, 26, 10,  7],
[ 6, 18,  1,  4]], order=31)

In [10]: B = GF.Random((4,2)); B
Out[10]:
GF([[ 4, 13],
[ 8, 16],
[ 7,  4],
[18, 25]], order=31)

In [11]: X = np.linalg.solve(A, B); X
Out[11]:
GF([[13, 13],
[ 4,  1],
[27, 10],
[30,  3]], order=31)

In [12]: A @ X
Out[12]:
GF([[ 4, 13],
[ 8, 16],
[ 7,  4],
[18, 25]], order=31)
```