We are given a power series with complex coefficients $\sum_{n \geqslant 0} a_n z^n$ with radius of convergence $R$ strictly positive, possibly equal to $+\infty$, and $\varphi(A) = \sum_{n=0}^{+\infty} a_n A^n$ defined on $\mathcal{B} = \{A \in \mathcal{M}_d(\mathbb{R}), \|A\| < R\}$. Find a necessary and sufficient condition on the power series $\sum_{n \geqslant 0} a_n z^n$ for there to exist $P \in \mathbb{R}[X]$ such that $$\forall A \in \mathcal{M}_d(\mathbb{R}), \quad \varphi(A) = P(A)$$
We are given a power series with complex coefficients $\sum_{n \geqslant 0} a_n z^n$ with radius of convergence $R$ strictly positive, possibly equal to $+\infty$, and $\varphi(A) = \sum_{n=0}^{+\infty} a_n A^n$ defined on $\mathcal{B} = \{A \in \mathcal{M}_d(\mathbb{R}), \|A\| < R\}$.
Find a necessary and sufficient condition on the power series $\sum_{n \geqslant 0} a_n z^n$ for there to exist $P \in \mathbb{R}[X]$ such that
$$\forall A \in \mathcal{M}_d(\mathbb{R}), \quad \varphi(A) = P(A)$$