The space of matrices that commute with a given matrix $A\in \mathbb{C}^{n\times n}$ is a subspace of the vector space of all matrices $\mathbb{C}^{n\times n}$.
There must exist a projection operator upon this subspace, some $P_A$ such that $$\forall M \in \mathbb{C}^{n\times n}: [P_A M,A]=0$$ Question: Is there some useful expression for $P_A$ in terms of $A$?
Context
I'm looking for a way to interpolate matrices without breaking commutation. For example, I may want to construct $$f:[0,1]\rightarrow \mathbb{C}^{n\times n}$$ $$g:[0,1]\rightarrow \mathbb{C}^{n\times n}$$ knowing $f(0),f(1),g(0),g(1)$ and $[f(0),g(0)]=[f(1),g(1)]=0$, in such at way that $[f(x),g(x)]=0$ remains true for all $x$.