I am trying to track the definition of Lie differentiation. According to my notes:
Given $p\in\mathbb{R}^n$, the tangent space to $\mathbb{R}^n$ at $p$ is the set of pairs $$T_p\mathbb{R}^n=\{(p,v)\}; v\in\mathbb{R}^n.$$
Let $U$ be an open subset of $\mathbb{R}^n$. A vector field on $U$ is a function $v$ which assigns to each point $p\in U$ a vector $v(p)\in T_p\mathbb{R}^n$.
Given a fixed vector $v\in \mathbb{R}^n$, the function $p\in\mathbb{R}^n\rightarrow (p,v)$ is a vector field. Let $e_1,\ldots,e_n$ be the standard basis vectors of $\mathbb{R}^n$. If $v=e_i$, we will denote the vector field by $\dfrac{\partial}{\partial x_i}$.
If $f\in C^1(U)$, we define the Lie differentiation $L_vf$ to be the function on $U$ whose value at $p$ is given by $L_vf(p)=Df(p)v$.
So far so good. Now, the notes say:
If $v=\sum_{i=1}^n g_i\dfrac{\partial}{\partial x_i}$, where $g_i:U\rightarrow\mathbb{R}$ is the function $p\rightarrow g_i(p)$, then $$L_vf=\sum_{i=1}^n g_i\dfrac{\partial}{\partial x_i}f.$$
I'm absolutely confused here. Where does this formula come from? By the definition, $L_vf$ is a function from $U\subseteq \mathbb{R}^n$ to $\mathbb{R}^m$. Does the right-hand side also have the same domain and range?