I am trying to multiply a vector(3 by 1) by its transpose(1 by 3). I get a (3 by 3) array but I cannot get its inverse. Any idea why?
import numpy as np
c=a
As it was already mentioned in previous answers, your matrix cannot be inverted, because its determinant is 0.
But if you still want to get inverse matrix, you can use np.linalg.pinv
, which leverages SVD to approximate initial matrix.
The matrix you pasted
[[ 1, 8, 50],
[ 8, 64, 400],
[ 50, 400, 2500]]
Has a determinant of zero. This is the definition of a Singular matrix (one for which an inverse does not exist)
http://en.wikipedia.org/wiki/Invertible_matrix
By definition, by multiplying a 1D vector by its transpose, you've created a singular matrix.
Each row is a linear combination of the first row.
Notice that the second row is just 8x the first row.
Likewise, the third row is 50x the first row.
There's only one independent row in your matrix.
Use SVD or QR-decomposition to calculate exact solution in real or complex number fields:
numpy.linalg.svd numpy.linalg.qr