Wikipedia says that
"If $A = UDU^{−1}$ and D is diagonal, then $e^{A} = Ue^{D}U^{−1}$"
Why is this the case?
I understand that $e^D$ yields a matrix where $M_{i,j} = e^{D_{i,j}}$, but how is it possible that we are able to factor $U$ and $U^{-1}$ out? I can not seem to find the logic anywhere.
$$e^A=I+A+\frac{1}{2}A^2+\cdots$$ $$=UU^{-1}+UDU^{-1}+\frac{1}{2}UDU^{-1}UDU^{-1}+\cdots$$ $$=UU^{-1}+UDU^{-1}+\frac{1}{2}UD^2U^{-1}+\cdots$$ $$=U\bigg(I+D+\frac{1}{2}D^2+\cdots\bigg)U^{-1}$$ $$Ue^DU^{-1}$$