[Math] Gradient and Hessian of quadratic form

derivativeshessian-matrixmultivariable-calculusvector analysis

Let $\mathbf a, \mathbf x$ $\in$ $\mathbb R^n$, consider the function $f(\mathbf x)=\mathbf a^T\mathbf x$ and $g(\mathbf x)=(\mathbf a^T\mathbf x)^2$.

(a) Find $∇f(\mathbf x)$ and the Hessian $H_f(\mathbf x)$.

Using the comment below,

$f(x)=a^Tx=\sum_{i=1}^na_ix_i$

$\frac{\partial f}{\partial x_j}{(x)}=a_j$

Then,

$∇f(x) = $ \begin{bmatrix}
\frac{\partial f}{\partial x_1}(x) \\
\frac{\partial f}{\partial x_2}(x) \\
\vdots \\
\frac{\partial f}{\partial x_n} (x)
\end{bmatrix}

= \begin{bmatrix}
a_1 \\
a_2 \\
\vdots \\
a_n
\end{bmatrix}}

$H_f(x)= [∇f(x)]'=0$

(b) Show that $g(\mathbf x)$ is a quadratic form.

The quadratic form: $f(x)={x^TQx}=\sum_{i=1}^n q_{ii}x_i^2+ \sum_{1\leq i\neq j\leq n} q_{ij}x_ix_j$

I am having a difficulty understanding the 2 sums, I don't quite see the intuition behind it. But I understand

$f(x)=x^TQx$ and this does not equal to

$g(x)=(a^Tx)^2=(a^Tx)(a^Tx)=\sum_{i=1}^na_ix_i\sum_{i=1}^na_ix_i$

Perhaps, I don't know how to manipulate

$\sum_{i=1}^na_ix_i\sum_{i=1}^na_ix_i$ for it to look like

$\sum_{i=1}^n q_{ii}x_i^2+ \sum_{1\leq i\neq j\leq n} q_{ij}x_ix_j$

(c) Find $∇g(\mathbf x)$ and $H_g(\mathbf x)$ using part (b).

Best Answer

$a^T$ means transpose of the vector $a$. \begin{align} f(x) &= a^Tx \\ &= \sum_{i=1}^n a_i x_i \end{align}

$$\frac{\partial f(x)}{\partial x_j}=a_j$$

From there, hopefully you can write down $\nabla f$.

(b) $$(a^Tx)(a^Tx)=(x^Ta)(a^Tx)=x^T(aa^T)x$$

Identifying the corresponding $Q$ hopefully should be manageable.

Related Question