# Solving inequality with logarithmic expression

I am trying to solve the following inequality

2 y(Log[1 + (y-1)x] - x Log[y]) - x(1 - x)(y - 1)^2 < 0


where

y > 1 && x < 1/2 && x > 0.


RegionPlot can handle my description but any other command (Reduce, Solve) can not. I would like Mathematica to help me extract an explicit relation between $$x$$ and $$y$$. Any help?

• Can you post the Mathematica code you tried? – Moo Dec 18 '19 at 13:40
• I strongly doubt that there is a closed-form solution to this equation for $x$ or $y$ in terms of elementary functions. In general, equations that can be solved for one variable or the other are the exception, not the rule. – Michael Seifert Dec 18 '19 at 14:57
• If I plot RegionPlot[2 y(Log[1 + (y-1)x]- x Log[y])- x(1-x)(y-1)^2<0, {x, 0, 0.5}, {y, 1, 1000}], graph suggests that for all x there exists a threshold y(x) above which the inequality is satisfied. I would like to extrapolate the threshold y(x), as I can't do it analytically. Impossible? Thanks for your replies – mathastri Dec 18 '19 at 15:58

Extending answer by user64494

Clear["Global*"]

\$Version

(* "12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)" *)

(data = Table[{y,
Reduce[2*y*(Log[1 + (y - 1)*x] - x*Log[y]) - x*(1 - x)*(y - 1)^2 < 0 &&
x >= 0 && x <= 1/2 && y > 1, x, Reals]}, {y, 11/10, 3, 1/10}]) //
Short[#, 3] &


The upper bound on x is 1/2 and the lower bound is a function of y. Use Interpolation to approximate the lower bound for a specified range of y.

xLowerBound = Interpolation[{#[[1]], #[[2, 1]]} & /@ data];


Plotting the range on x as a function of y

Plot[{1/2, xLowerBound[y]}, {y, 11/10, 3},
Filling -> {1 -> {2}}, Frame -> True,
FrameLabel -> (Style[#, 14, Bold] & /@ {y, xRange}),
PlotLegends ->
Placed[{"upper bound", "lower bound"}, {0.25, 0.25}]]


• Thanks a lot! I am working on your reply. – mathastri Dec 19 '19 at 9:57
• Thank you very much for your help, this is what I was looking for. I am not familiar with the interpolation command (and rather new to Mathematica in general), and even after checking the manual I do not fully understand what is inside the square brackets {#[[1]], #[[2, 1]]} & /@ data]. Thanks again – mathastri Dec 19 '19 at 23:41
• data elements have form {y, lowerbound < x <= upperbound}. {#[[1]], #[[2, 1]]} & is pure Function that extracts (using Part([[...]])) pair {y, lowerbound} from a data element. Pure function is mapped (/@) onto data to generate {y, lowerbound} pairs. {y, lowerbound} pairs are input to Interpolation to produce xLowerBound pure function. – Bob Hanlon Dec 20 '19 at 0:08

Here is an explanation. Up to the documentation to Reduce, the command solves transcendental inequalities, solvable using inverse functions. When trying

ClearAll[x, y];y = 2;Reduce[2 *y*(Log[1 + (y - 1)*x] - x* Log[y])- x*(1 - x)*(y - 1)^2 < 0&&
x >= 0 && x <= 1/2 && y > 1, x, Reals]


, the code is running for several minutes, resulting in

Reduce::nsmet: This system cannot be solved with the methods available to Reduce.

and

Root[{4 Log[1 + #] - # - 4 Log[2] # + #^2& , 0.3725223371480426622853562273078844506320.363517360744417}] < x <= 1/2

This means Mathematica is not able to solve the above inequality, making use of inverse functions, so Mathematica solves it numerically. Every soft has its limitations. Perhaps, this is impossible at all.

PS. A similar example is given in the "Exp-log equation" section.

• thank you for your time – mathastri Dec 18 '19 at 16:37

Since you can not get an analytical solution y[x], generate an interpolating function ysol[x] solving the differentiated equation with NDSolve. Get initial value with FindRoot.

g[x_, y_] = 2*y*(Log[1 + (y - 1)*x] - x*Log[y]) - x*(1 - x)*(y - 1)^2;

dgl = D[g[x, y[x]] == 0, x] // FullSimplify;

yfr = y /. First@FindRoot[g[1/3, y] == 0, {y, 5}]

ysol = y /. First@NDSolve[{dgl, y[1/3] == yfr}, y, {x, 10^-6, 1/2}]

p1 = RegionPlot[y > ysol[x], {x, 0, 1/2}, {y, 1, 200},
PlotPoints -> 50]

• +1. It's an unexpected approach. Can you kindly comment your code? A good code is a commented code. TIA. – user64494 Dec 18 '19 at 19:03
• Regard y as a function of x, y -> y[x]. When differentiating an equation, you get derivative terms, but equation is still valid. You can solve the found differential equation with initial value found from equation. – Akku14 Dec 18 '19 at 19:46
• This approach produces an incorrect result when slices consist of several intervals. – user64494 Dec 19 '19 at 10:48
• You can of course adapt it to that cases. This here is an answer to this question here. – Akku14 Dec 19 '19 at 11:04