Using different variables but the approach is the same; have a look at:#" "# https://socratic.org/s/auC4VyMH
Solution without as much explanation as shown on the hyperlinked page.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#" "x^2-8x+61#
#x+8" "bar("| "x^3+0x^2-3x-2)#
#" "color(blue)(underline(x^3+8x^2 )" " larrx^2(x+8) " subtract")#
#" "color(brown)(0-8x^2-3x-2" " larr "Remainder")#
#" "color(blue)(underline(-8x^2-64x )" "larr -8x(x+8)" subtract")#
#" "color(brown)(0+61x-2" "larr" Remainder")#
#" "color(blue)(underline(61x+488)" "larr" "61(x+8)" subtract")#
#" "color(brown)(0-490" "larr" Remainder")#
#color(brown)("remainder "->-490/(x+8))#
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#color(blue)("Putting it all together")#
#color(blue)((x^3-3x-2)/(x+8)" " =" " x^2-8x+61 -490/(x+8))#.....(1)
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#color(magenta)("Check")#
#x^2-8x+61-490/(x+8)#
#underline(" "x+8)" "larr" multiply"#
#x^3-8x+61x+0-(490x)/(x+8)" "larr" multiplied by "x#
#underline(" "+8x^2-64x+488+0-3920/(x+8))" "larr" multiplied by 8"#
#color(green)(x^3+0x^2-3x+488-(490x)/(x+8)-3920/(x+8))#...(2)
'........................................
Consider #-(490x)/(x+8)-3920/(x+8)#
#(-490(x-8))/(x-8)=-490#
'...............................................
So equation (2) becomes
#color(green)(x^3+0x^2-3x+488-490#
#color(green)(x^3-3x-2)#
#color(red)("Solution is correct")#