Exists polynomial satisfying following? Let $s, u \in M_m(\mathbb{k})$ be a pair of commuting matrices such that $s$ is a diagonal matrix and $u$ is a strictly triangular matrix (with zeros on the diagonal). Put $a = s + u$. Does there exist a polynomial $f(x) = c_1x + \cdots + c_dx^d \in \mathbb{k}[x]$, without constant term and such that one has $s = f(a)$ (a matrix equality), where $f(a) := c_1a + \cdots + c_da^d$?
 A: If $\mathbb k$ is a field and the degree $d$ of the polynomial is not pre specified, the answer to your question is affirmative.
Let us first consider the special case where $s$ is a scalar multiple of the identity matrix, say, $s=\lambda I$. In this case you are essentially asking if there exists a polynomial $f$ such that $f(0)=0$ and $f(a)=\lambda I$ when $a=u+\lambda I$.
If $\lambda=0$, we can simply take $f=0$. If $\lambda\ne0$, then $a$ is invertible. Therefore, by Cayley-Hamilton theorem, $a^{-1}=g(a)$ for some polynomial $g$. Let $f(x)=\lambda xg(x)$, we see that $f(0)=0$ and $f(a)=\lambda I$.
Now, consider the general case. Since $s$ and $u$ commute, by permutation we may assume that $s$ is a direct sum of sub-blocks of scalar matrices and $u$ is a block diagonal matrix such that its block structure conforms with $s$ and each sub-block is strictly upper triangular. In other words, we may assume that $s=\bigoplus_{j=1}^k \lambda_jI_{n_j}$ for some distinct $\lambda_j$s and that $u=\bigoplus_{j=1}^k u_j$, where each $u_j$ is a strictly upper triangular matrix of the same size as $I_{n_j}$.
For each $j$, let $a_j=u_j+\lambda_jI_{n_j}$ and let $f_j$ be a polynomial such that $f_j(0)=0$ and $f_j(a_j)=\lambda_j I_{n_j}$. We can now construct $f$ in the spirit of Lagrange interpolation. For any fixed $j$, define
$$
p_j(x)=\prod_{\stackrel{i=1}{i\ne j}}^k (x-\lambda_i)^{n_i}
.$$
It follows that $p_j$ annihilates every $a_i$ when $i\ne j$, and $p_j(a_j)$ is invertible. Therefore the matrix inverse of $p_j(a_j)$ is equal to $q_j(a_j)$ for some polynomial $q_j$. Now, if we define $f$ as
$$
f(x) = \sum_{j=1}^k p_j(x)q_j(x)f_j(x),
$$
we get $f(0)=0$ and $f(a_j)=\lambda_j I_{n_j}$ for each $j$. Consequently, $f(u+s)=s$.
A: This is a partial answer. I will restrict myself to $2 \times 2$ invertible matrices (i.e. all entries in the diagonal are $\neq 0$), and I will show that the answer is positive. I will denote by $1$ the identity matrix.
Let $$a = \left( \begin{matrix} x & y \\ 0 & z\end{matrix} \right)$$
your matrix, with $xz \neq 0$.
Clearly, if $y=0$, you have $a=s$, so you are done. Let's suppose then $y \neq 0$. From your hypothesis that $u,s$ commute you have that $x=z$ (check it!).
In our setting I will show that the restriction on the polynomial $f$ to have null constant term is not necessary. This follows from the fact that, if we denote by $p(X)= X^2 - tX + d$ the characteristic polynomial of $a$ ($t$ is the trace, $d$ the determinant), then $p(a) = 0$, so
$$1 = \frac1d (-a^2 + ta)$$
Moreover, from
$$a^2 = ta-d1$$
follows (using induction) that the space of matrices of the form $f(a)$ has dimension $2$ over $\Bbb{k}$, and a basis is simply $\{ a, 1\}$. In other words:
$$\{ f(a) : f \in \Bbb{k}[X] \} = \{ f(a) : f \in \Bbb{k}[X] , f(0)=0 \} = \{ \lambda a + \mu 1 : \lambda, \mu \in \Bbb{k} \}$$
The equation
$$s = f(a)$$
can be rewritten as
$$\left( \begin{matrix} x & 0 \\ 0 & x\end{matrix} \right) = \lambda \left( \begin{matrix} x & y \\ 0 & x\end{matrix} \right) + \mu \left( \begin{matrix} 1 & 0 \\ 0 & 1\end{matrix} \right)$$
Giving the solution $\lambda = 0, \mu = x$.
EDIT: What if $a$ is not invertible? Then you can see that the commuting hypothesis asks that $y = 0$ or $x=z=0$. For the first case, take $f(X)=X$, for the second case take $f(X)=X^2$, and you are done.
