# I want to know $PA=LU$ , what is $P$??

I know that if there is a $$0$$ in the diagonal, I use multiply $$P$$ to $$A$$. But, I saw the use of $$P$$ even if there was no zero. I want to know what $$P$$ is and what role it is for.

• "even if there was no zero": what ?? – Yves Daoust Dec 17 '18 at 9:28
• $P$ is a permutation matrix .. – RAM_3R Dec 17 '18 at 9:52

The matrix $$P(l,s)$$ if multiplied by the matrix $$A$$ from the left switches the $$l^{th}$$ and the $$s^{th}$$ rows of $$A$$, and if multiplied by $$A$$ from the right, it switches the $$l^{th}$$ and the $$s^{th}$$ columns of $$A$$
The matrix $$P$$ is a permuation matrix - i.e. its rows/columns are a permutation of the rows/columns(respectively) of the identity matrix, e.g. $$\begin{pmatrix}0&1&0\\1&0&0\\0&0&1\end{pmatrix}$$ is a permutation matrix).
For example we would rather pivot on, $$\begin{pmatrix} 1&4&8\\ 0&1&7\\ 0&0.1&1\\ \end{pmatrix}$$ than pivot on $$\begin{pmatrix} 1&4&8\\ 0&0.1&1\\ 0&1&7\end{pmatrix}$$ for numerical stability.