Cochain from ${\Bbb Z}$ and $\widehat{\Bbb Z}$. Suppose we shall prove $H^2({\Bbb Z}, {\Bbb Z}) = 0$ and $H^2(\widehat{\Bbb Z}, {\Bbb Z}) = {\Bbb Q}/{\Bbb Z}$.
This is simply the matter of calculating $H^2(G, {\Bbb Z})$ or finding what the cochain $f(\sigma, \tau)$ would be such that for any $\sigma, \tau, \rho \in G$ the following property holds$\colon$
$$
f(\tau, \rho)^{\sigma} - f(\sigma \tau,\rho) + f(\sigma, \tau \rho) - f(\sigma, \tau) = 0. \quad \cdots\cdots \quad (\lozenge)
$$
Q. Is it possible to directly handle $(\lozenge)$ to prove the above isomorphisms for $G = {\Bbb Z}$ or $\widehat{\Bbb Z}$?
Namely, can one deduce the results for G = ${\Bbb Z}$, or $\widehat{\Bbb Z}$ simply from the relation $(\lozenge)$?
 A: I don't think that a proof using only the definition of cocycles and coboundaries is useful (or even feasable). Therefore I want to show tools from homological algebra you can (and should) use:
Let $G=F_n$ be the free group of rank $n$. For $n=1$ we have $F_1\cong \Bbb Z$. Then we have
$$
H^k(F_n,\Bbb Z)=0
$$
for all $k\ge 2$.
Proof: We can show that there is a length one resolution of the trivial $G$-module $\Bbb Z$ as follows.
Let $\varepsilon : \Bbb Z[G]\longrightarrow \Bbb Z$ be the canonical augmentation that sends every
$g\in G\mapsto 1 \in\Bbb Z$, and let $K=\ker\varepsilon$. Then $K$ is a free $\Bbb Z [G]$-module with basis
$\{ x-1 : x\in X\}$ where $X$ is a basis of $G$, so there is a free resolution of length $1$,
$$ 
0\longrightarrow K\longrightarrow \mathbb Z[G]\longrightarrow \mathbb Z\longrightarrow 0
$$
Thus $H^k(F_n,\Bbb Z)=H_k(F_n,\Bbb Z)=0$ for all $k\ge 2$.
For the second question, about the cohomology of the profinite completion $\widehat{\Bbb Z}$ of $\Bbb Z$ see Galois cohomology.
