Is this function convex or non-convex?

Let

$$f(a,b,c,d) = \frac{(a-b) \cdot (c-d)}{\sqrt{(a-b)^2+(c-d)^2}}$$

where $a,b,c,d$ are variables. Is this function convex or non-convex?

• Why are you writing an equation? – Giuseppe Negro Feb 3 '13 at 18:45
• Assuming your function is the LHS, compute, say, $\frac{\partial^2}{\partial a^2}$ and notice it is negative for $a>b, c>d$... – user7530 Feb 3 '13 at 18:51
• What is(are) your variable(s) WRT convexity? – vonbrand Feb 3 '13 at 19:06
• updated and convexity only WRT two variables? – Nob Jame Feb 3 '13 at 19:40

We have $$\frac{\partial f}{\partial a} = \frac{c-d}{\sqrt{(a-b)^2+(c-d)^2}}-\frac{(a-b)^2(c-d)}{\left[(a-b)^2+(c-d)^2\right]^{3/2}}=\frac{(c-d)^3}{\left[(a-b)^2+(c-d)^2\right]^{3/2}}$$ $$\frac{\partial^2f}{\partial a^2} = -\frac{3(a-b)(c-d)^3}{\left[(a-b)^2+(c-d)^2\right]^{5/2}},$$ which is negative when $a>b$ and $c>d$. Therefore the Hessian of $f$ cannot be positive semi-definite, and so $f$ is not convex.

The pre-requisite of a function to be convex is: the domain set of the function must be convex. ( A set C is convex if and only if for any ${ x }_{ 1 },{ x }_{ 2 }\in C$, and any $\theta$ with $0\le \theta \le 1$: $$\theta { x }_{ 1 }+(1-\theta ){ x }_{ 2 }\in C$$

It's easy to show that the domain set of the function you have mentioned is not convex.

e.g. $$(x,0,y,0), \quad(0,x,0,y)\in dom \quad f$$

but $$\frac { 1 }{ 2 } (x,0,y,0)+(1-\frac { 1 }{ 2 } )(0,x,0,y)=\frac { 1 }{ 2 } (x,x,y,y)\notin dom\quad f$$

So the domain set of the function is not a convex set. Therefore the function is not a convex function.

Consider a line $c(t)=(t,-t,d+1,d)$, Then $\lim_{t\rightarrow \pm\infty} \ f=\pm 1$ so that $f$ is bounded on $c$. If $f$ is a convex, then $f$ is constant on $c$. So it is a contradiction.