Let $A = \text{diag}(\lambda_1,\dots,\lambda_n)$ be a diagonal $n \times n$ matrix and $J:=\textbf{1}\textbf{1}^T$ be the all-ones square matrix. Using the determinant lemma, we can write
$$\det(xI-A-J)=\det(xI-A)\cdot(1-\textbf{1}^T(xI-A)^{-1}\textbf{1})$$
Let $p(x):=\det(xI-A)$ be the characteristic polynomial of $A$. What can I do to build a relation (equality) between $p$ and $p'$ (the first derivative of $p$). Concretely, I am looking to show
$$\det(xI-A-J)=p(x)-p'(x)$$
which thanks to the lemma is equivalent to showing
$$p'(x)=p(x)\cdot\sum\limits_{i=1}^n\frac{1}{x-\lambda_i}$$
but I don't know how to tackle this. I cannot compare coefficients because a priori the RHS is not a polynomial. Any ideas/directions I can go?