<s>[INST] How to calculate this determinant of a $2\times 2$matrix? This matrix arises from a homework problem which our professor gave.
We need to find the determinant of this matrix.
Does there exist any simple way to find the determinant of this matrix?

$\begin{pmatrix}
  x-pq-p+3-(q-1)(\frac{x+2-n}{x-n+2-l}) && (1-p)(2+\frac{l}{x-n+2-l})\\
  (1-q)(2+\frac{l}{x-n+2-l}) && x-pq-q+3-(p-1)(\frac{x+2-n}{x-n+2-l})
  \end{pmatrix}$

Here $n=pq$ and $l=\phi(n)+1$.
Is there any software which can calculate this large determinant?
One of my friends got $x-n+2-l$ as a factor of this determinant.
Is there any simple way to calculate this determinant?
I am stuck.
My try:
$R_1\to R_1-R_2$ gives
$\begin{pmatrix}
  x-pq-p+q+2 && -x+pq+q-p-2\\
  (1-q)(2+\frac{l}{x-n+2-l}) && x-pq-q+3-(p-1)(\frac{x+2-n}{x-n+2-l})
  \end{pmatrix}$
 [/INST] It helps to rewrite your matrix as $A+B$ with$$A:=\left(\begin{array}{cc}
x-pq-p+3 & 1-p\\
1-q & x-pq-q+3
\end{array}\right),\,B:=\frac{x+2-n}{x+2-n-l}\left(\begin{array}{cc}
1-q & 1-p\\
1-q & 1-p
\end{array}\right).$$Write $A=\left(\begin{array}{cc}
a & c\\
b & d
\end{array}\right),\,B=\left(\begin{array}{cc}
e & g\\
f & h
\end{array}\right)$ so$$\begin{align}\det\left(A+B\right)&=\det A+\det B+\det\left(\begin{array}{cc}
a & g\\
b & h
\end{array}\right)+\det\left(\begin{array}{cc}
e & c\\
f & d
\end{array}\right)\\&=\left(x-pq+3\right)^{2}-\left(p+q\right)\left(x-pq+3\right)-1+p+q\\&+\frac{x+2-n}{x+2-n-l}\left[\det\left(\begin{array}{cc}
x-pq-p+3 & 1-p\\
1-q & 1-p
\end{array}\right)+\det\left(\begin{array}{cc}
1-q & 1-p\\
1-q & x-pq-q+3
\end{array}\right)\right]\\&=\left(x-pq+3\right)^{2}-\left(p+q\right)\left(x-pq+3\right)-1+p+q\\&+\frac{x+2-n}{x+2-n-l}\left[\left(x-\left(p-1\right)\left(q+1\right)+1\right)\left(1-p\right)+\left(x-\left(p+1\right)\left(q-1\right)+1\right)\left(1-q\right)\right]\\&=\left(x-pq+3\right)^{2}-\left(p+q\right)\left(x-pq+3\right)-1+p+q\\&+\frac{x+2-n}{x+2-n-l}\left[\left(1+x\right)\left(2-p-q\right)+\left(p-1\right)^{2}\left(q+1\right)+\left(p+1\right)\left(q-1\right)^{2}\right].\end{align}$$
</s>