Find invertible matrix pairs where both matrices are integers
    25 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Douglas Anderson
      
 am 7 Jan. 2022
  
    
    
    
    
    Kommentiert: John D'Errico
      
      
 am 8 Jan. 2022
            Hello!
I think the summary says it all!  Looking for 3x3, but assume that's not critical.
Have found solution for matrix pair where one is integer, but other is not.
Thanks!
Doug Anderson
3 Kommentare
  James Tursa
      
      
 am 7 Jan. 2022
				
      Bearbeitet: James Tursa
      
      
 am 7 Jan. 2022
  
			The cofactors comment was just by way of understanding the problem ... not a suggested method to use. If you have a matrix M with all integer elements and you know the determinant is 1, then you could probably just use round(inv(M)) as a first cut as long as the sizes of the integers are not too big. Do you already have a method for generating the original matrix of integer elements with determinant 1, or are you asking for that as well?
What is this for? I.e., what is the actual problem you are working on?
Akzeptierte Antwort
  John D'Errico
      
      
 am 7 Jan. 2022
        
      Bearbeitet: John D'Errico
      
      
 am 7 Jan. 2022
  
      It seems trivial. 
A = eye(3)
inv(A)
Both are entirely integer. As it turns out, A is idempotent, so it is its own inverse, but that was not expressed as an issue.
But surely you are asking about other matrices, that are also fully integer, yet have an all-integer inverse? This too should be entirely doable. The trick is to consider how to create them.
N = 3;
M = 5;
L = tril(randi(2*M,[N,N])-M,-1) + eye(N)
A = L*L'
format long g
inv(A)
So A is a fully integer randomly created matrix. It has the property of a fully integer inverse. (if we ignore the crap that sometimes arise in the least significant bits of the inverse. They are just due to floating point trash.) If you wish to know why this works, look carefully at how I created the matrix. Look carefully at the matrix L.
A nice property of this creation scheme, is it will work for any size of matrix A. Just change the value of N. As well, it will be blazingly fast, requiring no solve.
1 Kommentar
  John D'Errico
      
      
 am 8 Jan. 2022
				An interesting question about an integer valued matrix where the inverse is also integer valued, is if the eigenvalues must all be 1.
Weitere Antworten (1)
  Walter Roberson
      
      
 am 7 Jan. 2022
        syms v
M = [1 2 3; 4 5 7; 8 9 v]
sol = solve(det(M) == 1)
newM = subs(M, v, sol(1))
inv(newM)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!






