TITLE: Group extension: $H^n(\mathbb{Z},M)$
QUESTION [5 upvotes]: Let $M$ be any $\mathbb{Z}$-module. Find $H^n(\mathbb{Z}, M)$ for all $n$. Use different approaches for the case $n=2$.

First approach: because $\mathbb{Z}$ is a free $\mathbb{Z}$-module, it is also projective. Hence by the main theorem (in any textbook), $H^n(\mathbb{Z}, M) = 0$

Second approach (for $n=2$) was to use arguments on the level of group extensions $0 \to M \to E \to \mathbb{Z} \to 1$.
For this I used the (well-known) theorem that says there is a bijection $H^2(G,M) \leftrightarrow \{\text{equivalence classes of extensions of G by M}\}$ 
Next I noticed that we can find, for all $m$ some extension $0 \to Z/m \to \mathbb{Z}/m \oplus \mathbb{Z} \to  \mathbb{Z} \to 0$
This makes me believe that $H^2(\mathbb{Z}, M) \neq 0$. 
Here, I am wrong (I know... but I don't see my error yet... and I'm in the process of understanding the theory). Maybe $H^2(\mathbb{Z}, M)$ doesnt' measure (up to equivalence) the number of extensions $0 \to Z/m \to \mathbb{Z}/m \oplus \mathbb{Z} \to  \mathbb{Z} \to 0$ we can find, which according to my above reasoning would be countably infinite (for each $m$ we have an extension). Can someone perhaps point out a correct answer for the second approach, so I can fix my own train of thought.

REPLY [4 votes]: 1) Here is another approach: Write $\mathbb{Z}=\langle t\rangle$. Then 
$$\cdots \to 0 \to \mathbb{Z}[\mathbb{Z}]\xrightarrow{1-t}\mathbb{Z}[\mathbb{Z}]\xrightarrow{\varepsilon}\mathbb{Z} \to 0$$
is a projective resolution of $\mathbb Z$ over $\mathbb{Z}[\mathbb{Z}]$, where $\varepsilon$ is the usual augmentation and the other map is multiplication by $1-t$. Hence 
$$H^n(\mathbb Z,M) := Ext^n_{\mathbb{Z}[\mathbb{Z}]}(\mathbb Z,M) = 0$$
for all $n \ge 2$ and each $G$-module $M$. 
2) Regarding your 2nd approach: You have to show that each extension 
$$0 \to M \to E \xrightarrow{\kappa} \mathbb{Z} \to 0$$
splits. Let $e \in E$ s.t. $\kappa(e)=t$. Then a splitting is defined by $\mathbb Z \to E,\;t \mapsto e$. 
3) I agree with darij grinberg that your first approach is wrong. It seems that you are considering $Ext^n_{\mathbb{Z}}(\mathbb Z,M)$ while actually $Ext^n_{\mathbb{Z}[\mathbb{Z}]}(\mathbb Z,M)$ is needed. 

Added: According to  awllower's comment I should add $H^i(\mathbb{Z},M)$ for $i=0,1$. From 1) we immediately find: 
$$H^0(\mathbb{Z},M)=M^\mathbb{Z}:=\{m \in M \mid tm=m\}\quad\text{(the invariants)}$$
$$H^1(\mathbb{Z},M)=M_\mathbb{Z}:=\frac{M}{(1-t)m\mid m\in M\}}\text{(the coinvariants)}$$