I am given a series of questions of the form: A reducible polynomial $p(x)\in \mathbb Z[x]$ is given and the task is to decide if all ideals in $\mathbb Z[x]/(p(x))$ are principal. For example, $p(x) = x^2, p(x) = x^2-1$.
At first, I was trying to prove that $Z[x]/(p(x))$ is not a UFD, whence it would not be a PID. However, this requires $\mathbb Z[x]/(p(x))$ to be an integral domain. Since $p(x)$ is reducible and $\mathbb Z[x]$ is a UFD, the element $p(x)$ is not prime and $\mathbb Z[x]/(p(x))$ has zero-divisors, i.e., $\mathbb Z[x]/(p(x))$ is not an integral domain.
I have no other idea on how to attack this type of problem in general. Is it a type of problem that is only easy to solve in simple cases of $p(x)$ such as $x^2$ or $x^2-1$ as above? In the case $p(x) = x^2$ for example, I tried to prove that $(1,x)$ in $\mathbb Z[x]/(x^2)$ is not principal, but with no sucess. I am clueless also on which ideal I should be testing.
The observation here is to observe how $\mathbb{Z}[x]/(x^2)$ looks like. It contains polynomials in the form of $a + bx$ where operations are done modulo $x^2$ (here $f \equiv g \pmod{x^2}$ is equivalent to $f - g \in (x^2)$).
You weren't able to prove that $(1,x)$ is not principal in $\mathbb{Z}[x]/(x^2)$ because it is, since $1 \in (1, x)$ and so $g = g \cdot 1 \in (1, x)$ for any $g \in \mathbb{Z}[x]/x^2$, making $(1, x) = \mathbb{Z}[x]/x^2=(1)$. (In fact, can you show by the same idea that an ideal of a ring with unity is proper if and only if it contains no units?)
As mentioned in the comments by @Offlaw, $(2, x)$ is non-principal in $\mathbb{Z}[x]/(x^2)$. To see that, suppose $(2, x) = (a + bx)$, and note that this means that for some integers $m, n$ we get $$x \equiv (a+bx)(m+nx)\equiv am+x(an+bm)\pmod{x^2}$$
or $am = 0$, and since $a \ne 0$ (or else $(2, x) = (bx)$ and $2 \notin (bx)$), we get that $m$ has to be $0$, making $x \equiv anx \pmod{x^2}$ or $an = 1$, and so $a = \pm 1$.
However, note that for any $g \in (2, x)$, there exists $a_1, b_1, a_2, b_2 \in \mathbb{Z}$ where $$g = 2(a_1+b_1x)+x(a_2+b_2x) \equiv 2a_1+xB \pmod{x^2}$$ so the constant term in $g$ can never be $\pm 1$, making $a + bx \notin (2, x)$ if $a = \pm 1$.
Whenever I try to attack a problem where I'm trying to show that a ring $R$ is not a PID, I try to take any two independent terms (like $2$ and $x$) and try to argue with contradiction that the ideal generated by them (e.g. $(2, x)$) is not principal. I may, in the process, try to play devil's advocate with myself and assume internally that it's a principal ideal, and try to find the generator. If I fail, then there must be a contradiction hidden somewhere.
In our case, it is just easy to analyze solutions of a product of linear polynomials and try to see how this derives contradictions.