The question is very confusing. You say you have 8 codewords. Then you say you want to find a linear code. What, if any, is the connection between the 8 codewords you have and the linear code you want to find?

Then you say you want to use a $(7,4)$ Hamming code. But a $(7,4)$ Hamming code has 16 codewords, so how does this relate to the 8 codewords you say you have?

Then you say you need to find a generator matrix and a parity check matrix. Do you need these for the $(7,4)$ Hamming code? or is this for the 8 codewords you have?

The only part of the question I feel comfortable answering is, yes, you can find a generator matrix from a parity check matrix. Any good text or notes on coding theory should show you how to do that.

Then in the comments you ask whether there is an easier way than just using $(111000000)$, $(000111000)$, and $(000000111)$. I don't know if there is an easier way, since I can't figure out what you are trying to accomplish (see my first three paragraphs). But you can certainly use those vectors to form the generator matrix for an 8-word, 1-error-correcting linear code and, while there may be better ways, I can't imagine a simpler one.

It seems to me that questions about forming generator matrices and turning parity check matrices into generator matrices were answered in your earlier question, Coding Theory and Generating a matrix.

The duals of the Hamming codes are the Simplex codes, so the parity check matrix of a Hamming code is the generator matrix of a Simplex code.

For a generator matrix of a Simplex code of dimension $k$ over the binary alphabet, you just put all non-zero vectors in $\mathbb{F}_2^k$ as columns into a matrix.

For example a generator matrix of a binary Simplex code of dimension $4$ is given by
$$\begin{pmatrix}
1 & 0 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 \\
0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 0 & 1 & 0 & 1 & 1 & 1 \\
0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 1 & 1 \\
0 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 1 & 1 & 0 & 1
\end{pmatrix}$$

By duality, this is a check matrix of a binary $(15,11)$ Hamming code.

For general alphabets $\mathbb{F}_q$, you have to select a system of projective representatives of the non-zero vectors in $\mathbb{F}_q^k$ for the columns.

## Best Answer

The answer is too easy.

(1) let G be the generator matrix. Take the identity matrix out of G (2) let P be the remaining n x (n-m) matrix. transpose P (3) add n-m columns to the transpose of P and insert an identity matrix

The result from step 3 will be the H for G.