When is a matrix the cosine of another matrix? Knowing that every nonsingular matrix in $M_n(\mathbb{C})$ (the set of size $n$ matrices with complex entries) is an exponential of some matrix in $M_n(\mathbb{C})$, what can be said to answer the question:
For which matrices $A$ in $M_n(\mathbb{C})$, does the equation $$\cos X = A$$ have a solution $X$ in $M_n(\mathbb{C})$?
 A: In principal, what one has to do is the following:
For non-singular $A$, write $A = U^{-1} J U$ with
$$J = \bigoplus_{n=1}^N J(\lambda_n, N_n), J(\lambda, N) = \lambda I_N + K_N$$
$$K_N = \begin{pmatrix} 0 & 1 & 0 & 0 &\dots & 0 \\
0 & 0 & 1 & 0 & \dots & 0 \\
\vdots & & & & &\vdots \\
0 & 0 & 0 & 0 & \dots & 1 \\
0 & 0 & 0 & 0 & \dots & 0 \end{pmatrix}$$
being its Jordan decomposition. Finding an arccos of $A$ reduces to finding an arccos of the Jordan blocks:
$$\arccos A = U^{-1} \cdot \left(\bigoplus_{n=1}^N \arccos (\lambda_n I + K_N) \right) \cdot U $$
You need (for each $\lambda_n$ individually) to find a series expansion of arccos that is valid around $\lambda_n$. If I am not mistaken, this should work whenever
$$\sigma(A) \subset \mathbb C \setminus [ (-\infty, -1]\cup [+1, \infty)]$$
Suppose you want to evaluate $$\sum_{n=0}^\infty a_n (z-z_0)^n$$ on $\lambda I + K$. This is
$$(\lambda I + K - z_0 I)^n = ((\lambda - z_0) I + K)^n = (\lambda - z_0)^n I + n!\,(\lambda - z_0 )^{n-1} K + \dots$$
which converges under the same circumstances as the original power series in C.
A: Part 1. Let $X\in M_n(\mathbb{C})$ s.t. $A=\cos (X)$. $A$ is a series in $X$ and, therefore, is a polynomial in $X$ and $AX=XA$; yet, $X$ is not necessarily a polynomial in $A$. $\DeclareMathOperator{spectrum}{spectrum}$Let $\spectrum(A)=(\lambda_j)$ and $\spectrum(X)=(\nu_j)$ where $\cos(\nu_j)=\lambda_j$. 
Let $Y=e^{iX}$; again, $Y$ is a polynomial in $X$ and $YA=AY$; moreover $Y+Y^{-1}=2A$, that implies $(Y-A)^2=A^2-I$ and $Y=A+B_1$ where $B_1^2=A^2-I$ or $Y=A+iB_2$ where $B_2^2=I-A^2$. 
Part 2. Here $\log:\mathbb{C}\setminus (-\infty,0]\rightarrow \mathbb{C}$ denotes the principal logarithm. 
Proposition 1. When $n=1$, the solutions of $\cos(\nu)=\lambda$ are $\pm \nu_0+2k\pi$ with
i) if $\lambda\notin (-\infty,-1]\cup [1,\infty)$, then $\nu_0=-i\log(\lambda+i\exp(1/2\log(1-\lambda^2)))$.
ii) if $\lambda\notin \{y-axis\}\cup [-1,1]\cup (-\infty,-1]$, then $\nu_0=-i\log(\lambda+\exp(1/2\log(\lambda^2-1)))$.
iii) if $\lambda\in (-\infty,-1)$ then use $\cos(\nu+\pi)=-\lambda$ and ii).
iv) if $\lambda=\pm 1$, then it's clear.
Proof. It suffices to prove i) and ii) and, more precisely, that $\exp(i\nu)$ cannot be $\leq 0$. Let $\nu=x+iy$ where $x,y$ are real. Then $\exp(i\nu)=\exp(ix)\exp(-y)\leq 0$ iff $e^{ix}\leq 0$ iff $x=\pi+2k\pi$. Thus $\lambda=\cos(\nu)=-\cosh(y)\leq -1$, that is contradictory.
Corollary. If $A\in M_n$ is diagonalizable, then there is a solution $X\in M_n$ that is a polynomial in $A$.
Proof. We may assume that $A$ is diagonal and we choose a diagonal solution. Apply Proposition 1. Beware, if $\lambda_i=\lambda_j$, then you must choose $\nu_i=\nu_j$.
Part 3. EDIT. The last proof is more complicated than expected.
Lemma. Let $R_n={\rm diag}(U_p,V_{n-p}),S_n={\rm diag}(P(U),Q(V))$ where $P,Q$ are polynomials and $\spectrum(U)\cap \spectrum(V)=\emptyset$. Then $S$ is a polynomial in $R$.
Proof. Let $\chi_U,\chi_V$ be the characteristic polynomials of $U,V$. Since $P(U)=P(U)+\chi_U(U)\phi(U)$ and $Q(V)=Q(V)+\chi_V(V)\psi(V)$, it suffices to show that there are polynomials $\phi,\psi$ s.t. $P-Q=\chi_V\psi-\chi_U\phi$. That is true because $\gcd(\chi_U,\chi_V)=1$.
Proposition 2. If $A\in M_n$ and $\pm 1$ are not eigenvalues of $A$, then there is a solution $X\in M_n$ that is a polynomial in $A$.
Proof. We may assume that $A={\rm diag}(\lambda_1I_{i_1}+N_1,\cdots,\lambda_kI_{i_k}+N_k)$ where $i_1+\cdots+i_k=n$, the $(\lambda_i)$ are distinct and the $(N_i)$ are nilpotent. According to the lemma, it suffices to show the result when $A=\lambda I+N$.
Use the formulae i),ii),iii) of Proposition 1 (replacing $\lambda,\nu,1$ with $A,X,I$) and use the fact that $\log$ is a matrix function (cf. Higham, functions of matrices) , that implies that $\log(U)$ is a polynomial in $U$ (when $U$ has no eigenvalues in $(-\infty,0]$).
Remark. If $\pm 1\in \spectrum(A)$, then $A^2-I$ is not invertible and is not necessarily a square. For example, $\cos(X)=\begin{pmatrix}\epsilon&1\\0&\epsilon\end{pmatrix}$, where $\epsilon=\pm 1$, has no solutions. Yet, if $\pm 1$ are semi-simple eigenvalues of $A$, then there is a polynomial solution.
