How is a Generator Matrix for a (7, 4) Hamming code created? I see that a generator matrix is created with the following formulae:
$$G = \left[I_{k}|P\right]$$
I do not understand what P is in this case. In my notes, I am told that in a (7, 4) Hamming code situation my
$$G =
\begin{pmatrix} 1 & 0 & 0 & 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 0 & 1 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 1 & 1   \end{pmatrix}$$
where P would be 
$$P=\begin{pmatrix}  1 & 0 & 1 \\  1 & 1 & 1 \\  1 & 1 & 0 \\  0 & 1 & 1   \end{pmatrix}$$
How is this P generated?

*

*we named data as d1, d2, d3 ,d4


*we named parity as p1, p2, p3


*make a G matrix or generator matrix so it might look like this. hamming code (7,4)
\begin{matrix}\mathbf{1}&\mathbf{0}&\mathbf{0}&\mathbf{0}&\mathbf{1}&\mathbf{1}&\mathbf{0}\\\mathbf{0}&\mathbf{1}&\mathbf{0}&\mathbf{0}&\mathbf{1}&\mathbf{0}&\mathbf{1}\\\mathbf{0}&\mathbf{0}&\mathbf{1}&\mathbf{0}&\mathbf{0}&\mathbf{1}&\mathbf{1}\\\mathbf{0}&\mathbf{0}&\mathbf{0}&\mathbf{1}&\mathbf{1}&\mathbf{1}&\mathbf{1}\\\end{matrix}


*the question is how to make the G matrix?
d1 =\begin{matrix}1\\0\\0\\0\\\end{matrix}d2=\begin{matrix}0\\1\\0\\0\\\end{matrix} d3 =\begin{matrix}0\\0\\1\\0\\\end{matrix}d4 =\begin{matrix}0\\0\\0\\1\\\end{matrix}
pay attention to bit 1, totally only 1 bit for each row and zero in all other rows. The position of d1, d2, d3, d4 will remain the same. but you may find some formula put parity before data. so it will not arrange from d1,d2,d3,d4,p1,p2,p3 but it will arrange from p1,p2,p3,d1,d2,d3,d4. or you may also find any variation p3 and p1 will interchangeable. p1 could be in the p3 position or vice versa.
5.
p1 =\begin{matrix}0\\1\\1\\1\\\end{matrix}
p2=\begin{matrix}1\\0\\1\\1\\\end{matrix}
p3=\begin{matrix}1\\1\\0\\1\\\end{matrix}
pay attention to bit 0, totally only 1 bit for each row and one in all other rows.
so don't be confused if sometimes you might find p4 or parity 4. it would be p4 =\begin{matrix}1\\1\\1\\0\\\end{matrix}
seems like both of 1 in data bit position or 0 in parity bit position is walking down the row.
