Well, g(x) could initially be factored as:

g(x) = (x^2 - 7)(x^2 + 5)

The first term is factored as diff of squares:

(x + sqrt(7))(x - sqrt(7))

The second one involves i, or the sqrt(-1)

(x + i*sqrt(5))(x - i*sqrt(5))

When using foil, the last term would be:

(i*sqrt(5))*(-i*sqrt(5))

Group the terms:

-i^2 * [sqrt(5)]^2

-(-1)*5

5 So, it checks out.

The final polynomial is written as:

g(x) = [x + sqrt(7)]*[x - sqrt(7)]*[x + i*sqrt(5)]*[x - i*sqrt(5)]

Hope this helps