# Can I get the invariant subspaces of a matrix group action?

Suppose I have a [EDIT: finitely-generated] matrix group $G \leq GL_n$, acting on $V = k^n$ in the usual way. Is there some way to calculate the $G$-invariant subspaces of $V$? Failing that, is there an easy way to ask if $V$ is irreducible as a $G$-module?

The answer depends on G. Is it a finite group? A big group? Do you have a concrete example?

Let's say not necessarily a finite group, but generated by two or three explicitly-given matrices.

First of all you can check if your group is Zariski dense. Nothing is ready made in Sage but you may use different strategy but one is described here http://mathoverflow.net/questions/101874/computing-the-zariski-closure-of-a-subgroup-of-sln-z. You may also try to compute the Lie algebra of the Zariski closure.