Rewrite a4 as (a2)2.
Let u=a2. Substitute u for all occurrences of a2.
Factor u2+13u+40 using the AC method.
Consider the form x2+bx+c. Find a pair of integers whose product is c and whose sum is b. In this case, whose product is 40 and whose sum is 13.
Write the factored form using these integers.
Replace all occurrences of u with a2.