1 Introduction

An identity due to Montgomery is used to acquire various novel inequalities, for example, Ostrowski type inequality, trapezoid inequality, Mohajani inequality, Čebysěv and Grüss inequalities.

The Montgomery identity given by Pečaríc in [18] is expressed as follows:

Let \(g: [c_{1}, d_{1}]\rightarrow\mathbb{R}\) and \(g': [c_{1}, d_{1}]\rightarrow\mathbb{R}\) be integrable, then

$$ g(x)=\frac{1}{d_{1}-c_{1}} \int^{d_{1}}_{c_{1}}g(p)\,dp+ \int ^{d_{1}}_{c_{1}}R(x,p)g'(p)\,dp , $$
(1)

where

$$R(x,p)=\left \{ \textstyle\begin{array}{l@{\quad}l} \frac{p-c_{1}}{d_{1}-c_{1}}, &{c_{1} \le p \le x},\\ \frac{p-d_{1}}{d_{1}-c_{1}}, &{x < p \le d_{1}} \end{array}\displaystyle \right \}. $$

Pečarić [20] obtained the weighted form of Montgomery identity which states that, for any \(x\in[c_{1}, d_{1}]\),

$$ g(x)= \int^{d_{1}}_{c_{1}}z(p)g(p)\,dp+ \int^{d_{1}}_{c_{1}}R_{z}(x,p)g'(p)\,dp, $$
(2)

where \(g: [c_{1}, d_{1}]\rightarrow\mathbb{R}\) is differentiable on \([c_{1}, d_{1}]\), \(g': [c_{1}, d_{1}]\rightarrow\mathbb{R}\) is integrable on \([c_{1}, d_{1}]\), and \(z: [c_{1}, d_{1}]\rightarrow [0,\infty\rangle\) is some normalized weight function, which satisfy \(\int^{d_{1}}_{c_{1}}z(p)\,dp=1\), and \(Z(p)=\int^{p}_{c_{1}}z(x)\,dx\) for \(p\in[c_{1}, d_{1}]\), \(Z(p)=0\) for \(p< c_{1}\), and \(Z(p)=1\) for \(p>d_{1}\). The weighted Peano kernel is

$$R_{z}(x,p)=\left \{ \textstyle\begin{array}{l@{\quad}l} Z(p), &{c_{1} \le p \le x},\\ Z(p)-1, &{x < p \le d_{1}}. \end{array}\displaystyle \right \}. $$

The theory of time scales was firstly presented by S. Hilger in 1988. With the help of time scale theory, difference and differential equations are solved by a unified approach. The solutions are obtained for a real-valued functions on a closed subset \(\mathbb{T}\) of \(\mathbb {R}\) by extending the standard methods of calculus. Based on time scales theory [7, 9, 10], further studies on integral inequalities on time scales are noted in literature. Bohner and Matthews [8] used time scale theory as a reference to obtain the time-scaled Montgomery identity and particular Ostrowski inequality.

Theorem 1

([8, Lemma 3.1])

Let \(c_{1},d_{1},s,p \in\mathbb{T}\), \(c_{1}< d_{1}\), and \(g:[c_{1}, d_{1}]_{\mathbb{T}}=[c_{1}, d_{1}]\bigcap\mathbb{T} \to\mathbb{R}\) be differentiable, then

$$ g(p)=\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s + \frac{1}{d_{1}-c_{1}} \int_{c_{1}}^{d_{1}} R(p,s)g^{\Delta }(s)\Delta s, $$
(3)

where

$$R(p,s)=\left \{ \textstyle\begin{array}{l@{\quad}l} {s - c_{1}}, &{c_{1} \le s \le p},\\ {s - d_{1}}, &{p < s \le d_{1}} \end{array}\displaystyle \right \}. $$

The weighted Montgomery identity given in [21] on time scales is stated as follows.

Theorem 2

Let \(c_{1},d_{1},s,p \in\mathbb{T}\), \(c_{1}< d_{1}\), and \(g:[c_{1}, d_{1}]_{\mathbb{T}}=[c_{1}, d_{1}]\bigcap\mathbb{T} \to\mathbb{R}\) be differentiable, then

$$ g(p)= \int _{c_{1}}^{d_{1}} z(s)g^{\sigma}(s)\Delta s + \int _{c_{1}}^{d_{1}} R_{z}(p,s)g^{\Delta}(s) \Delta s, $$
(4)

where

$$ R_{z}(p,s)=\left \{ \textstyle\begin{array}{l@{\quad}l} Z(s), &{c_{1} \le s \le p},\\ Z(s)-1, &{p < s \le d_{1}} \end{array}\displaystyle \right \}, $$
(5)

and \(z:[c_{1}, d_{1}]_{\mathbb{T}}\rightarrow[0,\infty), \int _{c_{1}}^{d_{1}}z(p)\Delta p=1\),

$$ Z(p)=\left \{ \textstyle\begin{array}{l@{\quad}l} \int_{c_{1}}^{p}z(x)\Delta x, & {p\in[c_{1}, d_{1}],} \\ 0, & {p< c_{1},} \\ 1, & {p>d_{1}} \end{array}\displaystyle \right . $$
(6)

In this paper, an extension of Montgomery identity (3) is obtained by using the time scale versions of Taylor series which can be found in [1, 2, 11]. The obtained Montgomery identity [3, 1417] is further used for time-scaled trapezoid and Ostrowski type inequalities [5, 6, 12, 19, 22]. Additionally, uncommon instances of Ostrowski inequality include a generalized mid-point inequality. Finally, the extension of (4) and the respective Ostrowski inequality is discussed.

2 Preliminary results

Some basic essentials regarding theory of time scales can be found in [7, 9, 10]. Few of which are given here: Generalized polynomials on time scales are the functions \(u_{l},v_{l}:\mathbb{T}^{2} \rightarrow\mathbb{R}, l \in\mathbb{N}_{0}\) defined recursively as follows: \(u_{0}(p,s)=v_{0}(p,s)=1\), \(\forall p,s \in\mathbb{T}\) and for given \(u_{l},v_{l} \hbox{ with } l \in\mathbb{N}_{0}\),

$$v_{l+1}(p,s)= \int _{s}^{p} v_{l}(\tau,s)\Delta \tau,\qquad u_{l+1}(p,s)= \int _{s}^{p} u_{l}\bigl(\sigma( \tau),s\bigr)\Delta\tau. $$

If \(v_{l}^{\Delta}(p,s)\) presents each fixed \(s\in\mathbb{T}\), the derivative for \(v_{l+1}(p,s)\) with respect to p is

$$v_{l+1}^{\Delta}(p,s)=v_{l}(p,s), \qquad u_{l+1}^{\Delta}(p,s)=u_{l}\bigl(\sigma (p),s \bigr)\quad \hbox{for } l \in\mathbb{N}_{0}, p \in \mathbb{T}^{k}, $$

where

$$\mathbb{T}^{k}=\left \{ \textstyle\begin{array}{l@{\quad}l} \mathbb{T}-(\rho(\sup\mathbb{T}), \sup\mathbb{T}] & \text{if }\sup\mathbb {T}< \infty, \\ \mathbb{T} & \text{if }\sup\mathbb{T}=\infty. \end{array}\displaystyle \right \}. $$

Also

$$v_{l}(p,s)=(-1)^{l}u_{l}(s,p). $$

Taylor formula for random time scale \(\mathbb{T}\) is stated below.

Theorem 3

([9, Theorem 1.113])

Let \(m \in\mathbb{N}\), g be m times differentiable on \(\mathbb {T}^{k^{m}}\). Let \(\alpha\in\mathbb{T}^{k^{m-1}}\), \(p \in\mathbb{T}\), then we have

$$ g(p)=\sum_{l = 0}^{m-1} {{v_{l}}(p,\alpha){g^{{\Delta^{l}}}}(\alpha )} + \int _{\alpha}^{{\rho^{m - 1}}(p)} {{v_{m - 1}}\bigl(p, \sigma (\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta\tau}, $$
(7)

where \(v_{l}: \mathbb{T}^{2} \to\mathbb{R}\), \(l\in\mathbb{N}_{0}\) represents the generalized polynomial defined above.

In order to deal with double integrals on time sales, Basşak Karpuz [13, Lemma 1] proved the following result for exchange of integrals.

Lemma 1

Assume \(s, p \in\mathbb{T}\) and \(G\in C_{rd}(\mathbb{T}\times\mathbb {T},\mathbb{R})\). Then

$$\int _{s}^{p} \int _{\eta}^{p} G(\eta,\xi)\Delta\xi\Delta \eta= \int _{s}^{p} \int _{s}^{\sigma(\xi)} G(\eta,\xi)\Delta \eta\Delta\xi. $$

In a similar fashion, results obtained are shown below.

Lemma 2

Assume \(s, p \in\mathbb{T}\) and \(G\in C_{rd}(\mathbb{T}\times\mathbb {T},\mathbb{R})\). Then

$$\int _{s}^{p} \int _{s}^{\eta} G(\eta,\xi)\Delta\xi\Delta \eta= \int _{s}^{p} \int _{\sigma(\xi)}^{p} G(\eta,\xi)\Delta \eta\Delta\xi. $$

Proof

Let

$$ g(p):= \int _{s}^{p} \int _{s}^{\eta} G(\eta,\xi)\Delta\xi \Delta\eta- \int _{s}^{p} \int _{\sigma(\xi)}^{p} G(\eta,\xi )\Delta\eta\Delta\xi $$

for \(p\in\mathbb{T}\). Then, by taking derivative and applying [9, Theorem 1.117], we have

$$\begin{aligned}& \begin{aligned} g^{\Delta}(p)&:= \biggl( \int _{s}^{p} \int _{s}^{\eta} G(\eta ,\xi)\Delta\xi\Delta\eta \biggr)^{\Delta} - \biggl( \int _{s}^{p} \int _{\sigma(\xi)}^{p} G(\eta,\xi)\Delta\eta\Delta\xi \biggr)^{\Delta } \\ &= \int _{s}^{p} f(p,\xi)\Delta\xi- \int _{s}^{p}\frac {\partial}{\partial p} \biggl( \int _{\sigma(\xi)}^{p}f(\eta,\xi)\Delta \eta\biggr)\Delta \xi- \int _{\sigma(p)}^{\sigma(p)}f(\eta, \xi)\Delta \eta \end{aligned}\\& g^{\Delta}(p):= \int _{s}^{p}f(p,\xi)\Delta\xi- \int _{s}^{p}f(p,\xi)\Delta\xi= 0, \end{aligned}$$

which proved the required result. □

Remark 1

From [9, Theorem 1.109], it is straightforward that

$$ u_{m}\bigl({\rho}^{l}(p),p\bigr)=0 \quad \forall m \in \mathbb{N}, 0\le l \le m-1. $$

Lemma 3

The functions \(u_{m}, m\in\mathbb{N}\) defined above satisfy, for all \(p\in\mathbb{T}\),

$$ u_{m}\bigl(p,{\rho}^{l}(p)\bigr)=0 \quad \forall m \in\mathbb{N}, 0\le l \le m-1. $$
(8)

Proof

Here, the induction method is used to prove the result. For \(l=0\),

$$ u_{m}\bigl(p,\rho^{0}(p)\bigr)=u_{m}(p,p)=0. $$

To conclude the induction, it will be sufficient that

$$ u_{m-1}\bigl(p,\rho^{l}(p)\bigr)=u_{m} \bigl(p,\rho^{l}(p)\bigr)=0, \quad0\leq l< m, $$

implies that

$$ u_{m}\bigl(p,\rho^{l+1}(p)\bigr)=0. $$

If \(\rho^{l}(p)\) is left-dense, then \(\rho^{l+1}(p)=\rho^{l}(p)\) so that

$$ u_{m}\bigl(p,\rho^{l+1}(p)\bigr)=u_{m} \bigl(p,\rho^{l}(p)\bigr)=0. $$

If \(\rho^{l}(p)\) is not left-dense, then it is left-scattered and \(\sigma(\rho^{l+1}(p))=\rho^{l}(p)\), therefore by [9, Theorem 1.16(iv)] we have

$$\begin{aligned} u_{m}\bigl(p,\rho^{l+1}(p)\bigr) =&u_{m} \bigl(p,\sigma\bigl(\rho^{l+1}(p)\bigr)\bigr)-\mu\bigl(\rho ^{l+1}(p)\bigr)u_{m}^{\Delta}\bigl(p, \rho^{l+1}(p)\bigr) \\ =&u_{m}\bigl(p,\rho^{l}(p)\bigr)-\mu\bigl( \rho^{l+1}(p)\bigr)u_{m-1}\bigl(p,\sigma\bigl(\rho ^{l+1}(p)\bigr)\bigr) \\ =&u_{m}\bigl(p,\rho^{l}(p)\bigr)-\mu\bigl( \rho^{l+1}(p)\bigr)u_{m-1}\bigl(p,\rho^{l+1}(p) \bigr)=0. \end{aligned}$$

It proves our claim. □

The lemma shown below is helpful in proving the main result.

Lemma 4

The function \(v_{l}\) for \(p \in\mathbb{T}\) satisfies

$$ v_{m}\bigl({\rho}^{l}(p),\sigma(p) \bigr)=0, \quad \forall m \in\mathbb{N}, 0\le l \le m-2. $$
(9)

Proof

By using Lemma 3, we can write \(u_{m}(p,{\rho}^{l}(p))=0 \) \(\forall m \in\mathbb{N}\), \(0\le l \le m-1\). It is known that \(v_{m}(p,s)=(-1)^{m} u_{m}(s,p)\), \(\forall m \in\mathbb{N}\). Thus we have

$$v_{m}\bigl({\rho}^{l}(p),p\bigr)=0, \quad \forall m \in \mathbb{N}, 0\le l \le m-1. $$

By using [9, Theorem 1.16(iv)],

$$\begin{aligned}& v_{m}\bigl({\rho}^{l}(p),\sigma(p)\bigr)=v_{m} \bigl({\rho}^{l}(p),p\bigr)+\mu(p)v_{m-1}\bigl({ \rho}^{l}(p),p\bigr) \\& \quad \Rightarrow \quad v_{m}\bigl({\rho}^{l}(p),\sigma(p)\bigr)=0, \quad \forall m \in\mathbb {N}, 0\le l \le m-2. \end{aligned}$$

 □

3 Generalization of Montgomery identity on time scales

Theorem 4

Let \(m \in\mathbb{N}\), g be m times differentiable on \(\mathbb {T}^{k^{m}}\). Let \(p \in\mathbb{T}\), then we have

$$\begin{aligned} g(p) =&\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s \\ &{}+\frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m- 2} {{g^{{\Delta^{l + 1}}}}} (c_{1}) \biggl\{ {v_{l + 1}}(p,c_{1}) (p-c_{1}) - \int _{c_{1}}^{p} {{v_{l + 1}}} \bigl( \sigma(s),c_{1}\bigr)\Delta s \biggr\} \\ &{}+\frac{1}{d_{1}-c_{1}}\sum_{l= 0}^{m - 2} {{g^{{\Delta^{l+ 1}}}}} (d_{1}) \biggl\{ \int _{d_{1}}^{p} {{v_{l+ 1}}} \bigl(\sigma (s),d_{1}\bigr)\Delta s-{v_{l + 1}}(p,d_{1}) (p-d_{1}) \biggr\} \\ &{}+ \frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} {Q_{m}}(p,\tau )g^{{\Delta^{m}}}(\tau)\Delta\tau, \end{aligned}$$
(10)

where

$$ {Q_{m}}(p,\tau) = \left [ { \textstyle\begin{array}{*{20}{c}} {{v_{m - 1}}(p,\sigma(\tau))(p-c_{1}) - \int _{{\rho^{m- 3}}(\tau)}^{p} {{v_{m - 1}}(\sigma(s),\sigma(\tau))} \Delta s,\tau \in [ {c_{1},p} )},\\ {{v_{m - 1}}(p,\sigma(\tau))(p-d_{1}) - \int _{{\rho^{m - 3}}(\tau)}^{p} {{v_{m - 1}}(\sigma(s),\sigma(\tau))} \Delta s,\tau \in[p,d_{1}].} \end{array}\displaystyle } \right ] $$

Proof

Suppose that \(g^{\Delta}\) is \(m-1\) times differentiable, then by replacing m with \(m-1\), g with \(g^{\Delta}\), and \(\alpha=c_{1}\) in (7), we have

$$ g^{\Delta}(p)=\sum_{l = 0}^{m - 2} {{v_{l}}(p,c_{1}){g^{\Delta ^{l+1}}}(c_{1})} + \int _{c_{1}} ^{{\rho^{m - 2}}(p)} {{v_{m - 2}}\bigl(p, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta\tau}. $$
(11)

Replace \(c_{1}\) with \(d_{1}\) in (11) to get

$$ g^{\Delta}(p)=\sum_{l= 0}^{m - 2} {{v_{l}}(p,d_{1}){g^{\Delta ^{l+1}}}(d_{1})} + \int _{d_{1}}^{{\rho^{m- 2}}(p)} {{v_{m - 2}}\bigl(p, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta\tau}. $$
(12)

We can rewrite (3) as

$$\begin{aligned} g(p) =&\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s + \frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{p} (s-c_{1})g^{\Delta}(s) \Delta s \\ &{}+\frac{1}{d_{1}-c_{1}} \int _{p}^{d_{1}} (s-d_{1})g^{\Delta }(s) \Delta s. \end{aligned}$$
(13)

By using (11) and (12) in (13),

$$\begin{aligned} g(p) =&\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s \\ &{}+ \frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{p} (s-c_{1})\sum _{l = 0}^{m - 2} {{v_{l}}(s,c_{1}){g^{\Delta^{l+1}}}(c_{1})} \Delta s \end{aligned}$$
(14)
$$\begin{aligned} &{}+ \frac{1}{d_{1}-c_{1}} \int _{p}^{d_{1}} (s-d_{1})\sum _{l= 0}^{m - 2} {{v_{l}}(s,d_{1}){g^{\Delta^{l+1}}}(d_{1})} \Delta s \end{aligned}$$
(15)
$$\begin{aligned} &{}+\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{p} (s-c_{1}) \int _{c_{1}}^{{\rho^{m-2}}(s)} {{v_{m - 2}}\bigl(s, \sigma(\tau)\bigr){g^{{\Delta ^{m}}}}(\tau)\Delta\tau}\Delta s \end{aligned}$$
(16)
$$\begin{aligned} &{}-\frac{1}{d_{1}-c_{1}} \int _{p}^{d_{1}} (s-d_{1}) \int _{{\rho^{m- 2}}(s)}^{d_{1}} {{v_{m- 2}}\bigl(s, \sigma(\tau)\bigr){g^{{\Delta ^{m}}}}(\tau)\Delta\tau}\Delta s. \end{aligned}$$
(17)

By making calculations for integral in (14),

$$\begin{aligned}& \int _{c_{1}}^{p} {(s - c_{1})} \sum _{l= 0}^{m- 2} {{v_{l}}(s,c_{1}){g^{{\Delta^{l + 1}}}}(c_{1})} \Delta s \\& \quad = \sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}(c_{1})} \int _{c_{1}}^{p} {(s - c_{1})} {v_{l}}(s,c_{1})\Delta s \\& \quad = \sum_{l= 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}(c_{1})} \int _{c_{1}}^{p} {v_{l+ 1}^{\Delta}} (s,c_{1}){v_{1}}(s,c_{1})\Delta s \\& \quad = \sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}(c_{1})} \biggl\{ {{v_{l + 1}}(p,c_{1}){v_{1}}(p,c_{1}) - \int _{c_{1}}^{p} {{v_{l + 1}}} \bigl( \sigma(s),c_{1}\bigr)\Delta s} \biggr\} \\& \quad =\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}(c_{1})} \biggl\{ {{v_{l + 1}}(p,c_{1}) (p-c_{1}) - \int _{c_{1}}^{p} {{v_{l + 1}}} \bigl( \sigma(s),c_{1}\bigr)\Delta s} \biggr\} . \end{aligned}$$
(18)

Similarly (15) gives

$$\begin{aligned}& \int _{p}^{d_{1}} {(s - d_{1})} \sum _{l = 0}^{m - 2} {{v_{l}}(s,d_{1}){g^{{\Delta^{l + 1}}}}(d_{1})} \Delta s \\& \quad =\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}(d_{1})} \biggl\{ { \int _{d_{1}}^{p} {{v_{l + 1}}} \bigl( \sigma(s),d_{1}\bigr)\Delta s - {v_{l + 1}}(p,d_{1}) (p-d_{1})} \biggr\} . \end{aligned}$$
(19)

By using Lemma 2, integral in (16) takes the following form:

$$\begin{aligned}& \int _{c_{1}}^{p} {(s - c_{1})} \int _{c_{1}}^{{\rho^{m - 2}}(s)} {{v_{m - 2}}\bigl(s, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta \tau} \Delta s \\& \quad = \int _{c_{1}}^{p} {{g^{{\Delta^{m}}}}(\tau)} \int _{{\rho ^{m - 3}}(\tau)}^{p} {(s - c_{1}){v_{m - 2}} \bigl(s,\sigma(\tau)\bigr)\Delta s} \Delta\tau \\& \quad = \int _{c_{1}}^{p} {{g^{{\Delta^{m}}}}(\tau)} \int _{{\rho ^{m - 3}}(\tau)}^{p} {v_{m - 1}^{\Delta}\bigl(s,\sigma(\tau )\bigr){v_{1}}(s,c_{1})\Delta s} \Delta\tau \\& \quad = \int _{c_{1}}^{p} {{g^{{\Delta^{m}}}}(\tau)} \bigl\{ {v_{m - 1}}\bigl(p,\sigma(\tau)\bigr){v_{1}}(p,c_{1}) -{v_{m- 1}}\bigl({\rho^{m - 3}}(\tau ),\sigma(\tau) \bigr){v_{1}}\bigl({\rho^{m- 3}}(\tau),c_{1} \bigr) \bigr\} \Delta\tau \\& \qquad {}- \int _{c_{1}}^{p} {{g^{{\Delta^{m}}}}(\tau)} \int _{{\rho^{m - 3}}(\tau)}^{p} {{v_{m - 1}}\bigl( \sigma(s),\sigma(\tau)\bigr)} \Delta s\Delta\tau. \end{aligned}$$

Lemma 4 implies \({v_{m - 1}}({\rho^{m - 3}}(\tau),\sigma(\tau))=0\).

$$\begin{aligned}& \Rightarrow \int _{c_{1}}^{p} {(s -c_{1})} \int _{c_{1}}^{{\rho^{m - 2}}(s)} {{v_{m - 2}}\bigl(s, \sigma(\tau)\bigr){g^{{\Delta ^{m}}}}(\tau)\Delta\tau} \Delta s \\& \qquad = \int _{c_{1}}^{p} {{g^{{\Delta^{m}}}}(\tau)} \biggl\{ {v_{m - 1}}\bigl(p,\sigma(\tau)\bigr) (p-c_{1}) - \int _{{\rho^{m- 3}}(\tau)}^{p} {{v_{m - 1}}\bigl( \sigma(s),\sigma (\tau)\bigr)} \Delta s \biggr\} \Delta\tau. \end{aligned}$$
(20)

Similarly, we have

$$\begin{aligned}& \int _{p}^{d_{1}} {(s - d_{1})} \int _{{\rho^{m - 2}}(s)}^{d_{1}} {{v_{m- 2}}\bigl(s, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau )\Delta\tau} \Delta s \\& \quad = \int _{d_{1}}^{p} {(s - d_{1})} \int _{d_{1}}^{{\rho^{m - 2}}(s)} {{v_{m - 2}}\bigl(s, \sigma(\tau )\bigr){g^{{\Delta^{m}}}}(\tau)\Delta\tau} \Delta s \\& \quad = \int _{d_{1}}^{p} {{g^{{\Delta^{m}}}}(\tau)} \biggl\{ {v_{m - 1}}\bigl(p,\sigma(\tau)\bigr) (p-d_{1}) - \int _{{\rho^{m- 3}}(\tau)}^{p} {{v_{m - 1}}\bigl( \sigma(s),\sigma(\tau)\bigr)} \Delta s \biggr\} \Delta\tau \\& \quad = - \int _{p}^{d_{1}} {{g^{{\Delta^{m}}}}(\tau)} \biggl\{ {v_{m - 1}}\bigl(p,\sigma(\tau)\bigr) (p-d_{1}) - \int _{{\rho^{m - 3}}(\tau)}^{p} {{v_{m - 1}}\bigl( \sigma(s),\sigma(\tau)\bigr)} \Delta s \biggr\} \Delta\tau. \end{aligned}$$
(21)

Use (18)–(21) in (14)–(17) respectively to get the ideal outcome. □

Example 1

  • By using \(\mathbb{T} =\mathbb{R}\) in (10), we get [4, Remark 1].

  • For \(\mathbb{T}=\mathbb{Z}\), (10) transforms as

    $$\begin{aligned} g(p) =& \frac{1}{{d_{1}- c_{1}}}\sum_{s = c_{1}+1}^{d_{1}} {g(s)} \\ &{}+ \frac{1}{{d_{1} - c_{1}}}\sum_{l= 1}^{m - 1} {{\Delta^{l }}g} (c_{1}) \biggl\{ \frac{{(p - c_{1}){{(p - c_{1})}^{(l)}}}}{{(l)!}} - \frac{{{{(p + 1 - c_{1})}^{(l + 1)}}}}{{(l + 1)!}} \biggr\} \\ &{}+ \frac{1}{{d_{1} -c_{1}}}\sum_{l = 1}^{m - 1} {\Delta ^{l}}g(d_{1}) \biggl\{ \frac{{{{(p + 1 - d_{1})}^{(l + 1)}}}}{{(l + 1)!}} - \frac{{(p -d_{1}){{(p-d_{1})}^{(l)}}}}{{(l)!}} \biggr\} \\ &{}+ \frac {1}{{d_{1}-c_{1}}}\sum_{\tau=c_{1}}^{d_{1} - 1} {{\Delta ^{m}}g(\tau){Q_{m}}(p,\tau)}, \end{aligned}$$

    where

    $$\begin{aligned}& {Q_{m}}(p,\tau) =\left [ { \textstyle\begin{array}{l@{\quad}l} {\frac{{(p - c_{1}){{(p - \tau - 1)}^{(m - 1)}}}}{{(m - 1)!}} - \sum_{s = \tau - m + 3}^{p - 1} {\frac{{{{(s - \tau)}^{(m - 1)}}}}{{(m - 1)!}}} ,}&{\tau \in [ {c_{1},p} ),}\\ {\frac{{(p - d_{1}){{(p - \tau - 1)}^{(m - 1)}}}}{{(m - 1)!}} - \sum_{s = \tau - m+ 3}^{p - 1} {\frac{{{{(s - \tau)}^{(m - 1)}}}}{{(m - 1)!}}} ,}&{\tau \in [ {p,d_{1}} ].} \end{array}\displaystyle } \right ] \end{aligned}$$
  • For \(\mathbb{T}=q^{\mathbb{Z}}\), \(q>1\), (10) takes the form

    $$\begin{aligned} g(p) =&{} \frac{{q - 1}}{{d_{1} - c_{1}}}\sum_{s = c_{1}}^{{q^{-1}}{d_{1}}} {sf(qs)} \\ &{}+ \frac{1}{{d_{1}-c_{1}}}\sum_{l = 1}^{m - 1} {{\Delta^{l}}g} (c_{1}) \Biggl\{ \prod _{\nu = 0}^{l - 1} {\frac{{(p - {q^{\nu}}c_{1})(p - c_{1})}}{{\sum_{\mu = 0}^{\nu}{{q^{\mu}}} }}} - q(q - 1) \sum_{s = c_{1}}^{{q^{ - 1}}p} {s\prod _{\nu = 0}^{l - 1} {\frac{{(s - {q^{\nu - 1}}c_{1})}}{{\sum_{\mu = 0}^{\nu}{{q^{\mu}}} }}} } \Biggr\} \\ &{}+ \frac{1}{{d_{1} - c_{1}}}\\ &{}\times\sum_{l = 1}^{m - 1} {{\Delta^{l}}g} (d_{1}) \Biggl\{ q(q - 1)\sum _{s = d_{1}}^{{q^{ - 1}}p} {s\prod_{\nu = 0}^{l - 1} {\frac{{(s - {q^{\nu - 1}}{d_{1}})}}{{\sum_{\mu = 0}^{\nu}{{q^{\mu}}} }}} } - \prod_{\nu = 0}^{l - 1} {\frac{{(p - {q^{\nu}}d_{1})(p - d_{1})}}{{\sum_{\mu = 0}^{\nu}{{q^{\mu}}} }}} \Biggr\} \\ &{}+ \frac{1}{{d_{1}-c_{1}}}\sum_{\tau=c_{1}}^{{q^{ - 1}}d_{1}} {{\Delta^{m}}g(\tau){Q_{m}}(p,\tau)}, \end{aligned}$$

    where

    $${Q_{m}}(p,\tau) = \left [ { \textstyle\begin{array}{cc} {\prod_{\nu = 0}^{m - 2} {\frac{{(p - {q^{\nu+1}}\tau)(p - c_{1})}}{{\sum_{\mu = 0}^{\nu} {{q^{\mu}}} }}} - q(q - 1)\sum_{s = {q^{3 - m}}\tau}^{{q^{ - 1}}p} {s\prod_{\nu = 0}^{m - 2} {\frac{{(s - {q^{\nu}}\tau)}}{{\sum_{\mu = 0}^{\nu}{{q^{\mu}}} }}} } ,}&{\tau \in [ {c_{1},p} ),}\\ {\prod_{\nu = 0}^{m - 2} {\frac{{(p - {q^{\nu+1}}\tau)(p - d_{1})}}{{\sum_{\mu = 0}^{\nu} {{q^{\mu}}} }}} - q(q - 1)\sum_{s = {q^{3 - m}}\tau}^{{q^{ - 1}}p} {s\prod_{\nu = 0}^{m- 2} {\frac{{(s - {q^{\nu}}\tau)}}{{\sum_{\mu = 0}^{\nu}{{q^{\mu}}} }}} } ,}&{\tau \in [ {p,d_{1}} ].} \end{array}\displaystyle } \right ] $$

Corollary 1

Using Theorem 4and the corresponding conditions, we get the following generalized trapezoid inequality:

$$\begin{aligned}& \Biggl\vert \frac{g(c_{1})+g(d_{1})}{2}-\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma}(s)\Delta s \\& \qquad {}- \frac{1}{2(d_{1}-c_{1})}\sum_{l = 0}^{m- 2} {{g^{{\Delta^{l + 1}}}}} (c_{1}) \biggl\{ {v_{l+ 1}}(d_{1},c_{1}) (d_{1}-c_{1}) - \int _{c_{1}}^{d_{1}} {{v_{l + 1}}} \bigl( \sigma(s),c_{1}\bigr)\Delta s \biggr\} \\& \qquad {}-\frac{1}{2(d_{1}-c_{1})}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l+ 1}}}}} (d_{1}) \biggl\{ - \int _{c_{1}}^{d_{1}} {{v_{l + 1}}} \bigl( \sigma (s),d_{1}\bigr)\Delta s-{v_{l + 1}}(c_{1},d_{1}) (c_{1}-d_{1}) \biggr\} \Biggr\vert \\& \quad \leq\frac{1}{2(d_{1}-c_{1})} \bigl\Vert g^{\Delta^{m}} \bigr\Vert _{r} \biggl( \int _{c_{1}}^{d_{1}} \bigl\vert Q_{m}(c_{1}, \tau) + Q_{m}(d_{1},\tau) \bigr\vert ^{q} \Delta\tau \biggr)^{\frac{1}{q}}. \end{aligned}$$
(22)

Proof

For the generalized trapezoid inequality, replace \(p=c_{1}\) and \(p=d_{1}\) in (10) to get the accompanying structures

$$\begin{aligned} g(c_{1}) =& \frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s \\ &{}+ \frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (d_{1}) \biggl\{ - \int _{c_{1}}^{d_{1}} {{v_{l+ 1}}} \bigl( \sigma (s),d_{1}\bigr)\Delta s-{v_{l + 1}}(c_{1},d_{1}) (c_{1}-d_{1}) \biggr\} \\ &{}+ \frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} {Q_{m}}(c_{1}, \tau )g^{{\Delta^{m}}}(\tau)\Delta\tau \end{aligned}$$
(23)

and

$$\begin{aligned} g(d_{1}) =&\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s \end{aligned}$$
(24)
$$\begin{aligned} &{}+\frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (c_{1}) \biggl\{ {v_{l + 1}}(d_{1},c_{1}) (d_{1}-c_{1}) - \int _{c_{1}}^{d_{1}} {{v_{l+ 1}}} \bigl( \sigma(s),c_{1}\bigr)\Delta s \biggr\} \end{aligned}$$
(25)
$$\begin{aligned} &{}+ \frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} {Q_{m}}(d_{1}, \tau )g^{{\Delta^{m}}}(\tau)\Delta\tau. \end{aligned}$$
(26)

Add (23) and (24) and divide the resultant by 2 to get

$$\begin{aligned}& \frac{g(c_{1})+g(d_{1})}{2}-\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma}(s)\Delta s \\& \qquad {}-\frac{1}{2(d_{1}-c_{1})}\sum_{l= 0}^{m - 2} {{g^{{\Delta^{l+ 1}}}}} (c_{1}) \biggl\{ {v_{l + 1}}(d_{1},c_{1}) (d_{1}-c_{1})- \int _{c_{1}}^{d_{1}} {{v_{l + 1}}} \bigl( \sigma(s),c_{1}\bigr)\Delta s \biggr\} \\& \qquad {}-\frac{1}{2(d_{1}-c_{1})}\sum_{l = 0}^{m- 2} {{g^{{\Delta^{l + 1}}}}} (d_{1}) \biggl\{ - \int _{c_{1}}^{d_{1}} {{v_{l + 1}}} \bigl( \sigma (s),d_{1}\bigr)\Delta s-{v_{l + 1}}(c_{1},d_{1}) (c_{1}-d_{1}) \biggr\} \\& \quad =\frac{1}{2(d_{1}-c_{1})} \int _{c_{1}}^{d_{1}} \bigl[Q_{m}(c_{1}, \tau) + Q_{m}(d_{1},\tau) \bigr]g^{{\Delta^{m}}}(\tau )\Delta\tau. \end{aligned}$$
(27)

By using Hölder’s inequality on (27), we get

$$\begin{aligned}& \Biggl\vert \frac{g(c_{1})+g(d_{1})}{2}-\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma}(s)\Delta s \\& \qquad {}- \frac{1}{2(d_{1}-c_{1})}\sum_{l= 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (c_{1}) \biggl\{ {v_{l + 1}}(d_{1},c_{1}) (d_{1}-c_{1}) - \int _{c_{1}}^{d_{1}} {{v_{l + 1}}} \bigl( \sigma(s),c_{1}\bigr)\Delta s \biggr\} \\& \qquad {}-\frac{1}{2(d_{1}-c_{1})}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (d_{1}) \biggl\{ - \int _{c_{1}}^{d_{1}} {{v_{l + 1}}} \bigl( \sigma(s),d_{1}\bigr)\Delta s-{v_{l+ 1}}(c_{1},d_{1}) (c_{1}-d_{1}) \biggr\} \Biggr\vert \\& \quad \leq \frac{1}{2(d_{1}-c_{1})} \bigl\Vert g^{\Delta^{m}} \bigr\Vert _{r} \biggl( \int _{c_{1}}^{d_{1}} \bigl\vert Q_{m}(c_{1}, \tau) + Q_{m}(d_{1},\tau) \bigr\vert ^{q} \Delta\tau \biggr)^{\frac{1}{q}}, \end{aligned}$$

which is the required trapezoid inequality, where

$$\begin{aligned}& Q_{m}(c_{1}, \tau) + Q_{m}(d_{1},\tau) \\& \quad = -2 \biggl[- \int _{c_{1}}^{{\rho^{m - 3}}(\tau)} {{v_{m - 1}}\bigl( \sigma(s),\sigma(\tau )\bigr)} \Delta s + \int _{{\rho^{m - 3}}(\tau)}^{d_{1}} {{v_{m- 1}}\bigl( \sigma(s),\sigma(\tau)\bigr)}\Delta s \biggr] \\& \qquad{} + {v_{m - 1}}\bigl(c_{1},\sigma(\tau)\bigr) (c_{1}-d_{1}) + {v_{m - 1}} \bigl(d_{1},\sigma(\tau)\bigr) (d_{1}-c_{1}). \end{aligned}$$

 □

Remark 2

If \(m=2\) and \(q=1\) in Corollary 1, (22) takes the form

$$\begin{aligned}& \biggl\vert \frac{g(c_{1})+g(d_{1})}{2}-\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma}(s)\Delta s \\& \qquad {}- \frac{1}{2(d_{1}-c_{1})} g^{\Delta} (c_{1}) \biggl\{ (d_{1}-c_{1})^{2} - \int _{c_{1}}^{d_{1}} \bigl(\sigma(s)-c_{1} \bigr)\Delta s \biggr\} \\& \qquad {}-\frac{1}{2(d_{1}-c_{1})}g^{\Delta} (d_{1}) \biggl\{ - \int _{c_{1}}^{d_{1}} \bigl(\sigma(s)-d_{1} \bigr)\Delta s-(c_{1}-d_{1})^{2} \biggr\} \biggr\vert \\& \quad \leq \frac{1}{2(d_{1}-c_{1})} \bigl\Vert g^{\Delta^{2}} \bigr\Vert _{\infty} \int _{c_{1}}^{d_{1}} \bigl\vert Q_{2}(c_{1}, \tau) + Q_{2}(d_{1},\tau) \bigr\vert \Delta\tau, \end{aligned}$$

where

$$\begin{aligned}& Q_{2}(c_{1},\tau) + Q_{2}(d_{1}, \tau) \\& \quad = -2 \biggl[- \int _{c_{1}}^{{\rho^{-1}}(\tau)} {{v_{1}}\bigl( \sigma(s),\sigma(\tau)\bigr)} \Delta s + \int _{{\rho^{-1}}(\tau)}^{d_{1}} {{v_{1}}\bigl(\sigma (s),\sigma(\tau)\bigr)}\Delta s \biggr] \\& \qquad{}+ {v_{1}}\bigl(c_{1},\sigma(\tau)\bigr) (c_{1}-d_{1}) + {v_{1}} \bigl(d_{1},\sigma(\tau)\bigr) (d_{1}-c_{1}). \end{aligned}$$

Remark 3

By using \(\mathbb{T}=\mathbb{R}\) in (22), we get [4, Remark 3].

3.1 Ostrowski type inequality

Theorem 5

Considering all taken assumptions of Theorem 4hold, suppose that (r,q) is a pair of conjugate exponents, that is, \(1\leq r, q<\infty , \frac{1}{r}+\frac{1}{q}=1\). Then we have

$$\begin{aligned}& \Biggl\vert g(p)-\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s \end{aligned}$$
(28)
$$\begin{aligned}& \qquad {}- \frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (c_{1}) \biggl\{ {v_{l + 1}}(p,c_{1}) (p-c_{1})- \int _{c_{1}}^{p} {v_{l+ 1}} \bigl(\sigma (s),c_{1}\bigr)\Delta s \biggr\} \\& \qquad {}- \frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}}(d_{1}) \biggl\{ \int _{d_{1}}^{p} {v_{l+ 1}}\bigl(\sigma (s),d_{1}\bigr)\Delta s -{v_{l + 1}}(p,d_{1}) (p-d_{1}) \biggr\} \Biggr\vert \\& \quad \leq \frac{1}{d_{1}-c_{1}} \bigl\Vert g^{{\Delta^{m}}} \bigr\Vert _{r} \biggl( \int _{c_{1}}^{d_{1}} \bigl\vert {Q_{m}}(p, \tau) \bigr\vert ^{q}\Delta\tau \biggr)^{\frac{1}{q}}. \end{aligned}$$
(29)

The constant \((\int _{c_{1}}^{d_{1}} |{Q_{m}}(p,\tau)|^{q}\Delta \tau)^{\frac{1}{q}}\) is sharp for \(1< r\leq\infty\) and the best possible for \(r=1\).

Proof

Employing identity (10) and Hölder’s inequality, the following is obtained:

$$\begin{aligned}& \Biggl\vert g(p)-\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s \\& \qquad {}- \frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (c_{1}) \biggl\{ {v_{l+ 1}}(p,c_{1}) (p-c_{1})- \int _{c_{1}}^{p} {v_{l + 1}} \bigl(\sigma (s),c_{1}\bigr)\Delta s \biggr\} \\& \qquad {}- \frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}}(d_{1}) \biggl\{ \int _{d_{1}}^{p} {v_{l + 1}}\bigl(\sigma (s),d_{1}\bigr)\Delta s -{v_{l + 1}}(p,d_{1}) (p-d_{1}) \biggr\} \Biggr\vert \\& \quad \leq\frac{1}{d_{1}-c_{1}} \bigl\Vert g^{{\Delta^{m}}} \bigr\Vert _{r} \biggl( \int _{c_{1}}^{d_{1}} \bigl\vert {Q_{m}}(p, \tau) \bigr\vert ^{q}\Delta\tau \biggr)^{\frac{1}{q}}. \end{aligned}$$

Denote \(D_{1}(\tau)=Q_{m}(p,\tau)\). To verify the sharpness of the constant \((\int_{c_{1}}^{d_{1}}|D_{1}(\tau)|^{q}\Delta\tau)^{\frac {1}{q}}\), a function g is constructed for which the correspondence in (28) is obtained.

For \(1< r<\infty\), take g with the end goal which states that

$$ g^{\Delta^{m}}(\tau)=\operatorname{sgn} D_{1}(\tau). \bigl\vert D_{1}(\tau) \bigr\vert ^{\frac{1}{r-1}}. $$

For \(r=\infty\), take

$$ g^{\Delta^{m}}(\tau)=\operatorname{sgn} D_{1}(\tau). $$

For \(r=1\), it will be proved that

$$ \biggl\vert \int_{c_{1}}^{d_{1}}D_{1}( \tau)g^{\Delta^{m}}(\tau)\Delta\tau \biggr\vert \leq \max _{\tau\in[c_{1},d_{1}]_{\mathbb{T}}} \bigl\vert D_{1}(\tau) \bigr\vert \biggl( \int _{c_{1}}^{d_{1}} \bigl\vert g^{\Delta^{m}}( \tau) \bigr\vert \Delta\tau \biggr) $$
(30)

is the optimal inequality. Suppose that \(|D_{1}(\tau)|\) is maximum for \(\tau_{0}\in[c_{1},d_{1}]_{\mathbb{T}}\). First assume that \(D_{1}(\tau _{0})>0\) and for ϵ such that \(0<\epsilon<d_{1}-\tau_{0}\); define \(g_{\epsilon}(\cdot)\) by

$$ g_{\epsilon}(\tau)=\left \{ \textstyle\begin{array}{l@{\quad}l} 0, & c_{1} \leq\tau< \tau_{0}, \\ \frac{1}{\epsilon}v_{m}(\tau, \tau_{0}), & \tau_{0}\leq\tau< \tau _{0}+\epsilon, \\ \frac{1}{m}v_{m-1}(\tau, \tau_{0}), & \tau_{0}+\epsilon\leq\tau\leq d_{1}. \end{array}\displaystyle \right \} $$

For \(\tau_{0}\leq\tau\leq\tau_{0}+\epsilon\), the expression for derivatives is

$$\begin{aligned} g'_{\epsilon}(\tau) =&\frac{1}{\epsilon}v_{m}^{\Delta}( \tau, \tau _{0})=\frac{1}{\epsilon}v_{m-1}(\tau, \tau_{0}), \\ g''_{\epsilon}(\tau) =& \frac{1}{\epsilon}v_{m-1}^{\Delta}(\tau, \tau _{0})=\frac{1}{\epsilon}v_{m-2}(\tau, \tau_{0}). \end{aligned}$$

Similarly, for \(m-th\) derivative,

$$\begin{aligned} g_{\epsilon}^{\Delta^{m}}(\tau) =& \frac{1}{\epsilon}v_{m-m}( \tau, \tau_{0})=\frac{1}{\epsilon}v_{0}(\tau, \tau_{0}) \\ =& \frac{1}{\epsilon} \qquad\qquad\because v_{0}=1. \end{aligned}$$

For \(\tau_{0}+\epsilon\leq\tau\leq d_{1}\),

$$\begin{aligned}& g'_{\epsilon}(\tau)=\frac{1}{m}v_{m-1}^{\Delta}( \tau, \tau_{0})=\frac {1}{m}v_{m-2}(\tau, \tau_{0}), \\& g''_{\epsilon}(\tau)= \frac{1}{m}v_{m-2}^{\Delta}(\tau, \tau_{0})=\frac {1}{m}v_{m-3}(\tau, \tau_{0}) \end{aligned}$$

and

$$ g_{\epsilon}^{\Delta^{m}}(\tau) = \frac{1}{m}v_{m-m}^{\Delta}( \tau, \tau_{0})=\frac{1}{m}v_{0}^{\Delta}=0. $$

For ϵ small enough,

$$ \biggl\vert \int_{c_{1}}^{d_{1}}D_{1}( \tau)g^{\Delta^{m}}(\tau)\Delta\tau \biggr\vert = \biggl\vert \int_{\tau_{0}}^{\tau_{0}+\epsilon}D_{1}(\tau) \frac {1}{\epsilon}\Delta\tau \biggr\vert = \frac{1}{\epsilon} \int_{\tau_{0}}^{\tau_{0}+\epsilon}D_{1}(\tau) \Delta \tau. $$

(30) gives

$$ \frac{1}{\epsilon} \int_{\tau_{0}}^{\tau_{0}+\epsilon}D_{1}(\tau) \Delta \tau\leq D_{1}(\tau_{0}) \int_{\tau_{0}}^{\tau_{0}+\epsilon}\frac {1}{\epsilon}\Delta\tau= D_{1}(\tau_{0}). $$

Since

$$ \lim_{\epsilon\rightarrow0}\frac{1}{\epsilon} \int_{\tau_{0}}^{\tau _{0}+\epsilon}D_{1}(\tau) \Delta \tau= D_{1}(\tau_{0}). $$

Hence we have proved that equation (30) is an optimal inequality. For \(D_{1}(\tau_{0})<0\), we take

$$ g_{\epsilon}(\tau)=\left \{ \textstyle\begin{array}{l@{\quad}l} \frac{1}{m}v_{m-1}(\tau,\tau_{0}+\epsilon), & c_{1}\leq\tau\leq\tau _{0}, \\ \frac{-1}{\epsilon}v_{m}(\tau,\tau_{0}+\epsilon), & \tau_{0}\leq\tau \leq\tau_{0}+\epsilon, \\ 0, & \tau_{0}+\epsilon\leq\tau\leq d_{1}. \end{array}\displaystyle \right \} $$

To obtain a solution of the above function when \(D_{1}(\tau_{0})<0\), a similar method can be used as for \(D_{1}(\tau_{0})>0\). □

Corollary 2

Considering taken conditions for Theorem 5hold, for \(r=1\), we have

$$\begin{aligned}& \Biggl\vert g(p)-\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s \\& \qquad {}- \frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (c_{1}) \biggl\{ {v_{l + 1}}(p,c_{1}) (p-c_{1})- \int _{c_{1}}^{p} {v_{l + 1}} \bigl(\sigma (s),c_{1}\bigr)\Delta s \biggr\} \\& \qquad {}- \frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (d_{1}) \biggl\{ \int _{d_{1}}^{p} {v_{l + 1}}\bigl(\sigma (s),d_{1}\bigr)\Delta s -{v_{l + 1}}(p,d_{1}) (p-d_{1}) \biggr\} \Biggr\vert \\& \quad \leq\frac{1}{d_{1}-c_{1}} \bigl\Vert g^{{\Delta^{m}}} \bigr\Vert \max \biggl\{ \biggl\vert v_{m-1}\bigl(p,\sigma(c_{1})\bigr) (p-c_{1})- \int_{\rho ^{m-3}(c_{1})}^{p}v_{m-1}\bigl(\sigma(s), \sigma(c_{1})\bigr)\Delta s \biggr\vert , \\& \qquad \biggl\vert v_{m-1}\bigl(p,\sigma(d_{1})\bigr) (p-d_{1})- \int_{\rho ^{m-3}(d_{1})}^{p}v_{m-1}\bigl(\sigma(s), \sigma(d_{1})\bigr)\Delta s \biggr\vert \biggr\} . \end{aligned}$$
(31)

Proof

By using (10),

$$\begin{aligned}& \int_{c_{1}}^{d_{1}} \bigl\vert Q_{m}(p, \tau) \bigr\vert ^{q}\Delta\tau \\& \quad = \int_{c_{1}}^{p} \bigl\vert Q_{m}(p, \tau) \bigr\vert ^{q}\Delta\tau+ \int_{p}^{d_{1}} \bigl\vert Q_{m}(p, \tau) \bigr\vert ^{q}\Delta \tau \\& \quad = \int_{c_{1}}^{p} \biggl\vert {{v_{m - 1}} \bigl(p,\sigma(\tau)\bigr) (p-c_{1}) - \int _{{\rho^{m - 3}}(\tau)}^{p} {{v_{m- 1}}\bigl( \sigma(s),\sigma(\tau )\bigr)}\Delta s } \biggr\vert ^{q}\Delta\tau \\& \qquad {}+ \int_{p}^{d_{1}} \biggl\vert {v_{m - 1}} \bigl(p,\sigma(\tau)\bigr) (p-d_{1}) - \int _{{\rho^{m- 3}}(\tau)}^{p} {{v_{m - 1}}\bigl( \sigma(s),\sigma(\tau )\bigr)} \Delta s \biggr\vert ^{q}\Delta\tau, \end{aligned}$$

\(r=1\Rightarrow q = \infty\), and we have

$$\begin{aligned}& \sup_{\tau\in[c_{1},d_{1}]} \bigl\vert Q_{m}(p,\tau) \bigr\vert \\& \quad =\max \biggl\{ \sup_{\tau\in [c_{1},p]} \biggl\vert {v_{m - 1}} \bigl(p,\sigma(\tau)\bigr) (p-c_{1}) - \int _{{\rho ^{m - 3}}(\tau)}^{p} {{v_{m - 1}}\bigl( \sigma(s),\sigma(\tau)\bigr)}\Delta s \biggr\vert , \\& \qquad \sup_{\tau\in[p,d_{1}]} \biggl\vert {v_{m - 1}}\bigl(p, \sigma(\tau)\bigr) (p-d_{1})- \int _{{\rho^{m - 3}}(\tau)}^{p}{{v_{m - 1}}\bigl( \sigma(s),\sigma(\tau )\bigr)}\Delta s \biggr\vert \biggr\} \\& \quad =\max \biggl\{ \biggl\vert {v_{m - 1}}\bigl(p,\sigma(c_{1}) \bigr) (p-c_{1}) - \int _{{\rho^{m - 3}}(c_{1})}^{p} {{v_{m - 1}}\bigl( \sigma(s),\sigma (c_{1})\bigr)}\Delta s \biggr\vert , \\& \qquad \biggl\vert {v_{m - 1}}\bigl(p,\sigma(d_{1})\bigr) (p-d_{1})- \int _{{\rho^{m - 3}}(d_{1})}^{p}{{v_{m - 1}}\bigl( \sigma(s),\sigma(d_{1})\bigr)}\Delta s \biggr\vert \biggr\} . \end{aligned}$$

By using the above expression in (28), we get (31). □

Remark 4

Choose \(m=2\) in Corollary 2. In this case (31) takes the form

$$\begin{aligned}& \biggl\vert g(p)-\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma }(s)\Delta s - \frac{1}{d_{1}-c_{1}} {g^{\Delta}} (c_{1}) \biggl\{ (p-c_{1})^{2}- \int _{c_{1}}^{p} \bigl(\sigma(s)-c_{1} \bigr)\Delta s \biggr\} \\& \qquad {}- \frac{1}{d_{1}-c_{1}} g^{\Delta} (d_{1}) \biggl\{ \int _{d_{1}}^{p} \bigl(\sigma(s)-d_{1} \bigr)\Delta s - (p-d_{1})^{2} \biggr\} \biggr\vert \\& \quad \leq\frac{1}{d_{1}-c_{1}} \bigl\Vert g^{\Delta^{2}} \bigr\Vert \max \biggl\{ \biggl\vert \bigl(p-\sigma (c_{1})\bigr) (p-c_{1})- \int_{\rho^{-1}(c_{1})}^{p}\bigl(\sigma(s)-\sigma (c_{1})\bigr)\Delta s \biggr\vert , \\& \qquad \biggl\vert \bigl(p-\sigma(d_{1})\bigr) (p-d_{1})- \int_{\rho ^{-1}(d_{1})}^{p}\bigl(\sigma(s)- \sigma(d_{1})\bigr)\Delta s \biggr\vert \biggr\} . \end{aligned}$$

Remark 5

Use \(\displaystyle p=\frac{c_{1}+d_{1}}{2}\) in Theorem 5. In this case (28) becomes the following generalized midpoint inequality:

$$\begin{aligned}& \Biggl\vert g\biggl(\frac{c_{1}+d_{1}}{2}\biggr)-\frac{1}{d_{1}-c_{1}} \int _{c_{1}}^{d_{1}} g^{\sigma}(s)\Delta s \\& \qquad {}- \frac{1}{d_{1}-c_{1}}\sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (c_{1}) \biggl\{ {v_{l+1}}\biggl( \frac{c_{1}+d_{1}}{2},c_{1}\biggr) \biggl(\frac {d_{1}-c_{1}}{2} \biggr)- \int _{c_{1}}^{\frac{c_{1}+d_{1}}{2}} {v_{l+ 1}} \bigl(\sigma(s),c_{1}\bigr)\Delta s \biggr\} \\& \qquad {}- \frac{1}{d_{1}-c_{1}}\sum_{k = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (d_{1}) \biggl\{ \int _{d_{1}}^{\frac{c_{1}+d_{1}}{2}} {v_{l+ 1}}\bigl(\sigma(s),d_{1}\bigr)\Delta s -{v_{l + 1}}\biggl(\frac {c_{1}+d_{1}}{2},d_{1}\biggr) \biggl(\frac{c_{1}-d_{1}}{2}\biggr) \biggr\} \Biggr\vert \\& \quad \leq\frac{1}{d_{1}-c_{1}} \bigl\Vert g^{{\Delta^{m}}} \bigr\Vert _{r} \biggl( \int _{c_{1}}^{d_{1}} \biggl\vert {Q_{m}} \biggl(\frac{c_{1}+d_{1}}{2},\tau\biggr) \biggr\vert ^{q}\Delta\tau \biggr)^{\frac{1}{q}}. \end{aligned}$$

Remark 6

By using \(\mathbb{T}=\mathbb{R}\) in Sect. 3.1, we get [4, Corollary 1, Remark 2, Remark 3].

4 Weighted Montgomery identity

Theorem 6

Let \(m \in\mathbb{N}\) and g be m times differentiable on \(\mathbb {T}^{k^{m}}\). Let \(p \in\mathbb{T}\) and \(z:[c_{1},d_{1}]_{\mathbb {T}}\rightarrow[0,\infty)\) be some probability density function, then we have

$$\begin{aligned} g(p) =& \int _{c_{1}}^{d_{1}} z(s)g^{\sigma}(s)\Delta s \\ &{}+ \sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (c_{1}) \int _{c_{1}}^{p} z(s)\bigl\{ {v_{l + 1}}(p,c_{1})-{v_{l+ 1}} \bigl(\sigma (s),c_{1}\bigr)\bigr\} \Delta s \\ &{}+ \sum_{l= 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (d_{1})\biggl[ \int _{d_{1}}^{p} z(s) \bigl\{ v_{l + 1} \bigl(\sigma(s),d_{1}\bigr)-{v_{l + 1}}(p,d_{1}) \bigr\} \Delta s \biggr] \\ &{}+ \int _{c_{1}}^{d_{1}} {Q_{z,m}}(p, \tau)g^{{\Delta ^{m}}}(\tau)\Delta\tau, \end{aligned}$$
(32)

where

$$\begin{aligned}& {Q_{z,m}}(p,\tau) \\& \quad = \left [ { \textstyle\begin{array}{l@{\quad}l} {{v_{m - 1}}(p,\sigma(\tau))Z(p) - \int _{{\rho^{m - 3}}(\tau )}^{p} {v_{m- 1}}(\sigma(s),\sigma(\tau))Z^{\Delta}(s) \Delta s,\quad \tau \in [ {c_{1},p} )},\\ {{v_{m - 1}}(p,\sigma(\tau))(1-Z(p)) + \int _{{\rho^{m - 3}}(\tau)}^{p} {{v_{m - 1}}(\sigma(s),\sigma(\tau))}Z^{\Delta }(s)\Delta s,\quad\tau \in[p,d_{1}],} \end{array}\displaystyle } \right ] \end{aligned}$$

and the term \(Z(p)\) involved in kernel is defined in (6).

Proof

Since \(g^{\Delta}\) is \(m-1\) times differentiable, therefore by replacing m with \(m-1\), g with \(g^{\Delta}\), and \(\alpha=c_{1}\) in (7), we have

$$ g^{\Delta}(p)=\sum_{l = 0}^{m - 2} {{v_{l}}(p,c_{1}){g^{\Delta ^{l+1}}}(c_{1})} + \int _{c_{1}} ^{{\rho^{m - 2}}(p)} {{v_{m - 2}}\bigl(p, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta\tau}. $$
(33)

Replace \(c_{1}\) with \(d_{1}\) in (33) to get

$$ g^{\Delta}(p)=\sum_{l = 0}^{m - 2} {{v_{l}}(p,d_{1} ){g^{\Delta ^{l+1}}}(d_{1})} + \int _{d_{1}} ^{{\rho^{m - 2}}(p)} {{v_{m - 2}}\bigl(p, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta\tau}. $$
(34)

(4) can be written as

$$ g(p)= \int _{c_{1}}^{d_{1}} z(s)g^{\sigma}(s)\Delta s + \int _{c_{1}}^{p} R_{z}(p,s)g^{\Delta}(s) \Delta s+ \int_{p}^{d_{1}} R_{z}(p,s)g^{\Delta}(s) \Delta s. $$

Now, by using (5), (33), (34), we have

$$\begin{aligned} g(p) =& \int _{c_{1}}^{d_{1}} z(s)g^{\sigma}(s)\Delta s+ \int _{c_{1}}^{p} Z(s)\sum _{l = 0}^{m - 2} {{v_{l}}(s,c_{1}){g^{\Delta^{l+1}}}(c_{1})} \Delta s \\ &{}+ \int _{c_{1}}^{p} Z(s) \int _{c_{1}}^{{\rho^{m - 2}}(s)} {{v_{m - 2}}\bigl(s, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta\tau }\Delta s \\ &{}+ \int _{p}^{d_{1}} \bigl(Z(s)-1\bigr)\sum _{l = 0}^{m - 2} {{v_{l}}(s,d_{1}){g^{\Delta^{l+1}}}(d_{1})} \Delta s \\ &{}+ \int _{t}^{d_{1}} \bigl(Z(s)-1\bigr) \int _{d_{1}}^{{\rho^{m - 2}}(s)} {{v_{m- 2}}\bigl(s, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta \tau}\Delta s. \end{aligned}$$
(35)

By using Lemma 2, we have

$$\begin{aligned}& \int _{c_{1}}^{p} Z(s)\sum _{l = 0}^{m - 2}{{v_{l}}(s,c_{1} ){g^{\Delta^{l+1}}}(c_{1})}\Delta s \\& \quad =\sum_{l = 0}^{m - 2}{g^{\Delta^{l+1}}}(c_{1}) \int _{c_{1}}^{p} z(s) \bigl\{ v_{l+1}(p,c_{1})-v_{l+1} \bigl(\sigma(s),c_{1}\bigr) \bigr\} \Delta s. \end{aligned}$$
(36)

Similarly

$$\begin{aligned}& \int _{p}^{d_{1}} \bigl(Z(s)-1\bigr)\sum _{l= 0}^{m - 2} {{v_{l}}(s,d_{1}){g^{\Delta^{l+1}}}(d_{1})} \Delta s \\& \quad =\sum _{l = 0}^{m - 2}{g^{\Delta^{l+1}}}(d_{1}) \int _{d_{1}}^{p} z(s) \bigl\{ v_{l+1} \bigl(\sigma(s),d_{1}\bigr)-v_{l+1}(p,d_{1}) \bigr\} \Delta s. \end{aligned}$$
(37)

By using Lemma 2 and (9), integral in the 3rd term of (35) becomes

$$\begin{aligned}& \int _{c_{1}}^{p} Z(s) \int _{c_{1}}^{{\rho^{m- 2}}(s)} {{v_{m - 2}}\bigl(s, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta\tau }\Delta s \\& \quad = \int _{c_{1}}^{p} g^{{\Delta^{m}}}(\tau) \biggl[v_{m-1}\bigl(p,\sigma(\tau )\bigr)Z(t)- \int _{\rho^{m- 3}(\tau)}^{p} Z^{\Delta}(s) v_{m-1}\bigl(\sigma (s),\sigma(\tau)\bigr)\Delta s \biggr]\Delta\tau. \end{aligned}$$
(38)

Similarly,

$$\begin{aligned}& \int _{p}^{d_{1}} \bigl(Z(s)-1\bigr) \int _{d_{1}}^{{\rho^{m - 2}}(s)}{{v_{m - 2}}\bigl(s, \sigma(\tau)\bigr){g^{{\Delta^{m}}}}(\tau)\Delta\tau }\Delta s \\& \quad = \int _{d_{1}}^{p} g^{{\Delta^{m}}}(\tau) \biggl[v_{m-1}\bigl(p,\sigma(\tau )\bigr) \bigl(1-Z(p)\bigr) \\& \qquad {}+ \int _{\rho^{m - 3}(\tau)}^{p} Z^{\Delta}(s) v_{m-1}\bigl(\sigma(s),\sigma(\tau)\bigr)\Delta s \biggr]\Delta\tau. \end{aligned}$$
(39)

By using (36)–(39) in (35), we have the required result. □

Remark 7

Consider all the assumptions of Theorem 6 hold. Also, assume that \((r,q)\) is a pair of conjugate exponents, that is, \(1\leq r,q\leq\infty , \frac{1}{r}+\frac{1}{q}=1\). Then we have

$$\begin{aligned}& \Biggl\vert g(p)- \int _{c_{1}}^{d_{1}} z(s)g^{\sigma}(s)\Delta s - \sum_{l = 0}^{m - 2} {{g^{{\Delta^{l+ 1}}}}} (c_{1}) \int _{c_{1}}^{p} z(s) \bigl\{ {v_{l + 1}}(p,c_{1})-{v_{l + 1}} \bigl(\sigma (s),c_{1}\bigr) \bigr\} \Delta s \\& \qquad {}- \sum_{l = 0}^{m - 2} {{g^{{\Delta^{l + 1}}}}} (d_{1}) \biggl[ \int _{d_{1}}^{p} z(s) \bigl\{ {v_{l + 1}} \bigl(\sigma(s),d_{1}\bigr)-{v_{l + 1}}(p,d_{1}) \bigr\} \Delta s \biggr] \Biggr\vert \\& \quad \leq \bigl\Vert g^{{\Delta^{m}}} \bigr\Vert _{r} \biggl( \int _{c_{1}}^{d_{1}} \bigl\vert {Q_{z,m}}(p, \tau) \bigr\vert ^{q}\Delta\tau \biggr)^{\frac{1}{q}}. \end{aligned}$$
(40)

The constant \((\int _{c_{1}}^{d_{1}} |{Q_{z,m}}(p,\tau )|^{q}\Delta\tau)^{\frac{1}{q}}\) is sharp for \(1< r\leq\infty\) and optimal for \(r=1\).

Proof

This result can be proved by a similar solution used for Theorem 5. □

Remark 8

By using \(\mathbb{T}=\mathbb{R}\) in (40), we have [4, (3.1)].

5 Conclusion

In this paper, the extension of Montgomery identity has been obtained with the help of time-scaled Taylor’s formula and discussed for calculus (discrete and quantum) as well by choosing special time scales. Further, it is used to find the extension of Ostrowski inequality, mid-point inequality, and trapezoid inequality. The weighted version of Montgomery identity and respective Ostrowski inequality are also established here. Remaining results that appeared in Corollary 1 and in Sect. 3.1 can be proved for weighted Montgomery identity (32) and respective Ostrowski type inequality (40). Moreover, as special cases, our inequalities contain the results proved in [4] when \(\mathbb{T}=\mathbb{R}\).