Continuity and differentiability of $f\colon M_n(\Bbb R) \to \Bbb R$ defined by $f(A) = \langle A^2x,x\rangle$, where $x \in \Bbb R^n$ is fixed I met with a multiple choice question:
Let $M_n(\mathbb{R})$ denote the space of all $n \times n$ real matrices identified with the Euclidean space $\mathbb{R}^{n^2}$. Fix a column vector $x \neq 0$ in $\mathbb{R}^n$. Define $f\colon M_n(\mathbb{R}) \to \mathbb{R}$ by $f(A) = \langle A^2x,x\rangle$. Then

*

*$f$ is linear


*$f$ is differentiable


*$f$ is continuous but not differentiable


*$f$ is unbounded
I know that $f$ is not linear since $f(-A) \neq -f(A)$ and I feel that $f$ cannot be bounded, how to deal with the boundedness, continuity and differentiability?
 A: Here are two hints that address your question(s).
For continuity and differentiability, you should write your map as a composition of other, simpler maps, and check continuity and differentiability at each step of the composition. Each piece is very easy to analyze, so you will be able to recognize if or when something breaks.
For boundedness, here is an example that shows the general idea. Suppose we're working with $2 \times 2$ matrices, and $x = (1,2)$. If I take $A_n = \begin{pmatrix} \sqrt{n} & 0 \\  0 & 0 \end{pmatrix}$, then $A^2_nx = \begin{pmatrix} n & 0 \\  0 & 0 \end{pmatrix} \begin{pmatrix}1 \\ 2 \end{pmatrix} = \begin{pmatrix} n \\ 0 \end{pmatrix}$, and dotting this again against $x$ gives $n \to \infty$.
So in general, try picking a very sparse matrix depending on $x$ which you can easily make unbounded.
A: So for differentiability note that $f(A)$ is a polynomial in the entries of $A$, hence it is differentiable (and of course also continous).
For unboundedness you can consider the matrix $A_\lambda = \lambda \frac{x x^t}{|x|^6} $ where $\lambda$ is an arbitrary constant. (This is proportional to the matrix that projects to the line given by $x$).
Then $f(A_\lambda)=\lambda^2$ hence $f$ is unbounded
A: We have $f(\lambda A)=\lambda ^2f(A).$ In particular $f(\lambda I)=\lambda^2.$ Let $u_{ij}$ denote the matrix with entry $1$ at the position $(i,j)$ and $0$ otherwise. Let $\{e_i\}_{i=}^n$ denote the standard basis in $\mathbb{R}^n.$Then $$ f(A+\delta u_{ij})= \delta^2x_ix_j+\delta\, [ x_j\langle Ae_i,x\rangle + x_i\langle Ax,e_j\rangle] +f(A)$$ Therefore $${\partial f\over \partial a_{ij}}=  x_j\langle Ae_i,x\rangle + x_i\langle Ax,e_j\rangle$$
