a,\(=x^3-x^2+5x^2-5x-24x+24\)
\(=x^2\left(x-1\right)+5x\left(x-1\right)-24\left(x-1\right)\)
\(=\left(x-1\right)\left(x^2+5x-24\right)\)
\(=\left(x-1\right)\left(x^2-3x+8x-24\right)\)
\(=\left(x-1\right)\left(x\left(x-3\right)+8\left(x-3\right)\right)\)
\(=\left(x-1\right)\left(x-3\right)\left(x+8\right)\)