Q:

Gradients and functions on matrices

Given a twice differentiable $f: \Bbb R \to \Bbb R$, with continuous second order derivative.
We define $$F(x) = \sum_{i=1}^{m}f(x_i)$$ and $$L(x) = \sum_{i=1}^{m}f( \langle a_i, x \rangle+ b_i),$$ where $\langle \cdot , \cdot \rangle$ is the standard inner product
where $a_1, ..., a_m$ are in $\Bbb R^n$ and $b_1, ..., b_m$ are in $\Bbb R$.
Show that $$\nabla L(x) = A^T \nabla F(Ax+b)$$ and $$\nabla^2L(x) = A^T \nabla^2 F(Ax+b)A$$ where $A$ and $b$ are to be determined along with their respective dimension.
Anyone can tell me how to solve this?

A:

A partial answer. Let $b=(b_1, ..., b_m)^T$ and
$$A=\begin{pmatrix}a_1 \cdots\\
a_2 \cdots\\
\vdots \;\;\cdots\\
a_m \cdots \end{pmatrix}$$ (so $A$ is a $m \times n$ matrix). 
Then we have that 
$$\langle a_i, x \rangle + b_i = (Ax + b)_i.$$ So $L(x) = F(Ax + b)$. The first identity follows (you may need to write it all out to see it) and I guess the second one is not too difficult either.

