I am reading "Linear and Nonlinear Functional Analysis with Applications by Philippe G. Ciarlet ", which explains the origin of hamel basis by a problem:
Describe the set $F$ of all functions: $f: \mathbb{R} \rightarrow \mathbb{R}$ that satisfying the functional equation $$ f(x + y) = f(x) + f(y) $$ for all $x,y\in \mathbb{R}$
Actually I don't know how to describe this in a right way, and I always foucs on some concrete quality (for example, $f(0) = 0, f(x) = f(-x)$). Therefore, I don't figure out the connection between this and Hamel basis.
The connection is the following one. A linear function from $\mathbb{R}$ to $\mathbb{R}$, where $\mathbb{R}$ is considered as a vector space over itself, is a function $f$ that satisfies the following two equations: \begin{equation} \forall x,y \in \mathbb{R},\qquad f(x+y) = f(x) + f(y)\;,\qquad (1) \end{equation} \begin{equation} \forall x,\lambda \in \mathbb{R},\qquad f(\lambda \cdot x) = \lambda \cdot f(x)\;. \qquad (2) \end{equation} Notice that $(2)$ is equivalent to \begin{equation} \forall x \in \mathbb{R}, \qquad f(x) = x \cdot f(1)\;. \qquad (3) \end{equation} We may wonder if $(1)$ implies $(3)$. After all, if we only assume that $(1)$ holds, we have
It follows that $\forall q \in \mathbb{Q}, f(q) = q \cdot f(1)$, so $(3)$ is "almost" implied by $(1)$. But there's a catch. Pick $\sqrt{2}$. Then for each $q \in \mathbb{Q}$ we have that $q \neq -\sqrt{2}$. This implies that $1$ and $\sqrt{2}$ are linearly independent over $\mathbb{Q}$. Then, we can build $\tilde{f} \colon \mathbb{Q}[\sqrt{2}] \to \mathbb{R}$ as the unique linear function on $\mathbb{Q}[\sqrt{2}]$ (as a vector space over $\mathbb{Q}$) such that $\tilde{f}(1) = 1 = \tilde{f}(\sqrt{2})$. This function satisfies $\forall x,y \in \mathbb{Q}[\sqrt{2}], \tilde{f}(x+y) = \tilde{f}(x)+\tilde{f}(y)$ but fails to satisfy $\forall x \in \mathbb{Q}[\sqrt{2}], \tilde{f}(x) = x\cdot \tilde{f}(1)$, since $\tilde{f}(\sqrt{2}) = 1 \neq \sqrt{2} = \sqrt{2} \cdot 1 = \sqrt{2} \cdot \tilde{f}(1)$.
Now, we may repeat the process adding another number $\alpha \in \mathbb{R}$ such that $\alpha \notin \mathbb{Q}[\sqrt{2}]$ and extending the previous function so to preserve the property $$\forall x,y \in \mathbb{Q}[\sqrt{2}, \alpha], f(x+y) = f(x)+f(y).$$ Ideally, we want to continue this process of extension adding numbers until we "fill" the whole $\mathbb{R}$, so as to obtain in the end a function that satisfies $(1)$ but not $(3)$.
However, it is not clear how this can be formally done.
It's here that Hamel bases come to our aid: they provide a formal way to do that.
Consider $\mathbb{R}$ as a vector space over the field $\mathbb{Q}$. Since $1$ and $\sqrt{2}$ are linearly independent over $\mathbb{Q}$, we can build a Hamel basis for $\mathbb{R}$ over $\mathbb{Q}$ containing them, say $(e_i)_{i \in I}$, where $I$ is some set. Then, we can define a linear function (thinking $\mathbb{R}$ as a vector space over $\mathbb{Q}$), say $\bar{f} \colon \mathbb{R} \to \mathbb{R}$, that extends our previously defined linear function $\tilde{f} : \mathbb{Q}[\sqrt{2}] \to \mathbb{R}$. We can do this specifying its values over the base $(e_i)_{i \in I}$. For example, $\bar{f}(1) = 1 = \bar{f}(\sqrt{2})$, and $\forall i \in I \backslash \{1,\sqrt{2}\}, \bar{f}(e_i) = e_i$.
This way, by construction $\bar{f}$ satisfies $(1)$, but we already know that $(3)$ is violated since $\bar{f}$ is an extension of $\tilde{f}$, so that $\bar{f}(\sqrt{2}) = \tilde{f}(\sqrt{2}) \neq \sqrt{2} \cdot \tilde{f}(1) = \sqrt{2} \cdot \bar{f}(1)$. Some final (exotic) remarks: