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-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

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