Linear Equations

Linear Equations #

\[x = A^{-1} \cdot b\]

Example A #

\[\tag{a.1} x + 2y = 5\] \[\tag{a.2} 3x + 4y = 6\] \[\tag{a.3} A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} \quad b = \begin{pmatrix} 5 \\ 6 \end{pmatrix}\] \[\tag{a.4} x = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}^{-1} \cdot \begin{pmatrix} 5 \\ 6 \end{pmatrix}\]

Python Solution #

import numpy as np
import numpy.linalg as la

A = np.array([[1, 2], [3, 4]])
b = np.array([[5], [6]])

Ainv = la.inv(A)
x = Ainv.dot(b)