### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Linear algebra (`numpy.linalg`) »

# numpy.linalg.inv

`numpy.linalg.``inv`(a)

  Compute the inverse of a matrix.

  Parameters: | a : array_like, shape (M, M) Matrix to be inverted
  Returns: | ainv : ndarray, shape (M, M) Inverse of the matrix a
  Raises: | LinAlgError : If a is singular or not square.

  Examples

      >>> a = np.array([[1., 2.], [3., 4.]])
      >>> np.linalg.inv(a)
      array([[-2. ,  1. ],
             [ 1.5, -0.5]])
      >>> np.dot(a, np.linalg.inv(a))
      array([[ 1.,  0.],
             [ 0.,  1.]])

### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Linear algebra (`numpy.linalg`) »