Hi, Im having difficulty factoring completely. Ive been running into this problem over again.

heres an example:

5y4 + 10y2 + 5

I ended up with:

5y(y3 + 1) 5(Y + 1)

the correct answer is:

5(y2 + 1)2

how do I know what Im supposed to completely factor? is there a rule Im fogetting? initially, I thought I was suppose to factor out all exponents but I found that not to be true.

heres another:

12p3 + 31p2 + 20p