# Unique linear combination in an abelian group

By definition:

Given an abelian group $$A$$, a subset $$X \subseteq A$$ and $$x_1,\dots,x_k \in X$$ with $$x_i \neq x_j$$ for all $$1 \leq i \neq j \leq n$$, the elements $$x_1,\dots,x_k$$ are linearly independent if they satisfy the following condition:

$$$$n_1x_1 + \dots + n_kx_k = 0 \, , \, \text{with} \hspace{2mm} n_1,\dots,n_k \in \mathbb{Z} \implies n_i = 0 \hspace{2mm} \text{for all} \hspace{2mm} 1 \leq i \leq n$$$$

Additionally, if $$X$$ is a set of generators for $$A$$, i.e. $$\langle X \rangle = A$$ and if, for all $$x_1,\dots,x_k \in X$$, we have that $$x_1,\dots,x_k$$ are linearly independent, we say that $$X$$ is a base for $$A$$.

I need to prove this statement: let $$A$$ be an abelian group and let $$X \subseteq A$$ be a subset. Then $$X$$ is a base for $$A$$ iff every element $$a \in A$$ can be written uniquely as a finite linear combination of elements of $$X$$ with integers as coefficients, i.e $$\exists \hspace{0.3mm} ! \, x_1,\dots,x_k \in X \, , \, n_1,\dots,n_k \in \mathbb{Z}$$ so that $$a = n_1x_1 + \dots + n_kx_k$$.

I was able to prove the left implication $$(\Longleftarrow)$$ and in the right implication $$(\Longrightarrow)$$ proving the existence of a linear combination is trivial. However, I'm struggling to prove uniqueness. By existence, we have $$x_1,\dots,x_k \in X$$, $$n_1,\dots,n_k \in \mathbb{Z}$$ so that $$a = n_1x_1 + \dots + n_kx_k$$. Let $$y_1,\dots,y_h \in X$$, $$m_1,\dots,m_h \in \mathbb{Z}$$ be elements so that $$a = m_1y_1 + \dots + y_hm_h$$. Then we have: $$$$n_1x_1 + \dots n_kx_k - m_1y_1 - \dots - m_hy_h = 0$$$$ I've made several attempts from this step, how do we get the thesis from this? I'm pretty sure we need to use the fact that the elements in $$X$$ are linearly independent.

An arbitrary subset $$X=\{x_i\}_{i\in I} \subset A$$ is said to be linearly independent if $$\sum_{i}n_ix_i=0\implies n_i=0$$ for all $$i\in I$$, where $$I$$ is an index set.
Suppose $$X$$ is a base for $$A$$. Then any $$x\in A$$ can be written as $$\sum_{i}n_ix_i$$, where $$n_i=0$$ for all but finitely many $$i$$. Suppose there exists another representation of $$x$$, say $$\sum_{i}m_ix_i$$, defined in a similar fashion as above. Then $$\sum_{i}(m_i-n_i)x_i=0$$ and hence $$m_i=n_i$$ for all $$i$$.