Diagonalizable matrices in $M_{2\times 2}(\mathbb{F}_2)$ List all diagonalizable $2\times 2$ matrices over the a field $F$ consisting of two elements $0$ and $1$.
I want to try and do this using C++, but perhaps this isn't the place to ask. I have an idea as to how I'd do it.

there are only finitely many (and a small number too) of matrices to consider so, of course, you can just write some code that will attempt to diagonlize a $2\times 2$ matrix, and just run over all the relevant matrices. 
But in this case it's a lot easier (and more instructive) to figure it out using a bit of linear algebra. For instance, if the characteristic polynomial of a matrix factorizes as the product of distinct linear factors, then the matrix is diagonalizable. Any $2\times 2$ matrix will have characteristic polynomial of degree $2$, and over the field with two elements there are very few such polynomials. Just check them all to see which ones do not factorize as the product of distinct linear factors to find those matrices that might not be diagonalizable. There will not be too many of those, and you can then check them individually.
It will probably take you less time going about this problem mathematically than it would to write and debug your program.  
