I was wondering how unique are the groups making up to an exact sequence. Suppose we have three groups $A, B, C$ such that the sequence $$ A \rightarrow B \rightarrow C $$ is exact. I wanted to know how many different groups $B$ are there for fixed groups $A$ and $C$. After some web search I've came to understand that this is something called a group extension problem and that the group $B$ need not be unique in general. Therefore my question is - what if we were to add some assumptions? Let's say that all the groups are abelian, and perhaps add some more elements to the sequence: $$A_1 \rightarrow A_2 \rightarrow ... \rightarrow A_{n-1} \rightarrow A_n $$ is then the group $A_{n-1}$ unique up to an isomorphism? What if we start with a 0? $$0 \rightarrow A_1 \rightarrow A_2 \rightarrow ... \rightarrow A_{n-1} \rightarrow A_n $$ Finally, what if we end and start with a 0? $$0 \rightarrow A_1 \rightarrow A_2 \rightarrow ... \rightarrow A_{n-1} \rightarrow A_n \rightarrow 0$$ In general - are there any sufficient conditions known to make a group appearing in an exact sequence unique?
edit - forgot to mention - throughout the whole question I assume of course all the groups $A_i$ for $i \not= n-1$ fixed
Short answers
Q1: Suppose $A,C$ are given abelian groups. Which groups $B$ can fit inside an exact sequence $A\to B \to C$?
A1: A lot! All this means is that $B$ has a subgroup $K=\operatorname{im}(A\to B)$ so that $B/K$ is isomorphic to a subgroup $Q =\operatorname{im}(B\to C)$ of $C$. So we are looking for $B$ such that $B$ has a subgroup $K$ isomorphic to a quotient of $A$ with $B/K$ isomorphic to a subgroup of $C$. For instance if $A \cong \mathbb{Z}[x]$ and $C \cong \mathbb{R}[x]/\mathbb{Z}[x]$ then $B$ can be any countable abelian group.
Q2: Suppose we have a longer sequence, with none of the maps fixed. What can $A_{n-1}$ be?
A2: A lot! The possible $K$ are restricted in a complicated way, but otherwise there is no change. Any $B=A_{n-1}$ with one of the possible $K$ such that $B/K$ is isomorphic to a subgroup of $C=A_n$.
Q3: Suppose we put 0s on the start. What can $A_{n-1}$ be?
A3: No real change, unless $n$ is very small.
Q4: Suppose we put 0s on the start and the end. What can $A_{n-1}$ be?
A4: Now it is more restricted, $B/K$ is no longer an arbitrary subgroup of $C$, it must be all of $C$.
Q4a: If $n=3$?
A4a: Furthermore, if $n=3$, then $K\cong A_1 = A_{n-2}$ so we know both $K$ and $B/K$, but not $B$. This is exactly the extension problem. It is solved by Ext more or less. I'll write about it separately.
Q5: If $n > 4$, but the maps are fixed?
A5: In that case, we only care about the map $A_{n-3} \to A_{n-2}$ and the group $A_{n-2}$ and $A_n$. The rest is irrelevant, since exactness gives us that $\ker(A_{n-2} \to A_{n-1}) = \operatorname{im}(A_{n-3} \to A_{n-2})$, so we get an injective map $A_{n-2}/\operatorname{im}(A_{n-3} \to A_{n-2}) \to A_{n-1}$.
In other words, in this case we are equivalent to $n=3$ with $$0 \to A_{n-2}/\operatorname{im}(A_{n-3} \to A_{n-2}) \to A_{n-1} \to A_n \to 0.$$
Q6: What if instead of looking for $A_{n-1}$, we look for $A_n$ in $0 \to A_1 \to \ldots \to A_{n-1} \to A_n \to 0$
A6: Then we are just saying that $A_n = A_{n-1} / \operatorname{im}(A_{n-2} \to A_{n-1})$, so it is unique if the map is fixed. Obviously if you allow that map to vary, you get different quotient groups of $A_{n-1}$.
Ext
Ext is defined exactly to measure the possible ways of filling in $0 \to A \to B \to C \to 0$ given $A$ and $C$. All such extension form an abelian group $\operatorname{Ext}(C,A)$ under Baer addition. The only time there is a unique such extension (up to isomorphism of extensions, which is a little bit finer than isomorphism of groups), is when $\operatorname{Ext}(C,A)=0$.
For finitely generated abelian groups, Ext and GCD are approximately the same, Ext is just bilinear: $$\operatorname{Ext}(\mathbb{Z}/n\mathbb{Z},\mathbb{Z}/m\mathbb{Z}) = \mathbb{Z}/(\gcd(m,n)\mathbb{Z})$$ and $$\operatorname{Ext}(A\oplus B,C \oplus D) = \operatorname{Ext}(A,C) \oplus \operatorname{Ext}(A,D) \oplus \operatorname{Ext}(B,C) \oplus \operatorname{Ext}(B,D)$$
Example of non-uniqueness
Obviously if two numbers have a common factor we get nonzero ext: For instance 0 and $n=d\cdot f$ have lots of common factors, and each common factor $f$ gives a different $B$:
$$0 \to \mathbb{Z} \xrightarrow{x \mapsto (dx,-x+f\mathbb{Z})} \mathbb{Z} \oplus \mathbb{Z}/f\mathbb{Z} \xrightarrow{(x,y+f\mathbb{Z})\mapsto x+dy+ df\mathbb{Z}} \mathbb{Z}/(df)\mathbb{Z} \to 0$$
Caveat
If $A$ and $C$ are pathological, then $B$ might be unique up to isomorphism even though $\operatorname{Ext}(C,A) \neq 0$. Let us consider a relativized version where $B$ is any abelian group satisfying $4B=0$ (this is called working mod 4). We'll take $A=C=(\mathbb{Z}/4\mathbb{Z} \oplus \mathbb{Z}/2\mathbb{Z})^{(\infty)}$. Then $\operatorname{Ext}(C,A) = (\mathbb{Z}/2\mathbb{Z})^{(X)} \neq 0$ for some uncountably infinite set $X$. However, all of the different ways of putting $\mathbb{Z}/2\mathbb{Z}$ and $\mathbb{Z}/2\mathbb{Z}$ together either give a $\mathbb{Z}/4\mathbb{Z}$ (of which there are infinitely many) or a $\mathbb{Z}/2\mathbb{Z} \oplus \mathbb{Z}/2\mathbb{Z}$ (of which there are infinitely many). So we can't tell (using isomorphism of abelian groups) which of the two choices was made each time. Examples should also exist without the restriction that $4B=0$, it is just harder for me to think of them or do explicit calculations.