# Revision history [back]

### random matrix with determinant +- 1

I want to generate a random 4x4 matrix with integer entries and determinant either 1 or -1. I know that you can use

random_matrix(ZZ,4,4, algorithm = 'unimodular')

to generate matrices with determinant 1 (so in the special linear group). However, I'm actually more interested in the matrices with determinant -1.

Is there a 'Sage' way to do this? Or are there other functions/routines out there I should look at?

Thanks!