Subtract the first line from the second:
$$\begin{vmatrix}
x & a & b &c \\
a & x & b &c \\
m &n & x &p \\
m& n& p& x
\end{vmatrix}=\begin{vmatrix}
x-a & a-x & 0 &0 \\
a & x & b &c \\
m &n & x &p \\
m & n& p& x
\end{vmatrix}=(x-a)\begin{vmatrix}
1 &-1 & 0 &0 \\
a & x & b &c \\
m &n & x &p \\
m & n& p& x
\end{vmatrix}=$$
$1.$ Multiply the first by $-a$ and add on the second
$2.$ Multiply the first by $-m$ and add on the third
$3.$ Multiply the first by $-m$ and add on the forth
$$(x-a)\begin{vmatrix}
1 &-1 & 0 &0 \\
0 & x+a & b &c \\
0 &m+n & x &p \\
0 &m+ n& p& x
\end{vmatrix}=$$
Forth line minus third:
$$(x-a)\begin{vmatrix}
1 &-1 & 0 &0 \\
0 & x+a & b &c \\
0 &m+n & x &p \\
0 &0& p-x& x-p
\end{vmatrix}=(x-a)(x-p)\begin{vmatrix}
1 &-1 & 0 &0 \\
0 & x+a & b &c \\
0 &m+n & x &p \\
0 &0& -1& 1
\end{vmatrix}=$$
Laplace theorem on the first column
$$(x-a)(x-p)\begin{vmatrix}
x+a & b &c \\
m+n & x &p \\
0& -1& 1
\end{vmatrix}=0$$
Add second and third column on the second
$$(x-a)(x-p)\begin{vmatrix}
x+a & b+c &c \\
m+n & x+p &p \\
0& 0& 1
\end{vmatrix}=0$$
Laplace on the third line
$$(x-a)(x-p)\begin{vmatrix}
x+a & b+c \\
m+n & x+p \\
\end{vmatrix}=0$$
Now $a+m+n=p+b+c=k$ then
$$(x-a)(x-p)\begin{vmatrix}
x+a & k-p \\
k-a & x+p \\
\end{vmatrix}=0$$
Add first line on the second
$$(x-a)(x-p)\begin{vmatrix}
x+a & k-p \\
x+k & x+k \\
\end{vmatrix}=(x-a)(x-p)(x+k)\begin{vmatrix}
x+a & k-p \\
1 & 1 \\
\end{vmatrix}=0$$
$$(x-a)(x-p)(x+k)(x+a+p-k)=0$$
$$(x-a)(x-p)(x+k)(x+a+p-k)=0$$