TITLE: Functions that generate "easy" matrices of full rank
QUESTION [6 upvotes]: While explaining how to invert matrices I once used this ill-fated example 
$A=\begin{pmatrix} 1&2&3\\4&5&6 \\7&8&9 \end{pmatrix}$ which can not be inverted ($\det(A)=0$). That got me thinking, given a matrix of size $N$, what are some good functions that map to the elements such that:

The elements are integers
The elements are "small" (for hand calculation)
The matrix is always invertible
(optional) the function has a random component, but still satisfies (3)

Let $A_{ij} = f(j + (i-1)N)$. In the example above $f(n) = n$.

REPLY [3 votes]: a. The answer given by Andre Nicolas is wrong, even for 3x3 matrices. The matrix
1 2 2
a 1 1
b 1 1
has a determinant of 0 no matter what values a and b have.
...
b. I am working on writing a "cookbook" for random generation of matrices with certain properties. For the problem posted by Hooked, I generate: 

a lower triangular matrix L whose diagonal entries are in {+1,-1} (bonus: if the number of nonzero entries is small, then there aren't that many row operations to perform), 
an upper triangular matrix U whose diagonal entries are in {+1,-1}, and 
a random permutation matrix P. 

Then A = PLU is a suitable matrix for finding the inverse by hand. Also, the determinants of P, L, and U are +1 or -1, so A has determinant +1 or -1, which means its inverse has integral entries.