# Is this function convex?

I have a model - function of two vectors $A$ and $B$. I have data that I want to fit to the model and find the model's parameters. The function needs to be convex to find the parameters using optimization; my question is: is the function convex?

The parameters are vectors $A$ and $B$ of $N$ elements. The data is an array $N\times N$. The function models element $M_{i,j}$ of the array as

$$M_{i,j} = c_1 {A_iA_j\over{\sum{A}}} + c_2{A_iB_j+c_3A_jB_i\over{\sum{B}}}$$

And want to minimize

$$\sum|Data_{i,j}-M_{i,j}|^2$$

-
Are you asking whether the final sum is a convex function of $(A,B)$? –  Harald Hanche-Olsen Feb 27 '12 at 12:36
@HaraldHanche-Olsen: Yes –  Jakub M. Feb 27 '12 at 12:38
Have you tried computing the Hessian? Away from the hyperplanes $\sum A = 0$ and $\sum B = 0$ the function is algebraic, and can you can compute explicitly the Hessian. –  Willie Wong Feb 27 '12 at 13:38

As Willie suggests, taking the Hessian shows the function is not convex. Consider taking $N=2, c_2=0, c_1=1$ and $A_{1,2}>0$. Then the second derivatives are all negative.