LU decomposition of matrix using column pivoting

I want to find the LU decomposition of the following matrix $$A$$ using Gauss algorithm and column pivoting. $$A=\begin{pmatrix}6 & 4 & 3 & 1\\ 1 & 1 & 0 & 2 \\ 2 & 3 & 1 & 6 \\ 1 & 3 & 7 & 3\end{pmatrix}$$ $$6$$ is the largest element of the first column, so we don't have to change something and then by applying the Gaussian algorithm we get $$\begin{pmatrix}6 & 4 & 3 & 1\\ 0 & \frac{1}{3} & -\frac{1}{2} & \frac{11}{6} \\ 0 & \frac{5}{3} & 0 & \frac{17}{3} \\ 0 & \frac{7}{3} & \frac{13}{2} & \frac{17}{6}\end{pmatrix}$$ Now the largest element of the submatrix is $$\frac{7}{3}$$, so we exchange the second and last row and we get $$\begin{pmatrix}6 & 4 & 3 & 1 \\ 0 & \frac{7}{3} & \frac{13}{2} & \frac{17}{6} \\ 0 & \frac{5}{3} & 0 & \frac{17}{3} \\ 0 & \frac{1}{3} & -\frac{1}{2} & \frac{11}{6}\end{pmatrix}$$ Applying again the Gaussian algorithm we get $$\begin{pmatrix}6 & 4 & 3 & 1 \\ 0 & \frac{7}{3} & \frac{13}{2} & \frac{17}{6} \\ 0 & 0 & -\frac{65}{14} & \frac{51}{14} \\ 0 & 0 & -\frac{10}{7} & \frac{10}{7}\end{pmatrix}$$ After one more step of Gaussian algorithm we get $$\begin{pmatrix}6 & 4 & 3 & 1 \\ 0 & \frac{7}{3} & \frac{13}{2} & \frac{17}{6} \\ 0 & 0 & -\frac{65}{14} & \frac{51}{14} \\ 0 & 0 & 0 & \frac{4}{13}\end{pmatrix}$$ Now the matrix is in row echelon form.

The $$U$$ matrix of the decomposition is the one that we got, i.e. $$U=\begin{pmatrix}6 & 4 & 3 & 1 \\ 0 & \frac{7}{3} & \frac{13}{2} & \frac{17}{6} \\ 0 & 0 & -\frac{65}{14} & \frac{51}{14} \\ 0 & 0 & 0 & \frac{4}{13}\end{pmatrix}$$ The matrix $$L$$ is $$P\cdot P_0\cdot G_1^{-1}\cdot P_1\cdot G_2^{-1}\cdot P_2\cdot G_3^{-1}$$ where $$P_0=P_2=\begin{pmatrix}1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1\end{pmatrix}, \ P_1=\begin{pmatrix}1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0\end{pmatrix}$$ or not? Then we get $$P=P_2\cdot P_1\cdot P_0=\begin{pmatrix}1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0\end{pmatrix}$$ Is then the matrix $$L=\begin{pmatrix}1 & 0 & 0 & 0 \\ \frac{1}{6} & 1 & 0 & 0 \\\frac{1}{3} & \frac{5}{7} & 1 & 0 \\ \frac{1}{6} & \frac{1}{7} & -\frac{4}{13} & 1\end{pmatrix}$$ ?

But it doesn't hold that $$LU=PA$$, does it? So, have I done something wrong? Are the matrices $$P_i$$ maybe wrong?

• Check the sign on $-\dfrac{4}{13}$. Also, should it be $LU = PA$? I got $$L = \begin{pmatrix} 1 & 0 & 0 & 0 \\ \dfrac{1}{6} & 1 & 0 & 0 \\ \dfrac{1}{3} & \dfrac{5}{7} & 1 & 0 \\ \dfrac{1}{6} & \dfrac{1}{7} & \dfrac{4}{13} & 1 \\ \end{pmatrix}, ~U = \begin{pmatrix} 6 & 4 & 3 & 1 \\ 0 & \dfrac{7}{3} & \dfrac{13}{2} & \dfrac{17}{6} \\ 0 & 0 & -\dfrac{65}{14} & \dfrac{51}{14} \\ 0 & 0 & 0 & \dfrac{4}{13} \\ \end{pmatrix}, ~P = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ \end{pmatrix}$$ – Moo Feb 10 at 13:47
• Ah yes!! Now I get the same as you, and so the equation $LU=PA$ is satisfied! Thank you!! :-) @Moo – Mary Star Feb 10 at 14:17
• I saw my mistake after your comment, so it is not neccesary, but if you want to write it as an answer, you can do that! @Moo – Mary Star Feb 10 at 14:32