Prove that the ideal $\langle 2, X\rangle$ in $\mathbb{Z}[X]$ is not principal
My attempt : I found the answer here
In the proof of the theorem it is written that
suppose that the ideal $I=\langle2,X\rangle$ in $\mathbb{Z}[X]$ is principal.Then there exist $f(X) \in \mathbb{Z}[X]$ such that $I=\langle f(X)\rangle$. As $2 \in I$ there exist $g(x) \in \mathbb{Z}[X]$ such that $2= f(X)g(X)$
Hence $\deg f(X) + \deg g(X) =\deg f(X)g(X) =\deg 2 =0$
This $f(X)=a,g(x)=b , a,b \in \mathbb{Z}$
$ 2=ab \implies a= \pm1$ or $\pm2$
If $a= \pm1$ then $<2,x>=<1>$.Hence there exist $r(X) , s(X) \in \mathbb{Z}[X]$ such that $1= 2r(X) + Xs(X)$
If $a= \pm2$ then $<2,x>=<2>$.Hence there exist $v(X) \in \mathbb{Z}[X]$ such that $X= 2v(X)$
My confusion : why is $2= 2r(X) + Xs(X)$ not mentioned in the proof ?
My thinking : If $a= \pm2$ then $<2,x>=<2>$.Then there exist $r(X) , s(X) \in \mathbb{Z}[X]$ such that $2= 2r(X) + Xs(X)$
Now ,put $x=0$.Then $2=2r(0) + 0 s(0) \implies r(0)=1 \in \mathbb{Z}[x]$ i,e constant term will be $r(0)=1$
Tell me where I'm wrong?
You seem to be missing the different intentions behind the step $1 = 2 r(X) + X s(X)$ and the step $X = 2 v(X)$. While it may seem that these two steps are parallels of each other, merely swapping $a = \pm 1$ for $a = \pm 2$, the contradictions we want to derive from them are actually not the same.
In the first case, if $a = \pm 1$, you would get $\langle 2, X\rangle = \langle 1\rangle$. This would mean that the generators of the ideal on the left hand side are included in the ideal on the right hand side, and vice versa. In particular we would have $1\in \langle 2, X\rangle$. In other words, you would be able to write $1$ as a linear combination of $2$ and $X$, with coefficients from $\mathbb{Z}[X]$, i.e. there would exist $r(X), s(X)\in \mathbb{Z}[X]$ such that $1 = 2 r(X) + X s(X)$. This cannot be true, because $\langle 2, X\rangle$ can only contain polynomials with even constant term, and this is what you show by evaluating the equation $1 = 2 r(X) + X s(X)$ at zero.
In the second case, if $a=\pm 2$, you would get $\langle 2, X\rangle = \langle 2\rangle$. Now you cannot follow the same line of reasoning as before and try to derive a contradiction by showing that $2\in \langle 2, X\rangle$ is untrue, because $2$ is obviously in the ideal. This is what your attempt is actually doing. When you found that $r = 1, s = 0$ would give $2 = 2 r + X s$, you simply showed that $2$ belongs to the ideal $\langle 2, X\rangle$. We don't expect any contradiction here.
What you need do instead is to go the other way around, and show that it cannot be true that $X\in \langle 2\rangle$. This is why the linked solution sets $X$ equal to $2$ multiplied by some coefficient from $\mathbb{Z}[X]$, i.e. $X = 2 v(X)$ for some $v(X)\in \mathbb{Z}[X]$.