# How to express " log(1+1/xy)" in cvx?

We can prove that the Hessian matrix of function f(x,y)=log2(1+1/xy) is positive semidefinite when x>0 and y>0. So f(x,y) is a convex function. Can this function be expressed in cvx? Thanks all.

I presume you mean log2(1+1/(x*y))

If it can be done, maybe some combination of rotated quadratic cone (rotated_lotentz) and exponential cone. @Michal_Adamaszek perhaps might know.

Following the strategy from https://docs.mosek.com/modeling-cookbook/expo.html#log-sum-inv seems to work and gives for t\geq \log(1+1/(xy)) the DCP compliant model

t\geq \log(1+e^s)
xy\geq z^2 \geq e^{-s}

2 Likes

Thank you Mark! Michal gives the solution below.

Thank you Michal for your detailed reply! This helps me a lot!

So that the quadratic cone does not obfuscate it too much: the constraint e^s\geq \frac{1}{xy} required for the second part of the model is also representable as

s+\log x + \log y \geq 0

and this extends easily to a longer product in the denominator.

I am having the same problem. Looking at the link, I cant figure out how z^2 came about. Can you explain a little please?

The reason is that xy\geq z^2,\ x,y\geq 0 is what is normally referred to as the Lorentz cone in CVX terminology. The rest is just trying to fit this into the problem at hand. Luckily in this case the square does not make much difference because z\geq \exp(-s/2) is a good convex constraint. You can also use the other representation mentioned later in the thread if that is more intuitive.

Ok, thank you very much Michal. I understand.