<s>[INST] 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?
 [/INST] 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.
</s>