BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Bal23
Lapis Lazuli | Level 10

b={4 9, 16 25, 36 49};

x={7 5, 16 9};

a=sqrt(b); * Assign square root of each element of B to corresponding element of A;

y=inv(x); * Call INV function to compute inverse matrix of X and assign results to Y;

r=rank(x);

 

 

I do not know how inv is calculated. I do not know how I can get the follow numbers. Can you explain the function of inv?Thanks.

 

-0.529412
0.2941176
0.9411765

-0.411765

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Because the negative values are required so that X*inv(X) = I.

 

Since your example is a 2x2 matrix, there is even a formula for the inverse.  for any numbers a,b,c, and d, define the matrix 

A = {a b, c d};

Then 

inv(A) = {d -b, -c a} / (ad-bc);

So you can see that if all the original elements are positive, then exactly two of the elements in the inverse must be negative.

View solution in original post

3 REPLIES 3
Rick_SAS
SAS Super FREQ

If Y is the inverse matrix of X, then Y*X = I, where I is the identity matrix that has 1s on the diagonal and 0s off the diagonal.

The inverse matrix is used to solve matrix equation. For example, if you are given a square nxn matrix A and and an nx1 vector w, then you might want to know if there is a vector v such that 

A*v = w

 

Under certain conditions, the solution is the vector v = inv(A)*w.

Bal23
Lapis Lazuli | Level 10

Thanks. I am not clear for some parts. Why I get negative numbers for inv?

Rick_SAS
SAS Super FREQ

Because the negative values are required so that X*inv(X) = I.

 

Since your example is a 2x2 matrix, there is even a formula for the inverse.  for any numbers a,b,c, and d, define the matrix 

A = {a b, c d};

Then 

inv(A) = {d -b, -c a} / (ad-bc);

So you can see that if all the original elements are positive, then exactly two of the elements in the inverse must be negative.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 3 replies
  • 824 views
  • 1 like
  • 2 in conversation