1 Introduction

We start with very basic notions and notations. Given a real interval I we say that a function \(f:I \rightarrow \mathbb {R}\) is convex if for every \(x,y \in I\) and \(t\in [0,1]\),

$$\begin{aligned} f(tx+(1-t)y)\le tf(x)+(1-t)f(y).\end{aligned}$$

The most classical inequality for convex functions is stated in the following.

Theorem 1.1

Let \(f :I \rightarrow \mathbb {R}\) be a convex function and \(x,y\in I, \, x\ne y\). Then

$$\begin{aligned} f\left( \frac{x+y}{2}\right) \le \frac{1}{y-x}\int _x^y f (t) dt \le \frac{f(x)+f(y)}{2} . \end{aligned}$$
(1.1)

This celebrated integral inequality called now the Hermite–Hadamard inequality was introduced in the papers by Hermite [10] and Hadamard [9]. Let us note that (1.1) implies (Jensen) convexity of f, and that on the left- and right-hand sides we see the classical arithmetic means. Thus a more general inequality would be stated, for each (MN)-convex function, satisfying suitable conditions, guaranteeing the existence of the integralFootnote 1

$$\begin{aligned} f(M(x,y))\le \frac{1}{y-x}\int _x^y f (t) dt \le N(f(x),f(y)), \end{aligned}$$
(1.2)

where \(M:I^2\rightarrow \mathbb {R}\) and \(N:J^2 \rightarrow \mathbb {R}\) (here J is an interval containing f(I)) are means, that is, they satisfy the following definition.

Let \(I\subset \mathbb {R}\) be an interval. A function \(M:I^2\rightarrow \mathbb {R}\) is called a mean if

$$\begin{aligned} \min (x,y)\le M(x,y) \le \max (x,y) ,\quad x,y \in I. \end{aligned}$$
(1.3)

Every mean is reflexive, that is \(M(x,x)=x\) for all \(x \in I\). A mean M is called symmetric if \(M(x,y)=M(y,x)\) for all \(x,y \in I\), homogeneous if \(M(tx,ty)=tM(x,y)\) for \(t>0\) and all \(x,y \in I\) such that \(tx,ty \in I\), and M is said to be a strict mean if the inequalities in (1.3) are strict whenever \(x\ne y\). More information about means can be found for instance in Bullen, Mitrinović and Vasić [3].

Let us mention here that several authors have been dealing with (1.2) for different classes of means, and for functions f being taken from corresponding classes (see e.g. the list of references, and in particular Dragomir [4, 5], Dragomir and Mond [6], Dragomir and Pearce [7] or Gill, Pearce and Pečarić [8]).

One from the numerous generalizations of convexity is the notion of \(\log \)-convexity. A function \(f:I\rightarrow (0,\infty )\) is said to be \(\log \)-convex if \(\log \circ f\) is convex, or equivalently, if for all \(x,y\in I\) and \(t\in [0,1]\) one has the inequality

$$\begin{aligned} f(tx+(1-t)y)\le f(x)^{t}f(y)^{1-t}. \end{aligned}$$
(1.4)

Basing on the property that for two convex functions f and g with g increasing, the composition \(g\circ f\) is convex, it is worth observing that if \(\log \circ f\) is convex then so is \(f=\exp \circ \log \circ f\). However, the converse is not true (it is enough to take \(f(x)=x^2\) for \(x>0\)).

Applying (1.1) for a \(\log \)-convex function f we obtain the following inequality (see [8, Theorem 2.1] or [6, Theorem 2.5]):

$$\begin{aligned} f\left( \frac{x+y}{2}\right) \le \frac{1}{y-x}\int _{x}^{y} f(t)dt\le {\mathcal {L}}(f(x),f(y)), \end{aligned}$$
(1.5)

with the logarithmic mean \(\mathcal {L}\) on the right-hand side.

We can go further with generalizations. Let \(f:I \rightarrow \mathbb {R}\) and \(\varphi \) be an increasing function defined on the range of f. The function f is said to be \(\varphi \)-convex whenever \(\varphi \circ f\) is convex, that is, for all \(x,y \in I,\,t\in [0,1]\),

$$\begin{aligned} \varphi ( f(tx+(1-t)y))\le t\varphi ( f(x))+(1-t)\varphi ( f(y)), \end{aligned}$$

and if \(\varphi \) is one-to-one,

$$\begin{aligned} f(tx+(1-t)y)\le \varphi ^{-1}(t\varphi ( f(x)) +(1-t)\varphi ( f(y))). \end{aligned}$$
(1.6)

A special case of \(\varphi \)-convex functions is a class of r-convex functions defined on \((0,\infty )\), with \(\varphi (x)=\textrm{sign}\, r\cdot x^r\) for \(r \in \mathbb {R}\setminus \{0\}\) and \(\varphi (x)=\log x\) for \(r=0\). For the next result we need a notion of a generalization of logarithmic means, namely so called extended logarithmic means defined by

$$\begin{aligned} L_r(x, y):=\left\{ \begin{array}{ll} \displaystyle \frac{r}{r+1}\cdot \frac{y^{r+1}-x^{r+1}}{y^r-x^r}, &{} r \ne -1,0, \,x\ne y, \\ \displaystyle xy\frac{\log y-\log x}{y-x}, &{} r=-1, \, x\ne y ,\\ \displaystyle \frac{y-x}{\log y-\log x}, &{} r=0,\, x\ne y,\\ \displaystyle x, &{} x=y. \end{array}\right. \end{aligned}$$
(1.7)

Surely, for \(r=0\) we have \(L_0= {\mathcal {L}}.\)

The following result from [8] describes the extension of the (right-hand side of the) Hermite–Hadamard inequality for r-convex functions.

Theorem 1.2

Suppose \(f:I \rightarrow (0,\infty )\) is an r-convex function. Then

$$\begin{aligned} \frac{1}{y-x}\int _{x}^{y} f(t)dt\le L_r(f(x),f(y)). \end{aligned}$$
(1.8)

For \(p \in \mathbb {R}\) we define a function \( {L}^{[p]} :(0,\infty )^2 \rightarrow \mathbb {R}\) by the formula

$$\begin{aligned} {L}^{[p]}(x, y):=\left\{ \begin{array}{ll} \displaystyle \left( \frac{y^{p+1}-x^{p+1}}{(p+1)(y-x)}\right) ^{1 / p}\!\!, &{} p \ne -1,0, \,x\ne y, \\ \displaystyle \frac{y-x}{\log y-\log x}, &{} p=-1, \,x\ne y, \\ \displaystyle \frac{1}{e}\left( \frac{y^y}{x^x}\right) ^{1 /(y-x)}\!\!, &{} p=0, \,x\ne y,\\ x, &{} x= y, \end{array}\right. \end{aligned}$$
(1.9)

for all \( x,y \in (0,\infty )\). The function \( {L}^{[p]} \) is a symmetric, strict, homogeneous mean and it is called the generalized logarithmic mean of order p of x and y. As special cases of generalized logarithmic means we obtain the geometric mean (\(p=-2\)), the logarithmic mean (\(p=-1\)), the identric mean (\(p=0\)), the arithmetic mean (\(p=1\)). For no p the function \( {L}^{[p]}\) is the harmonic mean. (For more details cf., e.g., Bullen [2]).

A common generalization of (1.7) and (1.9) is given in the notion of Stolarsky means but we will not deal with such a generalization in the paper.

If I is open and \(f:I\rightarrow \mathbb {R}\) is differentiable with one-to-one derivative then by the Lagrange mean value theorem for every \(x,y \in I, \, x\ne y\), there exists a uniquely determined \(M_f(x,y)\) between x and y such that

$$\begin{aligned}\frac{f(x)-f(y)}{x-y}=f'\left( M_f(x,y) \right) .\end{aligned}$$

The assumption about f is satisfied by strictly convex, or strictly concave, continuously differentiable functions. The function \(M_f:I^2 \rightarrow I\) defined by

$$\begin{aligned} M_f(x,y) := \left\{ \begin{array}{ll} \displaystyle (f')^{-1}\left( \frac{f(y)-f(x)}{y-x}\right) , &{} x\ne y\\ x, &{} x=y \end{array} \right. \end{aligned}$$
(1.10)

is a mean on I and it is called a Lagrangian mean (see Berrone and Moro [1]). These means are reflexive, symmetric and strict. The generalized logarithmic means, \( {L}^{[p]}\), are examples of Lagrangian means (it is enough to take \(f(x)=x^{p+1}\) for \(p \ne -1,0\), \( f(x)=\log x\) for \( p=-1\), and \(f(x)=x \log x\) for \(p=0\)).

Some properties of Lagrangian means are expressed in the following two facts.

Fact 1

(see [3, Theorem 1, p. 344], [2, Theorems 29], [1, Corollary 7]) Lagrangian means are equal, \( M_{f}(x, y)=M_{g}(x, y)\) for all xy, if and only if for some \(\alpha , \beta , \gamma , \alpha \ne 0\),

$$\begin{aligned} f(x)=\alpha g(x)+\beta x+\gamma , \quad x \in \mathbb {R}. \end{aligned}$$

Fact 2

(see [3, Theorem 1, p. 346], [2, Theorems 30]) If a Lagrangian mean \(M_{f}\) is homogeneous then for some \(p\in \mathbb {R}\), and all x and y we have \( M_{f}(x, y)= {L}^{[p]}(x, y)\).

In the paper, we show how the right-hand side of the Hermite–Hadamard inequality looks like for a general \(\varphi \)-convex function and when the mean on the right-hand side is a Lagrangian mean like it is in the case of the logarithmic mean in (1.5).

2 Main Results

We proceed now with a theorem which generalizes inequalities (1.5) or (1.8).

Theorem 2.1

Suppose \(f :I \rightarrow \mathbb {R}\). Let \(\varphi \) be a continuous strictly increasing function defined on the range of f and \(\Phi \) – its primitive function. If f is a \(\varphi \)-convex function, then for all \(x,y\in I, \, x\ne y\),

$$\begin{aligned} \frac{1}{y-x}\int _{x}^{y}f(s)ds \le \Lambda _{\varphi }(f(x),f(y)), \end{aligned}$$
(2.1)

where

$$\begin{aligned} \Lambda _{\varphi }(x,y) := \left\{ \begin{array}{ll} \displaystyle \frac{y\varphi (y)-\Phi (y)- x\varphi (x)+\Phi (x)}{\varphi (y) -\varphi (x)}, &{} x\ne y,\\ x, &{} x=y. \end{array} \right. \end{aligned}$$
(2.2)

Proof

For fixed \(x,y \in I\) we integrate inequality (1.6) with respect to t, that is,

$$\begin{aligned} \int _{0}^{1}f(tx+(1-t)y)dt\le \int _{0}^{1}\varphi ^{-1}(t\varphi (f(x)) +(1-t)\varphi ( f(y)))dt. \end{aligned}$$
(2.3)

Starting with the left-hand side of (2.3), with the substitution \(s:=tx+(1-t)y\) we obtain

$$\begin{aligned} \int _{0}^{1}f(tx+(1-t)y)dt = \frac{1}{x-y}\int _{y}^{x}f(s)ds. \end{aligned}$$

For the right-hand side of (2.3), assume first that \(f(x)=f(y)\) in order to get f(x) as a result of integration. Suppose now \(f(x)\ne f(y)\). We shall use the so called Laisant formula, i.e.,

$$\int \varphi ^{-1}(z)dz = z\varphi ^{-1}(z)-\Phi (\varphi ^{-1}(z)) +C,$$

where \(\Phi \) is a primitive function of \(\varphi \) and C is an arbitrary constant.

With \(z:=t\varphi (f(x)) +(1-t)\varphi (f(y))\) we have

$$\begin{aligned}&\int _{0}^{1}\varphi ^{-1}(t\varphi (f(x)) +(1-t)\varphi (f(y)))dt \\&= \frac{1}{\varphi ( f(x)) -\varphi (f(y))}\int _{\varphi (f(y))}^{\varphi (f(x))}\varphi ^{-1}(z)dz\\&= \frac{1}{\varphi ( f(x)) -\varphi (f(y))} \Big [ z\varphi ^{-1}(z)-\Phi ( \varphi ^{-1}(z)) \Big ]_{\varphi (f(y))}^{\varphi (f(x))} \\&=\frac{f(x)\varphi (f(x))-\Phi (f(x))- f(y)\varphi (f(y))+\Phi (f(y))}{\varphi ( f(x)) -\varphi (f(y))} . \end{aligned}$$

This completes the proof. \(\square \)

Remark 2.1

Let us note that under the assumptions of the previous theorem, function \(\Lambda _{\varphi }\) given by the formula (2.2) is a strict mean. We obtain it by a direct computation, applying the Lagrange MVT to the function \(\Phi \).

Since the logarithmic mean is a special case of the Lagrangian means, we generalize the log-convexity in (1.4) to see if the inequality in (1.5) satisfied by log-convex functions can be generalized for Lagrangian means other than logarithmic ones.

In the next theorem, we consider the right hand side of inequality (2.1) to be the general form of the Lagrangian mean, generated by \(\varphi \) and solve the corresponding equation.

Theorem 2.2

Let \(\varphi \) be a strictly increasing real function from the class \( \mathcal {C}^3\), defined on an interval J, and with non-vanishing first and second derivatives. Then

$$\begin{aligned} \Lambda _{\varphi }(x,y)= M_{\varphi }(x,y), \end{aligned}$$
(2.4)

for all \(x,y \in J\), if and only if

$$\begin{aligned} \varphi (x)=\frac{1}{a}\log (ax+b) +c \end{aligned}$$
(2.5)

for some \(a,b,c \in \mathbb {R},\, a \ne 0,\) such that \(ax+b\) is positive for all \(x \in J\).

Proof

It is easy to check that \(\varphi \) given by (2.5) for suitable \(a, b, c\in \mathbb {R}\) is a solution of (2.4).

Solving (2.4) we immediately assume that \(x \ne y\). We have

$$\begin{aligned} \frac{x\varphi (x)-\Phi ( x) -y\varphi (y)+\Phi (y) }{\varphi (x)-\varphi (y)} = (\varphi ')^{-1}\left( \frac{\varphi (x) - \varphi (y)}{x-y}\right) . \end{aligned}$$
(2.6)

For solving (2.6), we denote

$$\Lambda (x,y):= \frac{x\varphi (x)-\Phi ( x) -y\varphi (y)+\Phi (y) }{\varphi (x)-\varphi (y)} $$

and

$$\begin{aligned} M(x,y):=(\varphi ')^{-1}\left( \frac{\varphi (x) - \varphi (y)}{x-y}\right) . \end{aligned}$$
(2.7)

Since

$$\begin{aligned} \varphi '(M(x,y))=\frac{\varphi (x) - \varphi (y)}{x-y},\end{aligned}$$

then, differentiating the above equality with respect to x, we get

$$ \varphi ''(M(x,y))\cdot \frac{\partial M}{\partial x}(x,y) =\frac{\varphi '(x)(x-y) - \varphi (x)+\varphi (y)}{(x-y)^2}, $$

and further, again differentiating the above with respect to x,  we obtain

$$\begin{aligned} \begin{aligned}&\varphi '''(M(x,y))\cdot \left[ \frac{\partial M}{\partial x}(x,y)\right] ^2+\varphi ''(M(x,y))\cdot \frac{\partial ^2 M}{\partial x^2}(x,y) \\&=\frac{\varphi ''(x)(x-y)^2-2[\varphi '(x)(x-y) - \varphi (x)+\varphi (y)] }{(x-y)^3}. \end{aligned} \end{aligned}$$
(2.8)

In what follows, we observe that there exists the limit of \(\frac{\partial ^2 M}{\partial x^2}(x,y)\) as y tends to x and we compute it. Indeed, we have

$$\begin{aligned} \lim _{y\rightarrow x} \frac{\partial M}{\partial x}(x,y) = \frac{1}{\varphi ''(x)}\cdot \lim _{y\rightarrow x}\frac{\varphi '(x)(x-y)-\varphi (x)+\varphi (y)}{(x-y)^2} . \end{aligned}$$
(2.9)

Since in view of de l’Hôpital’s rule

$$\begin{aligned} \lim _{y\rightarrow x} \frac{\varphi '(x)(x-y)-\varphi (x)+\varphi (y)}{(x-y)^2} = \lim _{y\rightarrow x} \frac{-\varphi '(x)+\varphi '(y)}{-2(x-y)} =\frac{\varphi ''(x)}{2}, \end{aligned}$$
(2.10)

combining (2.9) and (2.10) we get

$$\begin{aligned} \lim _{y\rightarrow x} \frac{\partial M}{\partial x}(x,y) = \frac{1}{2}. \end{aligned}$$
(2.11)

Further we have, again using de l’Hôpital’s rule,

$$\begin{aligned} \lim _{y\rightarrow x}\frac{\varphi ''(x)(x-y)^2-2[\varphi '(x)(x-y)-\varphi (x)+\varphi (y)]}{(x-y)^3} =\frac{\varphi '''(x)}{3}. \end{aligned}$$

Therefore, taking into account (2.8), there exists the limit of \(\frac{\partial ^2 M}{\partial x^2}(x,y)\) as \(y\rightarrow x\), and

$$\begin{aligned} \frac{1}{4} \varphi '''(x)+\varphi ''(x)\cdot \left( \lim _{y\rightarrow x} \frac{\partial ^2 M}{\partial x^2}(x,y)\right) =\frac{\varphi '''(x) }{3}.\end{aligned}$$

Finally,

$$\begin{aligned} \lim _{y\rightarrow x} \frac{\partial ^2 M}{\partial x^2}(x,y) = \frac{1}{12}\frac{\varphi '''(x)}{\varphi ''(x)} . \end{aligned}$$
(2.12)

Next we compute the partial derivatives of \(\Lambda \) with respect to x:

$$\begin{aligned}\begin{aligned} \frac{\partial \Lambda }{\partial x}(x,y) \; = \,&\, \varphi '(x)\cdot \frac{\varphi (y)(y-x)+\Phi (x)-\Phi (y)}{[\varphi (x)-\varphi (y)]^2},\\ \frac{\partial ^{2} \Lambda }{\partial x^{2}}(x,y) = \,&\,\varphi ''(x)\cdot \frac{\varphi (y)(y-x)+\Phi (x)-\Phi (y)}{[\varphi (x)-\varphi (y)]^2}\\&+\varphi '(x)\cdot \frac{[\varphi (x)-\varphi (y)]^2 -2\varphi '(x)[\varphi (y)(y-x)+\Phi (x)-\Phi (y)]}{[\varphi (x)-\varphi (y)]^3}. \end{aligned}\end{aligned}$$

In order to compute the limit of \(\frac{\partial ^2 \Lambda }{\partial x^2}(x,y)\) as \(y\rightarrow x\), first, applying de l’Hôpital’s rule, we compute the following limits:

$$\begin{aligned}\begin{aligned}&\lim _{y\rightarrow x} \frac{\varphi (y)(y-x)+\Phi (x)-\Phi (y)}{[\varphi (x)-\varphi (y)]^2}= \frac{1}{2\varphi '(x)},\\&\lim _{y\rightarrow x} \frac{[\varphi (x)-\varphi (y)]^2 -2\varphi '(x)[\varphi (y)(y-x)+\Phi (x)-\Phi (y)]}{[\varphi (x)-\varphi (y)]^3}=-\frac{\varphi ''(x)}{3[\varphi '(x)]^2}. \end{aligned}\end{aligned}$$

Therefore,

$$\begin{aligned} \lim _{y\rightarrow x} \frac{\partial ^2 \Lambda (x,y)}{\partial x^2}=\varphi ''(x)\cdot \frac{1}{2\varphi '(x)} - \varphi '(x)\cdot \frac{\varphi ''(x)}{3[\varphi '(x)]^2}= \frac{\varphi ''(x)}{6\varphi '(x)}. \end{aligned}$$
(2.13)

From (2.12) and (2.13) we derive that the solution \( \varphi \) of (2.6) satisfies

$$\begin{aligned} \frac{1}{12}\frac{\varphi '''(x)}{\varphi ''(x)}=\frac{1}{6}\frac{\varphi ''(x)}{\varphi '(x)}. \end{aligned}$$
(2.14)

That is,

$$\begin{aligned} \log |\varphi ''(x)|=2\log |\varphi '(x)|+\log C,\end{aligned}$$

with a positive C, whence

$$\begin{aligned} \varphi ''(x) =-a [\varphi '(x)]^2\end{aligned}$$

with a nonzero constant a. Further, since \(\varphi '(x)\) does not vanish, we have

$$\begin{aligned}\frac{\varphi ''(x)}{[\varphi '(x)]^2}=-a,\end{aligned}$$

whence it follows that

$$\begin{aligned}\varphi '(x)=\frac{1}{ax+b},\end{aligned}$$

and consequently, due to the fact that \(\varphi \) is strictly increasing,

$$\begin{aligned}\varphi (x)=\frac{1}{a}\log (ax+b) +c,\end{aligned}$$

with \(a,b,c \in \mathbb {R}, \, a \ne 0\), such that \(ax+b\) is positive for all \(x \in J\). \(\square \)

Remark 2.2

Actually, for solving (2.6) it is enough to assume in Theorem 2.2 that \(\varphi \) is invertible. Then

$$\begin{aligned} \varphi (x)=\frac{1}{a}\log |ax+b| +c\end{aligned}$$

with \(a,b,c \in \mathbb {R}, \, a \ne 0\), such that \(ax+b\) for all \(x \in J\) has a constant sign.

However, we assume that it is strictly increasing because such assumption appears in the definition of \(\varphi \)-convexity.

We conclude our considerations with the following.

Corollary 2.1

Suppose \(f :I \rightarrow (0,\infty )\). Let \(\varphi :(0,\infty )\rightarrow \mathbb {R}\) be a strictly increasing function from the class \(\mathcal {C}^3\) and with non-vanishing first and second derivatives. If \(\Lambda _{\varphi }(x,y)= M_{\varphi }(x,y)\), for all \(x,y \in I\), then the logarithmic mean is the only one (up to an affine transformation) which is both Lagrangian and of the form \(\Lambda _{\varphi }\). More exactly,

$$\begin{aligned} \Lambda _{\varphi }(x,y)= M_{\varphi }(x,y)=\frac{y-x}{\log (ay+b)-\log (ax+b)}-\frac{b}{a}\end{aligned}$$

for some \(a,b \in \mathbb {R}, \, a \ne 0\), such that \(ax+b\) is positive for all \(x \in J\).

Therefore, the logarithmic mean is the only (up to an affine transformation) Lagrangian mean satisfying the right-hand side of the Hermite–Hadamard inequality for \(\varphi \)-convex functions.