Berlekamp's algorithm finds polynomials g(x) suitable for use with the above result by computing a basis for the Berlekamp subalgebra. This is achieved via the observation that Berlekamp subalgebra is in fact the kernel of a certain n \times n matrix over \mathbb{F}_q, which is derived from the so-called Berlekamp matrix of the polynomial, denoted \mathcal{Q}. If \mathcal{Q}=[q_{i,j}] then q_{i,j} is the coefficient of the j-th power term in the reduction of x^{iq} modulo f(x), i.e.:
