Let $A$ be a commutative ring with $1$. It is a standard result that every set of $n$ generators of the free $A$-module $A^{n}$ is actually a basis. The proof uses tensor products.
I was reading a "proof" of this argument:
Let $\{m_{1},..,m_{t}\}$ be a set of $n$-generators of $A^{n}$. Define the map $f: A^{n} \rightarrow A^{n}$ by $e_{i} \mapsto m_{i}$ where $e_{i}$ is the canonical basis of $A^{n}$.
Let $K=ker(f)$ then we have the following exact sequence:
$0 \rightarrow K \rightarrow A^{n} \rightarrow A^{n} \rightarrow 0$
Then the sequence splits so $A^{n} \cong A^{n} \oplus K$. Therefore $K=0$.
Can you please explain why the relation $A^{n} \cong A^{n} \oplus K$ implies $K=0$? how do we know that $K$ is free?