Let $f(x): \mathbb{R}^n \to \mathbb{R}$ be a real-valued twice continuously differentiable function and $n>1$. I define the function $g(x) = f(x) + x^{\top} A x$ where $A$ is random matrix (say entries i.i.d from uniform distribution [-1,1]).
Can we say that the Hessian of $g$ is invertible for all $x$ with probability one? 



Question on Hessian of a function (probability question)
Here is my counterexample:
Take $f(x)=\|x\|^4$, then for any $x\neq 0$, by spherical symetry, $x$ is a eigenvector of $Hf|\_x$. we have then 
$$Hf|\_x(x)=a\|x\|^2 x $$
We can choose $x=v$ an eigenvector on $\frac{1}{2}(A+A^T)$. ie $\frac{1}{2}(A+A^T)(v)=\lambda v$ then with $t\in \mathbb{R}$
$$ (Hg)|\_{tv}=(Hf+A)|\_{tv}(v)=(a\|v\|^2 t^2 +\lambda) v $$
Therefore for $t^2=-\lambda/(a\|v \|^2)$. $Hg|\_{tv}(v)=0$ and it is then not invertible.


For a more general counterexample, take $f$ such that there exist $x\_1,x\_2$ with $det(Hf(x\_1))<0$ and $det(Hf(x\_2))>0$, then for comparatively small random matrix $A$, $det(Hf(x\_2)+A)>0$ and $det(Hf(x\_1)+A)<0$ and by continuity. There exist $x\_0$ such that $Hg(x\_0)$ is not invertible.


