It is common for the first or second degree of various cohomologies to classify extensions of various sorts. Here are some examples of what I mean:


1) Derived functor of hom, $\text{Ext}^1\_R(M, N)$. Let $R$ be a ring (not necessarily commutative, with a $1$). As is its namesake, $\text{Ext}^1\_R (M, N)$ [classifies extensions](https://ncatlab.org/nlab/show/Ext#1extensions_over_single_objects) $0 \rightarrow N \rightarrow L \rightarrow M \rightarrow 0$ up to isomorphism. We can put an abelian group structure on this, the Baer sum.


2) Quillen cohomology, $\text{D}^1\_{R} (A/B, M)$. Let $R$ be a commutative ring and let $A$ be an $R$-algebra. Let $B$ Be an $R$-algebra with a map into $A$ (so we have a sequence $R \rightarrow A \rightarrow B$). [The first Andre-Quillen cohomology](https://en.wikipedia.org/wiki/Exalcomm) $D^1(A/B, M)$ is $\text{Exalcomm}(A/B, M)$, the set of $A$-algebra extensions $0 \rightarrow M \rightarrow C \rightarrow B \rightarrow 0$, where we set $a b = 0$ for $a, b \in M$.


In other cohomologies, $H^2$ classifies extensions:


3) Group cohomology, $H^2(G;M)$. Let $G$ be a group, and let $M$ be a $G$-module. $H^2(G;M)$ [classifies extensions](https://ncatlab.org/nlab/show/group+extension#CentralExtensionClassificationByGroupCohomology) $0 \rightarrow M \rightarrow L \rightarrow G \rightarrow 0$ where $L$ is a $G$-module and $M$ has the same $G$-module structure as the one inherited from $L$. 


4) Lie algebra cohomology, $H^2(\mathfrak{g};M)$. Let $R$ be a ring. Let $\mathfrak{g}$ be a Lie-algebra over $R$, and let $\mathfrak{a}$ be an abelian Lie-algebra over $R$. $H^2(\mathfrak{g}, \mathfrak{a})$ classifies central extensions $0 \rightarrow \mathfrak{a} \rightarrow \mathfrak{h} \rightarrow \mathfrak{g} \rightarrow 0$. See remark 4.7. [here](http://www.mathematik.uni-muenchen.de/~schotten/LNP-cft-pdf/04_978-3-540-68625-5_Ch04_23-08-08.pdf).


5) Hoschild cohomology, $H^2(R, M)$. Let $R$ be a commutative ring. The Hoschild cohomology module $H^2(R, M)$ classifies extensions $0 \rightarrow M \rightarrow S \rightarrow R \rightarrow 0$ where $ab = 0$ for $a, b \in M$. Note that Hoschild cohomology and Quillen cohomology are related; often $D^{n+1}(R, M) = H^n(R, M)$.


(1) and (2) are potentially different from (3) and (4), but there is the mentioned relationship between (2) and (5).


I am wondering if there is a (possibly categorical) unification of these theorems. Probably it would be easier to unify (1) and (2), and (3) and (4) separately- I can't say for sure there is a relationship between these pairs.




---


There is probably even a generalization to "extensions of length $n$" for many of these. For instance, $\text{Ext}^n(M, N)$ classifies exact sequences $0 \rightarrow N \rightarrow X\_1 \rightarrow \cdots \rightarrow X\_n \rightarrow M \rightarrow 0$ (See [Weibel](https://rads.stackoverflow.com/amzn/click/com/0521559871), $\textit{An Introduction to Homological Algebra}$, 3.4.6)



Unifying "cohomology groups classify extensions" theorems
$\newcommand{\cA}{\mathcal{A}}\newcommand{\Ext}{\mathrm{Ext}}\newcommand{\Hom}{\mathrm{Hom}}$Let $\cA$ be an abelian category; then, $\Ext\_\cA^i(A,B)$ is literally $\Hom\_{D(\cA)}(A, B[i])$, where $B[i]$ denotes the shift. A good way of thinking about this is as the cohomology of the derived Hom $\mathrm{R}\Hom\_{D(\cA)}(A, B)$. In the case $i=1$, an element of $\Ext^1\_\cA(A,B)$ is then literally a map $A\to B[1]$. The kernel $K$ of this map (in the derived category) defines a distinguished triangle $K\to A\to B[1]$. Since we're working in a derived --- in particular, triangulated --- category, we can rotate this further back to a distinguished triangle $B\to K\to A$. This is precisely the data of an extension.


Choosing $\cA$ correctly specializes to most of the examples you wrote in your question. For instance:


* If $\cA = \mathrm{Mod}\_R$ for some commutative ring $R$, then $\Ext\_\cA$ is literally the Ext-group that you wrote down.
* If $G$ is a group, then $\cA$ can be the category of representations of $G$ on $\mathbf{Z}$-modules (i.e., abelian groups). Recall that a representation is just a module over a group ring. In this case, the group cohomology $\mathrm{H}^i(G; M)$ is $\Ext^i\_{\mathbf{Z}[G]}(\mathbf{Z}, M)$: you can think of this as derived Homs from the unit object $\mathbf{Z}$ into your $G$-representation. I'll address central extensions below.
* If $\cA$ is the category of modules over the universal enveloping algebra $U(\mathfrak{g})$ of a Lie algebra $\mathfrak{g}$ over $k$, then $\mathrm{H}^i(\mathfrak{g}; M) = \Ext^i\_{U(\mathfrak{g})}(k, M)$. Again, these are derived Homs from the unit object $k$ into your $\mathfrak{g}$-module.
* If $A$ is a $k$-algebra, and $\cA$ is the category of $A$-$A$-bimodules, then Hochschild cohomology is $\Ext^i\_{D(\cA)}(A, M)$. Again, these are homs from the unit object $A$ into your $A$-$A$-bimodule.
* Andre-Quillen cohomology fits into this formalism as well, but this time you're not taking derived Homs into an object in the heart of your derived category (i.e., a usual module). Let $A$ be a commutative ring, and $B$ be an $A$-algebra. If $M$ is a $B$-module, then the Andre-Quillen cohomology is (by definition) the cohomology of the derived Hom $\mathrm{RHom}\_B(L\_{B/A}, M)$. But if $P\_\bullet$ is a simplicial cofibrant resolution of $B$ as an $A$-algebra, we have $\mathrm{RHom}\_B(L\_{B/A}, M) = \mathrm{Der}\_A(P\_\bullet, M)$ --- that's what the cotangent complex represents. If you write down what the first cohomology group of this thing is, like with the above examples, you'll get precisely the result you stated in the question.


By the way, one relation between Andre-Quillen cohomology and Hochschild cohomology comes from the Hochschild-Kostant-Rosenberg theorem, which says that if $k$ is of characteristic $0$, then the Hochschild homology $A\otimes\_{A\otimes\_k A^{op}}^\mathbf{L} A$ of a $k$-algebra $A$ is given by $\Omega^\bullet\_{A/k} = \mathrm{Sym}^\bullet(\Omega^1\_{A/k}[1])$. One can think of the Hochschild homology as the homotopy colimit of the constant $S^1$-indexed diagram (where $S^1$ is the simplicial circle $\Delta^1/\partial \Delta^1$) in simplicial $k$-algebras with value $A$, so there's an $S^1$-action on $\Omega^\bullet\_{A/k}$. This defines a map $C\_\ast(S^1; k)\otimes\_k \Omega^\bullet\_{A/k}\to \Omega^\bullet\_{A/k}$ in the derived category of $k$-modules. But $S^1$ is rationally formal, and so $C^\ast(S^1; k) = k[d]/d^2$, where $d$ lives in degree $1$; the action of $d$ on $\Omega^\bullet\_{A/k}$ is precisely the de Rham differential.


Before moving to central extensions, let me say that there wasn't much about derived categories of abelian categories that I used above, other than the facts that they have a notion of distinguished triangles which you can rotate (already true in triangulated categories) and that they are enriched over abelian groups (so taking cohomology of complexes makes sense). You can do all of these constructions more generally in stable model categories/stable $\infty$-categories, and in these more general cases, you recover the simple man's cohomology from algebraic topology 1.


More precisely, let's replace $\cA$ with the category $\mathrm{Sp}$ of spectra, so shifts are now given by suspension. We can then still form "derived Hom", i.e., the mapping spectrum. If $X$ is a spectrum, and $E$ is a spectrum, then $\Hom\_\mathrm{Sp}(X, \Sigma^i E)$ is a perfectly well-defined spectrum, and its $\pi\_0$ is just the cohomology group $E^i(X)$. Of course, you can replace $\mathrm{Sp}$ with, for instance, modules over a structured ring spectrum, and the same sort of construction holds. If your structured ring spectrum is the Eilenberg-Maclane spectrum associated to a classical ring $R$, then you'd be working in the derived category of chain complexes over $R$. It is important to remark, however, that the cotangent complex in this spectral world of a discrete ring regarded as a structured ring spectrum is not the same as the usual notion of cotangent complex: this is the distinction between topological Andre-Quillen cohomology and ordinary Andre-Quillen cohomology. (If $R$ is a $\mathbf{Q}$-algebra, then all is well and everything agrees with the classical notions.)


As Qfwfq states in the comments, the first, second, and fifth examples (in the order listed in my answer) can all be thought of as taking place in the category of sheaves over an algebro-geometric object. For example, $\mathrm{Mod}\_R = \mathrm{QCoh}(\mathrm{Spec}(R))$, while $G$-representations on $\mathbf{Z}$-modules are $\mathrm{QCoh}(\mathrm{Spec}(\mathbf{Z})/G)$, where $X/G$ denotes the stacky quotient. For the fifth example, you have to work in the stable category of quasicoherent sheaves on the *derived* scheme $\mathrm{Spec}(B)$. In the third example, you'd be working in the stable category of left modules (in spectra) over $U(\mathfrak{g})$. In fourth example, you can do the same thing: the category of $A$-$A$-bimodules is the stable category of left modules (in spectra) over $A\otimes\_k A^{op}$.


OK, what about central extensions and $\mathrm{H}^2$? Consider the case of the group cohomology $\mathrm{H}^2(G; M)$, where $M$ has a $G$-action. An element in this is given by a map $BG\to B^2 M$, which upon looping defines a loop map $G\to BM$. Let $L$ denote the fiber of this map; then, rotating this loop map defines a fiber sequence $M\to L\to G$ of loop spaces, i.e., a group extension. Moreover, the map $M\to L$ is central. Of course, this argument is pretty general, and you can run it in the Lie algebra setting as well.


As for obstruction theory: there's a lot to say here, and I've already written a bunch in this answer. However, this is the point of cotangent complexes: the recipe is to break down your obstruction theory problem into understanding extending along square-zero extensions, and then you're in the land of derivations. I can elaborate more if you'd like.


