#### Answer

$(a-5)(x-1)(x+9)$

#### Work Step by Step

In this problem, we are asked to factor the polynomial completely. Thus, before we start, we first see if there are any terms that are common factors of all of the terms in the polynomial. Next, we look for patterns, such as the sum or the difference of two cubes as well as the perfect square trinomial, the difference of two squares, and the common monomial factor. We continue factoring until the polynomial is factored completely. This means that we continue to factor until the polynomial is written as a product of different polynomials, all of which cannot be factored. Doing this, we find the factors:
$$ ax^2-5x^2+8ax-40x-\left(a-5\right)9 \\ (a-5)(x-1)(x+9)$$