# Derivative of bilinear form

Let $\mathbf{x}\in \Bbb{R}^n, \mathbf{y}\in \Bbb{R}^m$, and $\mathbf{A} \in \Bbb{R}^{n \times m}$. What is $\nabla_{\mathbf{x}}\mathbf{x}^{T}\mathbf{Ay}$?

I understand that Ay is a linear combination of the columns of A, where the coefficients are the entries of y:

[a1]y1 + [a2]y2 + ... + [a_m][y_m]

Thus, it results in a column vector of dim nx1. Let's call this column vector s = [s1 ... s_n].

I also understand that x.T dimension is 1xn, so this multiplication would result in a sum like:

x1*s1 + .... + x_n*s_n

I'm confused when it comes to the actual gradient, because if I'm taking it with respect to x I'm not sure how to express this in terms of the variables A and y. I don't know anything about the order of the members of x. If I knew they were all order 1, I'd be able to express this just as a sum of the terms in the s vector, but I think that x's members can be arbitrary order. Basically I have no idea where to go from here.

Let $f (\mathrm x) := \mathrm c^\top \mathrm x$. The directional derivative of $f$ in the direction of $\rm v$ at $\rm x$ is given by
$$\lim_{h \to 0} \frac{f (\mathrm x + h \, \mathrm v) - f (\mathrm x)}{h} = \mathrm c^\top \mathrm v = \langle \mathrm c, \mathrm v \rangle$$
and, thus, the gradient of $f$ is $$\nabla f (\mathrm x) = \mathrm c$$