Given $A\in M_{6} (\mathbb{Q})$ and $f(x)=2x^9+x^8+5x^3+x+a$, for what values of $a$ is $f(A)$ invertible? Let $A \in \mathbb{Q}^{6 \times 6}$ be the block matrix below:
$$A=\left(\begin{array}{rrrr|rr}
-3 &3  &2  &2  & 0 & 0\\ 
-1 &0  &1  &1  & 0 & 0\\ 
 -1&0  &0  &1  & 0 & 0\\ 
 -4&6  &4  &3  & 0 & 0\\ 
\hline
0 & 0 & 0 & 0 &  0 &1 \\ 
0 & 0 & 0 & 0 & -9 &6 
\end{array}\right).$$
I found out that the minimal polynomial of $A$ is $(x-3)^3(x+1)^2$, and now  let
$$f(x)=2x^9+x^8+5x^3+x+a$$
a polynomial, $a\in N$. I need to find out for which $a$ the matrix $f(A)$ is invertible.
It has some similarity to to my last question, but I still can't understand and solve it. Thanks again.
 A: Expanding on the comment: 
If $A$ has eigenvalue $\lambda$, then $f(A)$ has eigenvalue $f(\lambda)$. So $f(A)$ is not invertible if $f(\lambda)=0$. 
A: Theorem. Let $V$ be a finite $\mathbb{K}$-vector space and let $f \in \mathrm{End}(V)$ an endomorphism with minimal polynomial $m_f(t) \in \mathbb{K}[t]$. If $a(t) \in \mathbb{K}[t]$, then $a(f) \in \mathrm{GL}(V)$ if and only if $\gcd(a,m_f)=1$.
Proof. $\Leftarrow$) Since Bezout's identity, $1 = \lambda m_f + \mu a$ for some polynomials $\lambda, \mu$. So, evaluating in $f$, one has $\mathrm{id}_V = \mu(f) \circ a(f)$, that proves that $a(f)$ is invertible.
$\Rightarrow$) Let $d$ the greatest common divisor between $a$ and $m_f$. One has $a = \tilde{a} d$ for a polynomial $\tilde{a}$, then $a(f) = \tilde{a}(f) \circ d(f)$, so $\ker d(f) \subseteq \ker a(f)$. But $a(f)$ is invertible, so also $d(f)$ is invertible. One has $m_f = \tilde{m} d$, so $0 = \tilde{m}(f) \circ d(f)$; but $d(f)$ is invertible, so $\tilde{m}(f) = 0$. But $m_f$ is the minimal polynomial, so $m_f = \tilde{m}$ and then $d = 1$. $\square$
A: Put $A$ in Jordan form. The diagonal is made of $3$s and $-1$s. In this vector basis, $f(A)$ is also upper triangular and its diagonal is made of $f(3)$s and $f(-1)$s. Hence $f(A)$ is invertible if and only if there is no zero on the diagonal of its Jordan form if and only if $f(3)$ and $f(-1)$ are nonzero (and this condition is equivalent to the fact that the gcd of $f$ and the minimal polynomial of $A$ is $1$).
A: Hint
Let $A$ be an square matrix with coefficients in a field $K$, and let $g$ be its minimal polynomial. 
Then the epimorphism $K[X]\to K[A]$, $f\mapsto f(A)$ induces an isomorphism $K[X]/(g)\to K[A]$. 
Assume that $g$ splits over $K$. 
Then the Chinese Remainder Theorem says that this algebra is isomorphic to the product of the $K[X]/(X-\lambda)^{m(\lambda)}$, where $\lambda$ is an root of $g$ and $m(\lambda)$ its multiplitity. 
Moreover the natural morphism from $K[X]$ to $K[X]/(X-\lambda)^{m(\lambda)}$ attaches to $f\in K[X]$ its degree $ < m(\lambda)$ Taylor polynomial at $\lambda$. 
EDIT 1. The interest of the above observation (which is of course entirely classical) is that it gives you a formula for $f(A)$. [If $K=\mathbb C$ the formula holds also for the functions which are holomorphic on the spectrum --- like the exponential.]
[Technical point: In positive characteristic, $$\frac{f^{(n)}}{n!}$$ is not defined as $f^{(n)}$ divided by $n!$ (Here $f$ is in $K[X]$.)]
EDIT 2. This is to explain how Andrea's very nice answer can be obtained in this setting. Once you've noticed the isomorphism $K[A]=K[X]/(g)$, it's clear that $f(A)$ is invertible iff $f$ is invertible mod $g$, iff $f$ is prime to $g$. 
