use (a) to compute determinant. (a)Consider the polynimial $f(X)=a_{n}X^{n}+a_{n-1}X^{n-1}+\cdots+a_{0}$ and define for square matrix $M$, $f(M)$ by $f(M)=a_{n}M^{n}+a_{n-1}M^{n-1}+\cdots+a_{0}I$, show that if $\lambda$ is an eigenvalue of $M$, then $f(\lambda)$ is an eigenvalue of $f(M)$.
(b) Use (a) to compute the determinant of $M=\lambda J+(k-\lambda)I$, where $J$ is the matrix of all $1$s.
I have finished (a), and tried (b),like $f(M)=M+\lambda I$, but it seems not useful.
 A: Let $f(X)=\lambda X+(k-\lambda)$ then $f(J)=M$, moreover it's easy to see that $\{0,\ldots,0,n\}$ is the spectrum of $J$ then by $(a)$ the spectrum of $M$ is 
$$\{k-\lambda,\ldots,k-\lambda,(n-1)+k\}$$
hence 
$$\det M=(k-\lambda)^{n-1}\left(\lambda(n-1)+k\right)$$
Added: to find the spectrum of $J$: The rank of the matrix $J$ is $1$ so $\dim \ker J=n-1$ and then $0$ is an eigenvalue with multiplicity $n-1$ and the last eigenvalue of $J$  is equal to $\mathrm{tr}(J)=n$
A: Since you believe to have (a), let me sketch a proof.


*

*If $\lambda$ is an eigenvalue of $M$, then $a\lambda$ is an eigenvalue of $aM$; moreover, if $v$ is an eigenvector for $M$ relative to $\lambda$, then $v$ is an eigenvector of $aM$ relative to $a\lambda$.

*If $\lambda$ is an eigenvalue of $M$, then $\lambda^k$ is an eigenvalue of $M^k$; moreover, if $v$ is an eigenvector for $M$ relative to $\lambda$, then $v$ is an eigenvector of $M^k$ relative to $\lambda^k$.
Both facts are easy verifications (the second is done by induction).
Now if $f(X)=a_{n}X^{n}+a_{n-1}X^{n-1}+\cdots+a_{0}$ is a polynomial and $\lambda$ is an eigenvalue of $M$ with eigenvector $v$, you have
\begin{align}
f(M)v&=a_{n}M^{n}v+a_{n-1}M^{n-1}v+\cdots+a_{0}Iv\\
&=a_n\lambda^nv+a_{n-1}\lambda^{n-1}v+\cdots+a_{0}v\\
&=f(\lambda)v
\end{align}
In particular, the geometric multiplicity of $f(\lambda)$ as eigenvalue of $f(M)$ is at least equal to the geometric multiplicity of $\lambda$ as eigenvalue of $M$.
Thus, since $J$ has $0$ as eigenvalue of geometric multiplicity $n-1$, since it has rank $1$, $f(J)$ has $f(0)$ as eigenvalue of geometric multiplicity at least $n-1$.
Consider the polynomial $f(X)=\lambda X+(k-\lambda)$. Then $f(0)=k-\lambda$ is an eigenvalue of geometric multiplicity at least $n-1$ of $M=\lambda J+(k-\lambda)I$. The other eigenvalue of $J$ is $n$ and $f(n)=\lambda n+k-\lambda$; if $f(n)\ne f(0)$ we can conclude that $M$ has $f(0)=k-\lambda$ as eigenvalue of geometric multiplicity at least $n-1$, so also of algebraic multiplicity at least $n-1$. The other eigenvalue is $f(n)=\lambda(n-1)+k$, with geometric (hence algebraic) multiplicity at least $1$.
Hence, since the determinant is the product of the eigenvalues counted with their algebraic multiplicities, we get
$$
\det M=(k-\lambda)^{n-1}(\lambda(n-1)+k).
$$
In the case when $f(n)=f(0)$, that is, 
$$
\lambda n+k-\lambda=k-\lambda,
$$
we have $\lambda n=0$ or $\lambda=0$. But in this case we have $M=kI$ whose determinant is $k^n$, and the previous formula is still valid.
Remark 1. I find the notation particularly unfortunate. Probably you'd have less problems in stating problem (b) as

(b) Use (a) to compute the determinant of $\mu M+(k−\mu)I$, where $M$ is the matrix of all $1$s.

Remark 2. An eigenvalue of $J$ is $n$, because
$$
J\begin{bmatrix}1\\1\\\vdots\\1\end{bmatrix}=
\begin{bmatrix}n\\n\\\vdots\\n\end{bmatrix}=
n\begin{bmatrix}1\\1\\\vdots\\1\end{bmatrix}\,.
$$
Since the rank of $J$ is $1$, $0$ is an eigenvalue of $J$ with geometric multiplicity $n-1$ (rank-nullity theorem). Thus the algebraic multiplicity is $\ge n-1$, but it can't be higher, because the sum of algebraic multiplicities is $n$.
