x-3 is a factor ⇒ when x=3 , x^3-8x^2+ax+42=0
3^3-8*3^2+3a+42=0
27-8*9+3a+42=0
27-72+42+3a=0
-3+3a=0
3a=3
a=3:3
a=1
q2. x^3-8x^2+x+42 | x-3
x^2-5x-14
-x^3+3x^2
-----------------
/ -5x^2+x+42
5x^2-15x
------------------
/ -14x+42
+14x-42
------------
/ /
⇒x^3-8x^2+x+42=(x-3)(x^2-5x-14)