Prove that if $g(t)$ is relatively prime to the characteristic polynomial of $A$, then $g(A)$ is invertible I'd like to write to you two problems that I tried to solve, I'm not sure of the solution of the first.
Let $A\in M_n (F)$ be a matrix and $g(t)\in F(t)$ a polynomial, $P_A(t)$- the characteristic poly of $A$. I need to prove that if $\gcd(P_A(t),g(t)=1$ so $g(A)$ is invertible.
Things I know:
*If $\gcd(P_{A}(t),g(t)=1$ so $P_A(t)$ and $g(t)$ have no factor in common
*for every eigenvalue $\lambda$ of A $\det(A-\lambda)=0$ 
*The minimal poly has all the factors that the cha. has and it is the poly with the minimal degree that if we plug $A$ into it it will equal 0  So I know that for sure $g(A) \neq0$
, but it's not enough to say that $\det g(A) \neq 0$ and to conclude what I need. 
Is it correct to say that  if $\det g(A) = 0$ than $g(x)$ was part of $P_A(t)$? And if yes, why?
The second question is for this bilinear form: $q(v)=q(x,y,z)=2x^2-3y^2+xy-5yz$ I need to find base $B$ so that $[q]^B$ will be diagonalizable matrix. So, I tried to look for eigenvalues but it's impossible mission, it's really messy. Is there any other method which with I can find it? maybe something with Jacoby method?
Thanks alot!
 A: *

*Let $\chi_A(t)$ be the characteristic polynomial of $A$, and let $g(t)$ be a polynomial with $\gcd(g(t),\chi_A(t))=1$. Since $F[t]$ is a Euclidean domain, using the Euclidean algorithm we can find polynomials $r(t)$ and $s(t)$ such that
$$g(t)r(t) + s(t)\chi_A(t) = 1.$$
Now, since $A$ commutes with itself and commutes with each scalar matrix, we can evaluate both sides at the matrix $A$ (replacing the constant coefficients with scalar matrices) to get that
$$g(A)r(A) + s(A)\chi_A(A) = I.$$
By the Cayley-Hamilton Theorem, $\chi_A(A) = 0$, so this reduces to $g(A)r(A) = I$. In particular, $g(A)$ has an inverse, hence is invertible.

*Note that the above does not require the characteristic polynomial to split over $F$. 

*It is not enough for $g(A)\neq 0$ to be able to conclude that $\det(g(A))\neq 0$. For example, take $g(t) = t$, and take $A$ to be any nonzero noninvertible matrix. Then $g(A) = A\neq 0$, but the determinant of $g(A)=A$ is $0$. 
A: By the fundamental theorem of algebra, we may write $g(t)=\prod (t-b_i)$, where $b_i$ are roots of $g(t)$. $\gcd(P_{A}(t),g(t))=1$ implies $P_A(b_i)\ne 0$, i.e., $b_i$ is not an eigenvalue of $A$. Thus $g(A)=\prod (A-b_iI)$ is invertible since each $A-b_iI$ is invertible.
