# Solving matrix equation over extension field with solutions in the base field

I wish to solve the equation AX = Z for A, where X,Z are known matrices over an extension field GF(q^m). I would then like to find a solution for A, where it has entries over GF(q). This always exists in my specific case.

I can obtain a particular solution of the system by `X.solve_left(Z)`

, but this might have entries over GF(q^m). The obvious idea would then be to consider the left kernel of A, with respect to matrices, to iterate through all solutions to the original system by adding to the first particular solution found.

Is there an easy way to do this? My idea would then be to generate matrices with rows generated from the basis of `H.left_kernel()`

, but again, this seems inefficient, and then find a solution with only elements of the subfield.

Please provide an example.