I want to get the inverse of the matrix:
$$\begin{pmatrix} 1+\lambda & 1 & 1 & 1\\ 1 & 1+\lambda & 1 & 1\\ 1 & 1 & 1+\lambda & 1 \\ 1 & 1 & 1 & 1+\lambda \end{pmatrix}$$
my first step was doing some cofactor expansion:
$$\begin{pmatrix} 1+\lambda & 1 & 1 & 1\\ -\lambda & \lambda & 0 & 0\\ -\lambda & 0 & \lambda & 0 \\ -\lambda & 0 & 0 & \lambda \end{pmatrix}$$
then the cofactor matrix:
$$\begin{pmatrix} \lambda^3 & \lambda^3 & \lambda^3 & \lambda^3\\ -\lambda^2 &\lambda^3+4\lambda^2 & 0 & 0\\ -\lambda^2 & 0 & \lambda^3+4\lambda^2 & 0 \\ -\lambda^2 & 0 & 0 & \lambda^3+4\lambda^2 \end{pmatrix}$$
transposing and putting the determinant: $$\frac{1}{\lambda^3(4+\lambda)}\begin{pmatrix} \lambda^3 & -\lambda^2 & -\lambda^2 & -\lambda^2\\ \lambda^3 &\lambda^3+4\lambda^2 & 0 & 0\\ \lambda^3 & 0 & \lambda^3+4\lambda^2 & 0 \\ \lambda^3 & 0 & 0 & \lambda^3+4\lambda^2 \end{pmatrix}$$
however, according to Wolfram This is wrong I was checking the answer but I could not find my mistake
If $J$ is the matrix with all ones, the linear space of matrices of the form $aI+bJ$ is a commutative algebra. In particular the inverse of $aI+bJ$ has the form $cI+dJ$ with $c=1/a$ and $d=-b/(a^2+nab).$