# 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

## 2 Answers

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$$

I'm assuming you are referring to LU decomposition with partial pivoting (I'm not familiar with full pivoting, but I believe partial pivoting is more commonly used in practice).

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).

You are correct that a perumtation is applied to the rows of a reduced matrix so that there is a nonzero term to pivot on. Typically we will still permute the rows even if the diagonal element is nonzero. This is because pivoting on the largest (in terms of absolute value) number available is more numerically stable.

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.