Statistical programming, matrix languages, and more

call inv

Accepted Solution Solved
Reply
Super Contributor
Posts: 336
Accepted Solution

call inv

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

 

 


Accepted Solutions
Solution
‎05-24-2016 02:14 PM
SAS Super FREQ
Posts: 3,408

Re: call inv

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


All Replies
SAS Super FREQ
Posts: 3,408

Re: call inv

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.

Super Contributor
Posts: 336

Re: call inv

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

Solution
‎05-24-2016 02:14 PM
SAS Super FREQ
Posts: 3,408

Re: call inv

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.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 225 views
  • 1 like
  • 2 in conversation