proptr.net

Thursday, May 15, 2008

Matrix Inversion tutorial

Here is a simple matrix.

In[1]:= m = {{a, b}, {c, d}}

Out[1]=

This shows inverse of matrix m. To produce this result, we consider that the |a d - b c | to be non-zero.

In[2]:= Inverse[ m ]

Out[2]=

Multiplying the inverse by the original matrix should give the identity matrix.

In[3]:= % . m

Out[3]=

You have to use Together to clear the denominators, and get back a standard identity matrix.

In[4]:= Together[ % ]

Out[4]=

Here is a matrix of rational numbers.

In[5]:= hb = Table[1/(i + j), {i, 4}, {j, 4}]

Out[5]=

Find the exact inverse of the matrix.

In[6]:= Inverse[hb]

Out[6]=

Multiplying by the original matrix gives the identity matrix.

In[7]:= % . hb

Out[7]=

If you try to invert a singular matrix, inverse is undone.

In[8]:= Inverse[ {{1, 2}, {1, 2}} ]

Out[8]=

No comments:

ss_blog_claim=1951bd01da8182d1e3875e203fad10f3 ss_blog_claim=1951bd01da8182d1e3875e203fad10f3