Natural numbers $a$ for which $ \int\frac{x^2-12}{(x^2-6x+a)^2}dx$ is a rational function possible values of $a$ for which $\displaystyle f(x) = \int\frac{x^2-12}{(x^2-6x+a)^2}dx$ is a rational function for $a\in N$
$\displaystyle \frac{d}{dx}f(x)=\frac{x^2-12}{(x^2-6x+a)}$ assuming $\displaystyle f(x) = \frac{px+q}{x^2-6x+a}$
$\displaystyle \frac{(x^2-6x+a)p-(px+q)(2x-6)}{(x^2-6x+a)^2} = \frac{x^2-12}{(x^2-6x+a)^2}$
after camparing coff. $p=-1,q=0,a=12$
but answer is  $a=12$ as well as $a=9$ is also given
could some help me 

The polynomial $x^2-6x+a$ has two roots in the complex plane, given by 
$$ \zeta_a^\pm = 3\pm\sqrt{9-a}$$
so that $x^2-6x+a = (x-\zeta_a^+)(x-\zeta_a^-)$. Let we perform the partial fraction decomposition of the integrand function given such information:
$$\begin{eqnarray*} \frac{x^2-12}{(x^2-6x+a)^2}&=&\frac{x^2-12}{(\zeta_a^+-\zeta_a^-)^2}\left(\frac{1}{x-\zeta_a^+}-\frac{1}{x-\zeta_a^-}\right)^2 \\&=&\frac{x^2-12}{4(9-a)}\left(\frac{1}{(x-\zeta_a^+)^2}+\frac{1}{(x-\zeta_a^-)^2}-\frac{2}{x^2-6x+a}\right)\end{eqnarray*}$$
to deduce, by termwise integration, that:
$$ \int\frac{(x^2-12)\,dx}{(x^2-6x+a)^2}=\frac{1}{2}\left(\frac{(6-a)x+3(12-a)}{(a-9)(x^2-6x+a)}+\frac{\color{blue}{(a-12)}}{(a-9)^{3/2}}\,\text{arctanh}\left(\frac{x-3}{\color{green}{\sqrt{9-a}}}\right)\right) $$
so the only values for which the $\arctan$/$\text{arctanh}$ part disappears are $\color{blue}{a=12}$ and $\color{green}{a=9}$.
In such cases, we have:
$$ \int\frac{(x^2-12)\,dx}{(x^2-6x+\color{blue}{12})^2}=-\frac{x}{x^2-6x+12},\qquad \int\frac{(x^2-12)\,dx}{(x^2-6x+\color{green}{9})^2}=-\frac{x^2-3x-1}{(x-3)^3}.$$
