<s>[INST] Factor polynomials I am having trouble with these expressions:
$$x^4 - 23x^2 + 1$$
$$2y^2 - 5xy + 2x^2 - ay - ax - a^2$$
$$2x^3 - 4x^2y - x^2z + 2xy^2 - y^2z +2xyz$$
I tried to consult a chapter on factoring in my textbook. It seems to suggest the following:
Check for expressions like $a^n - b^n$ or $(a + b)^n$.
Remember that $x^2 + (a + b)x + ab =(x + a)(x + b)$.
Complete the square and check if any of the above apply.
(For example, $x^2 - 5x + 3$ add $\pm (5/2)^2$ to get the expression equivalent to $(a^n + b^n)$.)
Grouping.
Regarding the first expression I tried the third method i.e. I added $(23/2)^2$ hoping to get the expression equivalent to $a^2 - b^2$.
In the second exercise I tried to factor monomial from different expressions to see some sort of pattern. I also tried to complete the square that is to add different expressions like $\pm(5y/2)^2$. Formula itself reminds me of $(a + b + c)^2$. I am pretty sure the result is of the form $(a + b + c) (a - b + c)$ or something like that but I am still unsure how to proceed.
Regarding the third expression I don’t even know where to start. I tried grouping and other methods but I still can’t see a pattern.
Can someone give me a hint? Am I missing some rule? How to solve problems like that? What goes on in your head while you're looking at the expressions like that?
 [/INST] $$x^4-23x^2+1=x^4+2x^2+1-25x^2=(x^2-5x+1)(x^2+5x+1).$$
$$2x^2-5xy+2y^2-ax-ay-a^2=$$
$$=2x^2-5xy+2y^2+\frac{1}{4}(x+y)^2-\frac{1}{4}(x+y)^2-a(x+y)-a^2=$$
$$=\frac{9}{4}(x-y)^2-\left(\frac{1}{2}(x+y)+a\right)^2=$$
$$=\left(\frac{3}{2}(x-y)-\frac{1}{2}(x+y)-a\right)\left(\frac{3}{2}(x-y)+\frac{1}{2}(x+y)+a\right)=$$
$$=(x-2y-a)(2x-y+a).$$
The third is irreducible. 
</s>