# Proving $q:\mathbb{R}^n \to \mathbb{R} \text{ with } q(x):= x^TAx$ totally differentiable

Let $$A \in \mathbb{R^n}$$ be a real $$n \times n$$ matrix.

How can I prove that the function $$q:\mathbb{R}^n \to \mathbb{R} \text{ with } q(x):= x^TAx$$

is totally differentiable on $$R^n$$ and find its total derivative in every point?

I know that I can use the Cauchy-Schwarz-inequality.

So I would have:

$$\vert\langle x|y\rangle\vert = x^Ty = \sum_{i=1}^n x_iy_i \leq (\sum_{i=1}^n x_i^2)^{1/2} (\sum_{i=1}^n y_i^2)^{1/2} = \left\lVert x \right\rVert_2 \left\lVert y \right\rVert_2$$ for all $$x,y \in \mathbb{R}^n$$.

I have also found the following: Differentiate $$f(x)=x^TAx$$

But in that thread total derivation isn't proven as well as using Cauchy-Schwarz-inequality.

I do not know what you mean by totally differentiable, but you can consider the composite function $$q = B \circ \psi$$ where $$\psi(x) =(x, x)$$ and $$B(x,y) = y^\intercal A x.$$ Apply the chain rule bearing in mind $$B'(x, y) \cdot (h, k) = B(x, k) + B(h, y).$$
EDIT: The chain rule states that if $$f$$ and $$g$$ are defined in open sets $$U$$ and $$V$$ such that $$f(U) \subset V$$ and they are both differentiable then $$g \circ f$$ is differentiable and $$(g \circ f)'(x) = g'(f(x)) \circ f'(x),$$ where the right hand side is composition of linear functions.
Now, the function $$q = B \circ \psi$$ so that $$q'(x) = B'(\psi(x)) \circ \psi'(x).$$ And if you want to evaluate in a vector $$h,$$ we have $$q'(x) \cdot h = B'(\psi(x)) \circ \psi'(x) \cdot h = B'(x,x) \cdot (h, h) = B(h, x) + B(x, h) = h^\intercal A x + x^\intercal A h.$$