%% Integer Matrices With Integer Inverses
% An integer matrix has an inverse that is also an integer matrix if and only if its determinant is exactly 1 or –1. A square integer matrix with determinant 1 or –1 is also called a unimodular matrix. An example of such a matrix is gallery('dramadah',n), which is an n-by-n matrix of 0's and 1's with determinant 1 or –1.
% Create a 6-by-6 dramadah matrix. Calculate its determinant and inverse.

A = gallery('dramadah',6)
detA = det(A)
invA = inv(A)

% The inverse of the matrix has only integer entries because the determinant of the original matrix is –1.
%
% Copyright 2019 The MathWorks, Inc.