Question about basis of free modules. Let $M$ be an $R$-module, $R$ a ring, and $Z$ a nonempty subset of $M$. Assume that for every $R$-module $N$ and every map $f: Z \rightarrow N$ there exists a unique $R$- linear map $\tilde{f}$ : $M \rightarrow N$ s.t.the restriction of $\tilde{f}$ to $Z$ is $f$. Show that $Z$ is a basis of $M$.
My attempt: Suppose not. Then there is an element of M which cannot be uniquely written as a linear combination of elements of Z. I think I am supposed to consider the inclusion map from Z to M and use the extended map from the hypothesis to arrive at a contradiction, but I can't see how.
https://books.google.co.in/books?id=JcWWDQAAQBAJ&pg=PA336&lpg=PA336&dq=a+subset+of+a+module+is+a+basis+if+for+each+map&source=bl&ots=9NeE1RyYJn&sig=SVi8KaMpNdd0wxzXGMcR6kDvMt0&hl=en&sa=X&ved=0ahUKEwjQ8PrY2OTZAhXHOI8KHb7WD_4Q6AEIUDAD#v=onepage&q=a%20subset%20of%20a%20module%20is%20a%20basis%20if%20for%20each%20map&f=false
Lemma 14.1 in the book above, proves this, but I can't see where $g$ comes from, or why the composition on $N$ to $N$ coincides with the identity on $N$.
 A: *

*$R$-linear independency: Let $Z = \{z_1,z_2, ....\}$. Use a contradiction argument: Let $0 = \sum_i r_i z_i$ with $r_i \in R$ such that wlog $r_1 \neq 0$. Define an arbitrary map $f: Z \to N$ where $N$ is an choosen $R$-module, such that there exist an $n \in N$ with $r_1 n \neq 0$. Set $f(z_i) = 0$ for $i \neq 1$ but $f(z_1) := n$ (only set theoretical). But this map can't have a $R$-linear extension $\tilde{f}:M \to N$ because of $0 = \sum_ir_i z_i$ and construction of $f$.

*$Z$ generates $M$ as $R$-module: If not then there exist a $R$-submodule $S := <Z>_R \neq M$ generated by $Z$. Consider the inclusion map $i: Z \to M$ concatenated with canonical $p : M \to M/S $. Obvoisly $i \circ p$ can be extended to $p: M \to M/S$ and futhermore $S \subset ker (p)$. And we get the $R$-map $\bar{id}: M/S \to M/S$. By assumption $M/S \neq 0$ so there exist at least another morphism $\bar{g}:M/S \to M/S$ with $\bar{g} \neq \bar{id}$. Obviously both extending $i \circ p$ by pulling them back to $M$. Contradiction to $M/S \neq 0$ and uniqueness of extending.

A: Consider the module $R^{(Z)}$ (free module on $Z$), and its basis $(e_z)_{z\in Z}$. Then $z\mapsto e_z$ extends to a linear map $f:M\to R^{(Z)}$.
This implies linear independence, indeed, if $\displaystyle\sum_z r_z z = 0$,then $\displaystyle\sum_z r_z f(z)= 0$, but that's $\displaystyle\sum_z r_z e_z$, and since $R^{(Z)}$ is free, this implies $\forall z, r_z = 0$.
Consider then $N=\langle Z\rangle$. Then you have a canonical map $Z\to N$, which by hypothesis extends to a map $i: M\to N$. Obviously, $N\subset M$ and $i$ is a retraction of this inclusion, which implies that $M=N\oplus T$ for some $T$. Now if you have two maps extending $Z\to T$, $z\mapsto 0$ (the one equal to $0$ on $T$ and the one being the identity on $T$). This implies that these two maps are the same, thus $T=0$, $M=N$.
In conclusion, $Z$ is a linearly independent generating set, thus a basis
A: First note that
$$M=\sum_{z\in Z}Rz$$
for $N=\sum_zRz$ is an $R$-submodule of $M$, and if $\varphi:M\to M/N$ is the projection onto the factor module, then $\varphi(z)=0$ for all $z\in Z$ hence, by uniqueness requirement, we have $\varphi=0$, that's $N=M$.
Consequently, each $x\in M$ can be written in the form
$$x=\sum_{z\in Z}x_zz$$
where $x_z\in R$ and $x_z=0$ for almost every $z\in Z$.
To prove uniqueness, note that for all $z\in Z$ there exists one and only one $R$-linear map $\pi_z:M\to R$ such that $\pi_z(z)=1$ and $\pi_z(z')=0$ for all $z'\in Z$ with $z'\neq z$.
Consequently, if $x_z\in R$, $x_z=0$ for almost every $z\in Z$ and $\sum x_zz=0$, then
\begin{align}
0=\pi_z\Bigl(\sum x_zz\Bigr)=x_z
\end{align}
for all $z\in z$, and this proves $Z$ to be a basis for $M$ over $R$.
