We will use the concept of span to make our argument concise. Read if you don’t know what a span is: https://en.wikipedia.org/wiki/Linear_span .

Firstly, an invertible N×NN\times N matrix with modulo pp entries implies the image of the linear map corresponding to this matrix spans the whole vector space ZpN\mathbb{Z}_p^N. Let BB be any basis for ZpN\mathbb{Z}_p^N. Basis is the smallest linearly independent set which spans the whole vector space. We claim that for every basis BB their is a corresponding invertible matrix AA. This follows from the rank-nullity theorem, definition of matrix representation of linear transformations. Then our problem becomes to count the number of unique bases of ZpN\mathbb{Z}_p^N. It is a common trick to extend an empty set to a basis for a vector space in linear algebra. The idea is that we have a basis CCfor some subspace WW. We pick an element vvfrom ZpNW\mathbb{Z}_p^N\setminus W and continue until CC has NN vectors in it. Here W=0W={0} means W W contains only zero vector. Now, finally we get C=v1,v2,,vNC={v_1, v_2, \dots , v_N} , where viv_i is selected at the ithi^{th} step of extending the basis. Verify that each vi v_i can be chosen in pNpi1p^N - p^{i-1} ways. Hence the final answer is (pN1)(pNp)(pNp2)(pNpN1) (p^N-1) (p^N - p) (p^N-p^2)\cdots (p^N-p^{N-1}) . Now print this modulo 998244353998244353.

Statistics

0% Solution Ratio
Toph uses cookies. By continuing you agree to our Cookie Policy.