Atiyah-MacDonald Ex.3.15: Every set of generators of $A^n$ has at least $n$ elements There is the following question in Atiyah-Macdonald:

Let $A$ be a ring, and let $F$ be the $A$-module $A^n$. Show that every set of $n$-generators of $F$ is a basis of $F$.


Deduce that every set of generators of $F$ has at least $n$ elements

There is a detailed set of hints that give the first part of the question. Although I am not sure why they assume there are $n$ generators. They use the fact that we have $n$ generators $x_1,...,x_n$ to define $\phi:F\rightarrow F$ by $\phi(x_i)=e_i$. But if we have more than $n$ generators its not clear to me what to do. For example, if $x_1,...,x_n$ are generators, let's take the set of $n+1$ generators $x_1,x_1...,x_n$. Their image is no basis since we have two of the same elements.
I am not sure how to do the second part of the question.
The idea is (I imagine) to show that every basis of $F$ has at least $n$ elements. Then the result follows from the first part. Assume $x_1,...,x_d$ with $d<n$ is a set of generators for $F$. We can define a morphism $\phi: F\rightarrow A^d$ with $\phi(x_i)=e_i$. This is clearly subjective. I think the following works to show that it is injective but I'm not sure if this is  valid property for a basis of a free-module. Since $e_j$ is a basis for the free module $A^d$, $\sum a_i e_i=0$ implies each $a_i=0$. This then gives that if $0=\phi(f)=\phi(\sum a_ix_i)=\sum a_i\phi(x_i)=\sum a_ie_i$. Hence each $a_i=0$ and therefore $f=0$. So $\phi$ is an isomorphism. This gives that $F\cong A^d$ as $A$-modules. But the first part also gives that $F\cong A^n$ as $A$-modules. If we know that $A^d\cong A^n$ implies that $d=n$ we are done.
But this also confused me as this seems to prove something stronger. It proves that every set of generators has exactly $n$ elements. The question only asked to show that each set of generators has at least $n$ elements.

*

*Why do they make the assumption that we have $n$ generators and what do we do if we have more than $n$ generators?

*Is my solution for the second part correct?

*Is it true that $A^d\cong A^n$ implies $d=n$ and if so how do we prove this? Or perhaps is there some easier result along the lines of: if $A^d\rightarrow A^n$ is a surjection then $d\geq n$, this seems like it would work better with the wording of the question being "at least $n$ elements.

 A: For the first part, suppose $x_1,...,x_n$ are generators of $A^n$. Since $\{e_1,...,e_n\}$ is a basis we know that the map which sends $e_i\to x_i$ for $1\leq i\leq n$ can be extended to a homomorphism of modules $\phi:A^n\to A^n$. It is obviously surjective because $x_1,x_2,...,x_n$ are all in the image of $\phi$. Now, there is a standard result that a surjective endomorphism of a finitely generated module is an isomorphism. Hence $\phi$ is an isomorphism, and so $\{x_1,...,x_n\}$ is a basis. Of course this solution wouldn't work if the set of generators had more than $n$ elements.
Now, you ask if $A^d\cong A^n$ implies $d=n$. The answer is yes. Let $M=A^n$ and suppose $\{e_1,...,e_r\}$ is some basis of $M$. Using Zorn's lemma we know that there exists some maximal ideal $I\subseteq A$. Then the quotient $M/IM$ is a vector space over the field $A/I$, where the scalar multiplication is $(a+I).(m+IM)=a.m+IM$. Try to show that $\{e_1+IM,...,e_r+IM\}$ is a basis of this vector space.
So, if $M$ has a basis of $r$ elements then $M/IM$ is an $r$-dimensional vector space over $A/I$. Since the dimension of a vector space is well defined, it follows that all bases of $M$ have the same number of elements.
Anyway, the second part of the question doesn't require that. If $\{x_1,...,x_d\}$ is a basis with $d<n$ then we again can define $\phi:A^n\to A^n$ which sends $e_i\to x_i$ for $1\leq i\leq d$ and, say, $e_i\to 0$ for $i>d$. It is a surjective endomorphism of a finitely generated module, and so has to be an isomorphism. But this is absurd, as it is clearly not injective.
