Assume that the matrices $A,\: B\in \mathbb{R}^{n\times n}$ satisfy $$ A^k=0,\,\, \text{for some $\,k\in \mathbb{Z^+}$}\quad\text{and}\quad AB=BA. $$
Prove that $$\det(A+B)=\det B.$$
Assume that the matrices $A,\: B\in \mathbb{R}^{n\times n}$ satisfy $$ A^k=0,\,\, \text{for some $\,k\in \mathbb{Z^+}$}\quad\text{and}\quad AB=BA. $$
Prove that $$\det(A+B)=\det B.$$
Here's an alternative to the (admittedly excellent) answer by Andreas:
Since $A$ and $B$ commute, they are simulaneously triangularizable. However, since $A$ is nilpotent, for any basis in which $A$ is triangular, the diagonal entries of $A$ will in fact be $0$. Thus in the chosen basis, the diagonal entries of $A + B$ and $B$ agree, so the determinants (being the product of the diagonal entries in this basis) are equal.
We shall consider the following two cases:
Case I: $\det B=0$. Then, there exists a vector $u\ne 0$, such that $Bu=0$, and as $AB=BA$, then $$ (A+B)^ku=\sum_{i=0}^k\binom{k}{i}A^{k-i}B^ju=A^ku+\sum_{i=1}^k\binom{k}{i}A^{k-i}B^iu=0, $$ and hence $A+B$ is not invertible and thus $\det(A+B)=\det B=0$.
Case II: $\det B\ne 0$. Then it suffices to show that $\det (I+B^{-1}A)=\det I$. Note that $A$ commutes with $B^{-1}$ as well and $(B^{-1}A)^k=(B^{-1})^kA^k=0$. So it suffices to show that if $C^k=0$, then $\det (I+C)=\det I$. Let $F=I+C$. We know that $$(F-I)^k=C^k=0.$$ This means that ALL the eigenvalues of $F$ are equal to $1$, as $F$ is annihilated by the polynomial $p(x)=(x-1)^k$, and hence its determinant (product of its eigenvalues) is equal to $1$, i.e., $$\det (I+C)=\det F=1.$$
Let $U$ be the generalized eigenspace of $B$ with respect to a particular eigenvalue $\lambda$. Since $A B = B A$, we have $A U \subseteq U$. (If $v \in U$, so that $(B - \lambda I)^{s} v = 0$ for some $s$ and vector $v$, then $(B - \lambda I)^{s} A v = A (B - \lambda I)^{s} v = 0$, that is, $A v \in U$.)
Now on $U$ we will have $B = \lambda I + N$, where $N$ is nilpotent, and $I$ is the identity on $U$. From $A B = BA$ we get $A N = N A$, so $N+A$ is nilpotent. (If $A^{t} = N^{t} = 0$, then $(A+N)^{2t-1} = 0$.)
Now on $U$ we have $A + B = \lambda I + (A + N)$. So we see that $U$ is also the generalized eigenspace of $A + B$ with respect to the eigenvalue $\lambda$. (This is because $(A + B - \lambda I)^{2t-1} = (A + N)^{2t-1} = 0$ for the same $t$ as above. Also, we are actually showing that the $\lambda$-generalized eigenspace of $B$ is contained in the $\lambda$-generalized eigenspace of $A+B$, but the situation is symmetric, as $B = (A+B) - A$, with $A (A+B) = (A+B) A$.)
So $B$ and $A + B$ have the same eigenvalues with the same multiplicities, hence they have the same determinant.
This actually shows that they have the same characteristic polynomial. But they need not have the same minimal polynomial, as the example $A = \begin{bmatrix}0&1\\0&0\end{bmatrix}$, $B = \begin{bmatrix}1&0\\0&1\end{bmatrix}$ shows.