Answer
$x^2-x-4-\frac{18}{x-4}$
Work Step by Step
We have to perform the division
$$\dfrac{f(x)}{x-a}=\dfrac{x^3-5x^2-2}{x-4}.$$
We use synthetic division.
First we write the coefficients of $f$ in order of descending coefficients and write the value at which $f$ is being evaluated to the left.
Then we bring down the leading coefficient, multiply the leading coefficient by the $x$-value, write the product under the second coefficient, and add.
Then we multiply the previous sum by the $x$-value, write the product under the third coefficient, and add. Perform this for all the remaining coefficients. We get the value of $f$ at the given $x$-value as the final sum.
$$\dfrac{x^3-5x^2-2}{x-4}=x^2-x-4-\dfrac{18}{x-4}.$$