If you work through it as if you were doing polynomial long division you just have to work through the first step and then compare it to the answer. In polynomial long division you always divide the leading term of the dividend and divide it by the leading term of the divisor. In this case 24x^2 /ax = -8x. So this is a pretty simple calculation to find what a is. the xs cancel out so you get 24x/a = -8x and from here you can divide both sides by x, multiply both sides by a and then divide both sides by -8.
24x/a = -8
24/a = -8
24 = -8a
-3 = a
Now just follow through with the whole long division to make sure, but using this method should get you the right answer.