I assume the third term in the first problem should be -7x², not -7x³.
5x⁴ = 5x³•x, and
5x³ (x - 4) = 5x⁴ - 20x³
Subtract this from the dividend to get an initial remainder of
(5x⁴ - 2x³ - 7x² - 39) - (5x⁴ - 20x³) = 18x³ - 7x² - 39
Next, 18x³ = 18x²•x, and
18x² (x - 4) = 18x³ - 72x²
Subtract this from the previous remainder to get a new one of
(18x³ - 7x² - 39) - (18x³ - 72x²) = 65x² - 39
Next, 65x² = 65x•x, and
65x (x - 4) = 65x² - 260x
which gives a new remainder of
(65x² - 39) - (65x² - 260x) = 260x - 39
Next, 260x = 260•x, and
260 (x - 4) = 260x - 1040
which gives a final remainder of
(260x - 39) - (260x - 1040) = 1001
1001 does not divide x, so we're done, and we've shown that

A similar process can be used to show
