# convexity of inner product of elementwise powers

For $x \in \mathbb{R}^n$ and $A,B \in \mathbb{R}^{m \times n}$, $f(x) = ((Ax)^{2})^T((Bx)^2)$

where $^2$ denotes the power of 2, element-by-element of vector Ax or Bx. (I wasn't sure how to notate this)

Is $f(x)$ convex? How can it be shown?

If the domain of $x$ is restricted to be $x$ nonnegative, then is it convex?

-
I guess you have to check the following: $f(tx_1+ (1-t)x_2) = tf(x_1)+ (1-t)f(x_2)$ for $x_1, x_2 \in \mathbb{R}^{n}$ and $t \in [0,1]$. –  PEV Feb 1 '11 at 17:28
Your function $f:\mathbb{R}^n\to\mathbb{R}$ is smooth. So just take the Hessian and see if it is positive (semi)definite. –  Willie Wong Feb 1 '11 at 18:41

No, it is not convex in general. Taking $A = \left[\begin{smallmatrix}1 & 0\end{smallmatrix}\right]$ and $B = \left[\begin{smallmatrix}0 & 1\end{smallmatrix}\right]$ your function is $f(x,y) = x^2y^2$. But $0.5 f(1,0) + 0.5 f(0,1) = 0 + 0 = 0 < 0.5^4 = f(0.5,0.5)$.