<s>[INST] What is $q(x)$ and $r(x)$ when $(x^2-6x+9)q(x) + r(x) = x^3 -27$? I just failed this question on a test, so I would please like to get some feedback on where my thinking was wrong. 
I need help with determining $q(x)$ and $r(x)$ when: $$(x^2-6x+9)q(x) + r(x) = x^3 -27$$
I know that: $a^3 - b^3 = (a-b)(a^2 + ab + b^2)$
In this case $a=x$ and $b=\pm3$. By using $+3$ you get the calculation: $$(x^2-6x+9)(x-3) = x^3-9x^2+27x -27$$
To get the final expression: $x^3 -27$ you have to set $r(x)$ to be: $9x^2-27x$.
But this was wrong. Where is my line of thinking incorrect? 
Thank you kindly for your help!
 [/INST] Long division!
$$\require{enclose}
\begin{array}{rll}
x\;+6\qquad\qquad\quad\\[-3pt]
x^2-6x+9\enclose{longdiv}{x^3\qquad\qquad\;\;-27}\\
\underline{x^3-6x^2+9x\phantom{\qquad\,}}\\[-3pt]
6x^2-\phantom{0}9x-27\\[-3pt]
\underline{6x^2-36x+54\;}\\[-3pt]
27x-81
\end{array}$$
So $q(x) = x + 6$ and $r(x) = 27 x - 81$.
</s>