Can someone explain what is the motivation behind the definition of a flat module? I saw the definition but I don't really know why it is important to work with these structures.
[Math] Motivation behind the definition of flat module
commutative-algebraflatnessmodulesmotivation
Related Solutions
Ideals were originally defined in analogy to numbers; in fact, "ideal" was used in place of Kummer's "ideal numbers" (which were introduced to provide a kind of "unique factorization" in the ring of cyclotomic integers $\mathbb{Z}[\zeta_p]$).
In this setting, the general philosophy is to translate divisiblity statements about numbers into statements about ideals, since every number corresponds to an ideal (the principal ideal it generates), but there may be ideals that don't correspond to "actual numbers" (the non-principal ideals).
In analogy to the integers, a number $p$ is prime if and only if $p\neq\pm 1$ and if $p|ab$, then $p|a$ or $p|b$. In the ideal-theoretic setting, divisibility was equivalent to containment, so the condition would be translated to "$(p)\neq (1)$ and $(ab)\subseteq (p)$ implies $(a)\subseteq (p)$ or $(b)\subseteq (p)$." Moving from principal to general ideals, we say the ideal $P$ is prime if and only if $P\neq R$ and if $AB\subseteq P$, then either $A\subseteq P$ or $B\subseteq P$.
From here, once the notion of ring was generalized away from rings-of-integers of number fields, the notion was kept.
(For commutative rings, the definition is equivalent to the statement "if $ab\in P$, then $a\in P$ or $b\in P$ ", but for noncommutative rings this condition is stronger; that is, if an ideal satisfies the element-theoretic version, then it is prime; but it can be prime and not satisfy the element-theoretic version; for example, in the ring of $2\times 2$ matrices over $\mathbb{R}$, the trivial ideal $(0)$ is prime, but there are certainly pairs of matrices, neither of them the zero matrix, whose product is the zero matrix.)
Addendum. Here is how Dedekind put it in Sur la Théorie des Nombres Entiers Algébriques (1877), translated as Theory of Algebraic Integers by John Stillwell, Cambridge University Press, 1966:
[L]et $\Omega$ be a field of finite degree $n$, and let $\mathfrak{o}$ be the domain of integers $\omega$ in $\Omega$. An ideal of this domain $\mathfrak{o}$ is a system $\mathfrak{a}$ of numbers $\alpha$ in $\mathfrak{o}$ with the following two properties:
I. The sum and difference of any two numbers in $\mathfrak{a}$ also belongs to $\mathfrak{a}$; that is, $\mathfrak{a}$ is a module.
II. The product $\alpha\omega$ of any number $\alpha$ in $\mathfrak{a}$ with a number $\omega$ in $\mathfrak{o}$ is a number in $\mathfrak{a}$.
...
We say that an ideal $\mathfrak{m}$ is divisible by an ideal $\mathfrak{a}$, or that it is a multiple of $\mathfrak{a}$, when all numbers in $\mathfrak{m}$ are also in $\mathfrak{a}$.
...
We finally remark that divisibility of the principal ideal $\mathfrak{o}\mu$ by the principal ideal $\mathfrak{o}\eta$ is completely equivalent to divisibility of the number $\mu$ by the number $\eta$. The laws of divisibility of numbers in $\mathfrak{o}$ are therefore included in the laws of divisibility of ideals.
...
An ideal $\mathfrak{op}$ is called prime when it is different from $\mathfrak{o}$ and divisible by no ideals except $\mathfrak{o}$ and $\mathfrak{p}$.
Later, Dedekind proves that in this context, $\mathfrak{m}\subseteq \mathfrak{n}$ if and only if there exists $\mathfrak{r}$ such that $\mathfrak{n}\mathfrak{r}=\mathfrak{m}$, establishing the link between "divisibility" in terms of inclusion, and divisibility in terms of multiplication, which holds in these kinds of rings but not in general. He called it the hardest part of the development.
The term "localization" is indeed taken from geometry. Consider the ring $R = C(\mathbb{R})$ (continuous real valued function on the real numbers) and the set $U$ of function that don't vanish at the origin. Clearly $U$ is multiplicative. Now, what is the geometric interpretation of $U^{-1}R$ ? If we are only interested in the behavior of functions near the origin, a function that doesn't vanish at the origin doesn't vanish in some open neighborhood of the origin. Therefore, by restricting such function to a small enough neighborhood, we get a non-vanishing function and therefore it is possible to take its (multiplicative) inverse. Thus, $U^{-1}R$ can be thought of as the result of concentrating attention to small neighborhoods of the origin and hence the name "localization".
In a general commutative ring we adopt the intuition of the geometric case and think of elements of the ring as "functions" on some "geometric object" whose points are the prime ideals of the ring. The full picture of this is given by the modern algebro-geometric concept of a scheme.
Best Answer
Flatness in commutative algebra satisfies a geometric condition: the fibers of a morphism between two varieties (schemes) don't vary too wildly. A flat morphism $f \colon X \to Y$ of varieties (schemes) can be thought as a continuous family of varieties (schemes) $\{ f^{-1} (y) \}_{y \in Y}$. An important theorem says that if $f \colon X \to Y$ is a flat morphism between two irreducible varieties then its fibers have dimensions equal to $\dim X - \dim Y$.
For example, fix an algebraically closed field $k$, and consider the morphism $f \colon \mathbb{A}^1 \to \mathbb{A}^1$ defined by $x \mapsto x^2$. It corresponds to the ring homomorphism $k[x^2] \hookrightarrow k[x]$. You should be able to prove that $k[x]$ is a flat $k[x^2]$-algebra (it is also free), hence the morphism $f$ is flat. The fibers are almost always made up of two points.
Consider the morphism $g \colon \mathbb{A}^2 \to \mathbb{A}^2$ defined by $(x,y) \mapsto (x, xy)$ (it is an affine chart of the blowing up of the plane). It corresponds to the ring homomorphism $k[x,xy] \hookrightarrow k[x,y]$. The fiber of the point $(0,0)$ is the line $\{ x= 0 \}$ which has dimension $1$, while the fiber of the other points is empty or made up of a single point. You should be able to check that $k[x,y]$ is not flat as $k[x,xy]$-algebra.