Solve by multiplying the first two polynomials first.
This gets you \(3a^3-2a^2-12a+6a^2-4a-24\) which simplifies down to \(3a^3+4a^2-16a-24\)
Now you do \((a^2-2a+1)(3a^3+4a^2-16a+24)\)
After multiplying, you get \(3a^5+4a^4-16a^3-24a^2-6a^4-8a^3+32a^2+48a+3a^3+4a^2-16a-24\)
\(3a^5+4a^4-16a^3-24a^2-6a^4-8a^3+32a^2+48a+3a^3+4a^2-16a-24\) simplifies down to \(3a^5-2a^4-21a^3+12a^2+32a-24 \)
So the answer is \(3a^5-2a^4-21a^3+12a^2+32a-24\)