How does one represent the gradient $\nabla \mathbf A$ of a vector field $\mathbf A$ as a matrix? I have been searching google about the gradient of a vector. I have found two distinct types of matrix notation for the gradient of a vector. I can't understand which one is correct, or if both are correct. The two are:
$$\nabla A = \partial_iA_je_i\otimes e_j=\begin{bmatrix}\frac{\partial A_1}{\partial X_1} &\frac{\partial A_2}{\partial X_1} & \frac{\partial A_3}{\partial X_1}\\\frac{\partial A_1}{\partial X_2} & \frac{\partial A_2}{\partial X_2} & \frac{\partial A_3}{\partial X_2}\\\frac{\partial A_1}{\partial X_3} & \frac{\partial A_2}{\partial X_3} & \frac{\partial A_3}{\partial X_3}\end{bmatrix}$$
or the transpose of the first, that is
$$\nabla A = \begin{bmatrix}\frac{\partial A_1}{\partial X_1} & \frac{\partial A_1}{\partial X_2} & \frac{\partial A_1}{\partial X_3}\\\frac{\partial A_2}{\partial X_1} & \frac{\partial A_2}{\partial X_2} & \frac{\partial A_2}{\partial X_3}\\\frac{\partial A_3}{\partial X_1}& \frac{\partial A_3}{\partial X_2}& \frac{\partial A_3}{\partial X_3}\end{bmatrix}.$$
 A: The matrix notation for the gradient of a vector field is generally not-that-well-defined, because as you note there are two reasonable matrix encodings (transposes of each other), which are about equally reasonable. Because of that, whenever the notation $\nabla\mathbf A$ as a matrix is used in the literature, the responsible thing to do is to specify explicitly which of the two encodings is meant.
Both of the two representations have features that make them reasonable:


*

*The second one you mention,
$$\nabla A = \begin{bmatrix}\frac{\partial A_1}{\partial X_1} & \frac{\partial A_1}{\partial X_2} & \frac{\partial A_1}{\partial X_3}\\\frac{\partial A_2}{\partial X_1} & \frac{\partial A_2}{\partial X_2} & \frac{\partial A_2}{\partial X_3}\\\frac{\partial A_3}{\partial X_1}& \frac{\partial A_3}{\partial X_2}& \frac{\partial A_3}{\partial X_3}\end{bmatrix},$$
has the contravariant index as a row index and the covariant index of the gradient as a column index, which is reflective of both of those natures. 

*On the other hand, the first representation in your post,
$$\nabla A =\begin{bmatrix}\frac{\partial A_1}{\partial X_1} &\frac{\partial A_2}{\partial X_1} & \frac{\partial A_3}{\partial X_1}\\\frac{\partial A_1}{\partial X_2} & \frac{\partial A_2}{\partial X_2} & \frac{\partial A_3}{\partial X_2}\\\frac{\partial A_1}{\partial X_3} & \frac{\partial A_2}{\partial X_3} & \frac{\partial A_3}{\partial X_3}\end{bmatrix},$$
has the nice property that if $\mathbf r$ and $\mathbf v$ are column vectors, then 
$$\mathbf r^T \cdot \nabla \mathbf A\cdot \mathbf v = x_i \frac{\partial A_j}{\partial x_i} v_j$$
matches what you would expect as a matrix product, i.e. matching the action of the operator $\mathbf r \cdot \nabla = x_i \frac{\partial}{\partial x_i}$.
For an example of this in action in the literature, see this paper of mine: to avoid confusion, it is important to specify both how the matrix representation is chosen, and how it acts via components. It takes an extra line and it adds a whole lot of clarity to the text.
A: The gradient of a function is well defined in the literature. The gradient of a vector field $A = A^i\partial_i$ seems to be the gradient of its components (which are functions). I think both matrix representations ($\partial_i A^j$ and $\partial_j A^i$) are "good" since they are simply representations of the same thing : $$\nabla A = (\partial_i A^j)dx^i\otimes \partial_j = (\partial_j A^i)dx^j \otimes \partial_i$$ Choose one of them and stay with it (at least until the end of the proof where you are using gradients of vector field).
Geometrically speaking, the gradient of a vector field you are talking about can be written either as the Lie derivative $\mathcal{L} A$ (along $\partial_i$ or $\partial_j$) or the covariant derivative $\nabla A$ (with vanishing Christoffel symbols $\Gamma$'s) (along $\partial_i$ or $\partial_j$). Both $\mathcal{L} A$ and $\nabla A$ are a little bit overkill for your setting (probably Euclidean flat space) but are good to keep in mind if you need to generalize from $\mathbb{R}^n$ to some manifold with global properties.
A: $\nabla A$ is a tensor and it acts on a vector, say $\mathbf{u}$, to produce another vector: $\mathbf{v}=\nabla A(\mathbf{u})$. In matrix representation, you multiply the matrix of $\nabla A$ with the specified column/row vector representing $\mathbf{u}$. If you write $\mathbf{u}$ as a column vector (usual convention) then the second matrix representation is the correct one, while if you write it as a row vector the first matrix representation is the correct one.
However matrix representation is not necessary. You have $\nabla A=\partial_iA_j~\mathbf{e}_i\otimes\mathbf{e}_j$, and the action of $\nabla A$ on $\mathbf{u}$ is defined to be the vector $\mathbf{v}=\partial_iA_j~\mathbf{e}_i(\mathbf{u})~\mathbf{e}_j=(\partial_iA_j)u_i~\mathbf{e}_j$. No more worries about how the matrix should be written.
