1 Introduction

Functional equations of type

$$\begin{aligned} \varphi \Big (\frac{x+y}{2}\Big )\big (f_1(x)-f_2(y)\big )=0,\qquad (x,y)\in I_1\times I_2, \end{aligned}$$
(1)

are closely connected with various problems with two-variable means. In relation to the Matkowski–SutÔ problem [2], equation (1) was studied assuming that \(I_1=I_2\), \(g{:}{=}f_1=f_2\), \(\varphi =g+\lambda \) for some constant \(\lambda \in \mathbb {R}\), and that g is of the form \(d\circ c\), where d is a derivative and c is continuous.

In paper [3] Z. Daróczy and V. Totik investigated a co-equation of (1) and proved that continuous differentiability of the solutions implies that they are constant. The authors also showed that there exist differentiable, nowhere monotone (and hence non-constant) solutions as well. The interested reader can also find equations with a similar spirit in [1].

In [4], as an auxiliary functional equation, a special case of (1) played an important role in solving the equality problem of Cauchy means and quasi-arithmetic means. The solutions of (1) were determined assuming that \(I_1=I_2\), \(f_1=f_2\), and that the set of zeros of \(\varphi \) is closed. Also in terms of functions and domains, equation (1) is a pexiderization of the auxiliary equation of [4].

Note that, in fact, for given functions \(f_1\) and \(f_2\), it is not so difficult to construct \(\varphi \) to obtain a solution. Indeed, let \(f_1:I_1\rightarrow \mathbb {R}\) and \(f_2:I_2\rightarrow \mathbb {R}\) be any functions, \(\lambda \in f_1(I_1)\) be any value but fixed, and define \(\Lambda {:}{=}f_2^{-1}(\{\lambda \})\). Then \((\varphi ,f_1,f_2)\) is a solution of (1) provided that \(\varphi (u)=0\) whenever \(u\in \frac{1}{2}\big (I_1+(I_2\setminus \Lambda )\big )\). The aim of this paper is to solve the equation under a weak but reasonable condition that guarantees that the solutions have regular, more precisely, constant parts. We are going to describe the solution set of functional equation (1), where \(I_1,I_2\subseteq \mathbb {R}\) stand for nonempty open intervals, the functions \(\varphi :D{:}{=}\frac{1}{2}(I_1+I_2)\rightarrow \mathbb {R}\), \(f_1:I_1\rightarrow \mathbb {R}\), and \(f_2:I_2\rightarrow \mathbb {R}\) are unknown, and the set of zeros of \(\varphi \) is assumed to be closed in D. Note that this latter condition is trivially satisfied whenever \(\varphi \) is continuous, strictly monotone, injective or, say, has finitely many zeros.

Adapted from paper [4], for \(H\subseteq \mathbb {R}\) and a given function \(\ell :H\rightarrow \mathbb {R}\), the set \(\{u\in H\mid \ell (u)=0\}\) will be denoted by \(\mathscr {Z}_\ell \). For its complementary set \(H\setminus \mathscr {Z}_\ell \) we shall use \(\mathscr {Z}_\ell ^c\). Whenever we write \((\varphi ,f_1,f_2)\), we mean that \(\varphi \), \(f_1\), and \(f_2\) are real valued functions defined on D, \(I_1\), and \(I_2\), respectively. A triplet of functions \((\varphi ,f_1,f_2)\) will be called extremal if \(D\subseteq \mathscr {Z}_\varphi \), that is, if \(\varphi \) is identically zero or there exists \(\lambda \in \mathbb {R}\) such that \(f_1(x)=f_2(y)=\lambda \) for all \(x\in I_1\) and \(y\in I_2\). We can then make the following trivial observation.

Proposition 1

If \((\varphi ,f_1,f_2)\) is extremal then \((\varphi ,f_1,f_2)\) solves equation (1).

In fact, it is the above statement that motivates the name extremal. As we will see later, a general solution of (1), roughly speaking, is a mixture of extremal solutions, and this nice property is provided by the condition that \(\mathscr {Z}_\varphi \) is closed.

A nonempty family \(\{U\subseteq \mathbb {R}\mid U\text { is an interval}\}\) will be called a sequence of intervals, if it is countable. Then the family in question will be simply referred to as \((U_n)\), that is, we do not indicate the index set.

For given subsets \(P,Q,S\subseteq \mathbb {R}\), define

$$\begin{aligned} (S | P)_Q{:}{=}(2P-S)\cap Q. \end{aligned}$$

In words, \((S | P)_Q\) consists of those elements of Q that are reflections of some element of S with respect some element of P. If at least one of the sets is empty, then \((S | P)_Q\) is empty. For brevity, when reflecting to a given point, that is, if P is of the form \(\{p\}\), then instead of \((S | \{p\})_Q\) we simply write \((S | p)_Q\). Finally, having an interval \(J\subseteq \mathbb {R}\), we shall say that \(H\subseteq J\) is a proper subset if \(H\notin \{\emptyset ,J\}\).

Later we want to refer to some trivial properties of a set of the form \((S | P)_Q\), hence we formulate the following lemma.

Lemma 2

Let \(P,Q,S\subseteq \mathbb {R}\) be any subsets.

  1. (i)

    If \(P_1\subseteq P_2\subseteq \mathbb {R}\), \(Q_1\subseteq Q_2\subseteq \mathbb {R}\), and \(S_1\subseteq S_2\subseteq \mathbb {R}\), then

    $$\begin{aligned} (S_1 | P_1)_{Q_1}\subseteq (S_2 | P_2)_{Q_2}. \end{aligned}$$
  2. (ii)

    The sets \((S | P)_Q\) and \((Q | P)_S\) are mirror images of each other with respect to P, more precisely, we have

    $$\begin{aligned} ((S | P)_Q | P)_S=(Q | P)_S. \end{aligned}$$
  3. (iii)

    If Q is open and at least one of the sets P and S is open, then \((S | P)_Q\) is open.

  4. (iv)

    Finally, if PQ, and S are intervals, so is \((S | P)_Q\) and

    $$\begin{aligned}{} & {} \inf (S | P)_Q=\max (\inf Q,2\inf P-\sup S)\qquad \text {and}\\{} & {} \sup (S | P)_Q=\min (\sup Q,2\sup P-\inf S), \end{aligned}$$

    provided that \((S | P)_Q\) is nonempty.

Proof

Assertions (i), (iii), and (iv) are direct consequences of the definition.

The proof of (ii) is also elementary. Set \(A{:}{=}((S | P)_Q | P)_S\) and \(B{:}{=}(Q | P)_S\). By definition, \((S | P)_Q\subseteq Q\), hence, in view of statement (i), \(A\subseteq B\) follows. The reverse inclusion is trivial if B is empty, thus we may assume that this is not the case. Let \(x\in B\) be any point. Then \(x\in S\) and there exist \(y\in Q\) and \(p\in P\) such that \(x=2p-y\). Thus \(2p-x=y\in (S | P)_Q\), which, together with \(x\in S\), yields that \(x\in 2p-(S | P)_Q\subseteq A\). \(\square \)

We will use what the next lemma states directly in our theorem about the solutions of (1). Briefly, it says that at least one of the mirror images of \(I_1\) and \(I_2\) for some nonempty subinterval of D is always located at one end of \(I_2\) and \(I_1\), respectively. Note that the subinterval for which we are reflecting may consist of a single point.

Lemma 3

Let \(H\subseteq D\) be a nonempty subinterval and \(i,j\in \{1,2\}\) with \(i\ne j\). Then \((I_i | H)_{I_j}\) is a nonempty open subinterval of \(I_j\) furthermore

  1. (i)

    if \(\inf (I_i | H)_{I_j}\in I_j\) then \(\sup (I_j | H)_{I_i}=\sup I_i\) and

  2. (ii)

    if \(\sup (I_i | H)_{I_j}\in I_j\) then \(\inf I_i=\inf (I_j | H)_{I_i}\).

Proof

The fact that \((I_i | H)_{I_j}\) is nonempty follows from the inclusion \(H\subseteq D\).

To prove (i), assume that \(\inf (I_i | H)_{I_j}\in I_j\). Then, by (iv) of Lemma 2, \(\inf (I_i | H)_{I_j}=2\inf H-\sup I_i\in \mathbb {R}\), and hence \(\inf H,\sup I_i\in \mathbb {R}\). Then, in view of (ii) and (iv) of Lemma 2, we have

$$\begin{aligned} \sup (I_j | H)_{I_i}{} & {} =\sup ((I_i | H)_{I_j} | H)_{I_i} =\min (\sup I_i,2\sup H-\inf (I_i | H)_{I_j})\\{} & {} =\min (\sup I_i,2\sup H-2\inf H+\sup I_i)\\{} & {} =\min (\sup I_i,\sup I_i+2\text{ diam }(H))=\sup I_i, \end{aligned}$$

since \(\sup I_i\in \mathbb {R}\) and \(0\le \text{ diam }(H)\le +\infty \). Statement (ii) is similarly verified.

\(\square \)

2 Solutions where the interior of \(\mathscr {Z}_\varphi \) is empty

In this section we characterize the solution set of (1) in the case where the interior of \(\mathscr {Z}_\varphi \) is empty. To do this, we need the following property of the members of the support of \(\varphi \).

Proposition 4

Let \((\varphi ,f_1,f_2)\) be a solution of equation (1) such that \(\mathscr {Z}_\varphi \) is different from but closed in D. Then, for any \(p\in \text{ cl }\,\mathscr {Z}_\varphi ^c\), there exists a constant \(\lambda \in \mathbb {R}\) such that

$$\begin{aligned} f_1(x)=f_2(y)=\lambda ,\qquad x\in (I_2 | p)_{I_1}\text { and }y\in (I_1 | p)_{I_2}. \end{aligned}$$
(2)

Proof

Let \(p\in \text{ cl }\,\mathscr {Z}_\varphi ^c\). Then, by Lemma 3, \(A{:}{=}(I_2 | p)_{I_1}\) and \(B{:}{=}(I_1 | p)_{I_2}\) are nonempty open intervals in \(I_1\) and \(I_2\), respectively.

Assume first that \(p\in \mathscr {Z}_\varphi ^c\). We are going to show that any member of A has an open neighbourhood in A on which \(f_1\) is constant. Let \(x_0\in A\) be any point. Then there exists \(y_0\in B\), such that \(p=\frac{1}{2}(x_0+y_0)\). Using that the sets A and \(\mathscr {Z}_\varphi ^c\) are open, one can find \(r>0\) such that

$$\begin{aligned} U(x_0,r){:}{=}\,]x_0-r,x_0+r[\,\subseteq A \qquad \text {and}\qquad ]p-\tfrac{r}{2},p+\tfrac{r}{2}[\,\subseteq \mathscr {Z}_\varphi ^c. \end{aligned}$$

Applying equation (1) for \(x=x_0+t\) with \(|t|<r\) and for \(y_0\), we get that

$$\begin{aligned} \varphi \big (p+\tfrac{t}{2}\big )\big (f_1(x)-f_2(y_0)\big )=0, \end{aligned}$$

where \(\varphi \big (p+\tfrac{t}{2}\big )\ne 0\). Consequently, with \(\lambda {:}{=}f_2(y_0)\), we have \(f_1(x)=\lambda \) whenever \(x\in U(x_0,r)\). That \(x_0\) was arbitrary, implies that \(f_1(x)=\lambda \) if \(x\in A\). By the same reasoning we obtain that \(f_2\) must also be constant on B with some value \(\mu \in \mathbb {R}\). Notice that \(y_0\in B\), thus \(\mu =\lambda \) follows.

Assume now that \(p\in \text{ cl }\,\mathscr {Z}_\varphi ^c\) with \(\varphi (p)=0\) and let \(x_0\in A\). Then \(p=\frac{1}{2}(x_0+y_0)\) for some \(y_0\in B\). Let \((p_n)\subseteq \mathscr {Z}_\varphi ^c\) be a sequence tending to p. We claim that there exists \(n_0\in \mathbb {N}\) such that \(x_0\in (I_2 | p_{n_0})_{I_1}\).

Indeed, otherwise, an infinite number of the intervals in question would always be to the left or right of the point \(x_0\), more precisely, there would exist a subsequence \((p_{n_k})\) such that, for all \(k\in \mathbb {N}\), either

$$\begin{aligned} \sup (I_2 | p_{n_k})_{I_1}\le x_0 \qquad \text {or}\qquad x_0\le \inf (I_2 | p_{n_k})_{I_1}. \end{aligned}$$

The first inequality yields that \(2p_{n_k}-\inf I_2\le x_0\) for all \(k\in \mathbb {N}\). Thus, particularly, \(\inf I_2\in \mathbb {R}\) follows. Taking \(k\rightarrow \infty \), we get that

$$\begin{aligned} p\le \tfrac{1}{2}(x_0+\inf I_2)<\tfrac{1}{2}(x_0+y_0)=p. \end{aligned}$$

The second inequality leads to a similar type of contradiction. Thus \(x_0\in (I_2 | p_{n_0})_{I_1}\) for some \(n_0\in \mathbb {N}\).

In view of the first part of the proof, it follows that \(f_1\) is constant on some open neighbourhood of \(x_0\). But \(x_0\) was arbitrary, hence \(f_1\) is identically \(\lambda \) on A for some constant \(\lambda \in \mathbb {R}\). A similar argument shows that \(f_2\) must take some \(\mu \in \mathbb {R}\) on B.

All that remains is to show is that \(\lambda \) and \(\mu \) are equal. Let \(x_0\in A\) and \(y_0\in B\) be such that \(p=\frac{1}{2}(x_0+y_0)\), and, again, pick a sequence \((p_n)\subseteq \mathscr {Z}_\varphi ^c\) tending to p. Then there exists \(n_0\in \mathbb {N}\) such that \(y_0\in (A | p_{n_0})_{I_2}\). Otherwise, for some subsequence \((p_{n_m})\), we would have either

$$\begin{aligned} \sup (A | p_{n_m})_{I_2}\le y_0\qquad \text {or}\qquad y_0\le \inf (A | p_{n_m})_{I_2}. \end{aligned}$$

Both inequalities contradict the fact that \(x_0\in A\). Consequently, there exist \(n_0\in \mathbb {N}\) and \(x\in A\) such that \(p_{n_0}=\frac{1}{2}(x+y_0)\). Then, by equation (1), we have \(\lambda =f_1(x)=f_2(y_0)=\mu \), which finishes the proof. \(\square \)

Theorem 5

Let \(\varphi :D\rightarrow \mathbb {R}\) be such that \(\mathscr {Z}_\varphi \) is closed in D and has an empty interior. Then \((\varphi ,f_1,f_2)\) solves functional equation (1) if and only if \((\varphi ,f_1,f_2)\) is extremal.

Proof

The sufficiency is obvious, so we address the necessity.

If \(\mathscr {Z}_\varphi ^c\) is empty, then \(D\subseteq \mathscr {Z}_\varphi \) and we are done. Hence assume that this is not the case.

By Proposition 4, one can immediately obtain that any member of \((I_2 | \mathscr {Z}_\varphi ^c)_{I_1}\) has an open neighbourhood in \((I_2 | \mathscr {Z}_\varphi ^c)_{I_1}\) on which \(f_1\) is constant. This yields that \(f_1\) must be constant on any component of \((I_2 | \mathscr {Z}_\varphi ^c)_{I_1}\). An analogous statement holds with \(f_2\) and \((I_1 | \mathscr {Z}_\varphi ^c)_{I_2}\).

Now observe that for any components \(K\subseteq (I_2 | \mathscr {Z}_\varphi ^c)_{I_1}\) and \(L\subseteq (I_1 | \mathscr {Z}_\varphi ^c)_{I_2}\), the constant functions \(f_1|_K\) and \(f_2|_L\) take a common value. Indeed, if this were not so, then, using equation (1), one could deduce that \(\varphi \) is identically zero on \(\frac{1}{2}(K+L)\), contradicting that \(\mathscr {Z}_\varphi \) has an empty interior. Let us denote the common value taken by the functions \(f_1|_{(I_2 | \mathscr {Z}_\varphi ^c)_{I_1}}\) and \(f_2|_{(I_1 | \mathscr {Z}_\varphi ^c)_{I_2}}\) by \(\lambda \).

Now take a point \(x\in I_1\) arbitrarily and let \(y\in I_2\) be such that \(\frac{1}{2}(x+y)\in \mathscr {Z}_\varphi ^c\). We note that such y exists: otherwise \(\frac{1}{2}(x+I_2)\subseteq \mathscr {Z}_\varphi \) would be true, which is a contradiction. Thus, by equation (1), \(f_1(x)=f_2(y)\) follows, where

$$\begin{aligned}y\in (2\mathscr {Z}_\varphi ^c-x)\cap I_2\subseteq (I_1 | \mathscr {Z}_\varphi ^c)_{I_2}. \end{aligned}$$

Consequently, \(f_1(x)=\lambda \). An analogous argument shows that the same is true for \(f_2\), that is, \(f_2(y)=\lambda \) if \(y\in I_2\). \(\square \)

Remark 1

In view of Lemma 3 and Proposition 4, for a solution of (1), either at least one of the functions \(f_1\) and \(f_2\) is constant on its domain or at the same end of their domain they are constant with the same value. Furthermore if \(\mathscr {Z}_\varphi \) has an empty interior or, equivalently, if \(\mathscr {Z}_\varphi ^c\) is dense in D, the only possible solution is the extremal one. To have these statements, we heavily use the topological condition on \(\mathscr {Z}_\varphi \). The following example demonstrates that without this topological assumption the situation may be completely different.

Let \(\psi :D\rightarrow \mathbb {R}\) be any function,

$$\begin{aligned}{} & {} f_1(x){:}{=}\chi _{\mathbb {Q}}(x),\,\,\, \text {if }x\in I_1,\quad f_2(y){:}{=}\chi _{\mathbb {Q}}(y),\,\,\, \text {if }y\in I_2, \quad \text {and}\\{} & {} \varphi (u){:}{=}\chi _{\mathbb {Q}}(u)\psi (u),\,\,\, \text {if }u\in D, \end{aligned}$$

where \(\chi _{\mathbb {Q}}:\mathbb {R}\rightarrow \mathbb {R}\) stands for the characteristic function of rational numbers, that is,

$$\begin{aligned} \chi _\mathbb {Q}(t)= {\left\{ \begin{array}{ll} 1&{}\text {if }t\in \mathbb {Q},\\ 0&{}\text {if }t\in \mathbb {R}\setminus \mathbb {Q}. \end{array}\right. } \end{aligned}$$

Then \((\varphi ,f_1,f_2)\) solves equation (1) and \(\mathscr {Z}_\varphi \) is closed in D if and only if \((\varphi ,f_1,f_2)\) is extremal or, equivalently, if \(\psi \) vanishes at any rational member of D.

Indeed, let \(x\in I_1\) and \(y\in I_2\). If \(x,y\in \mathbb {Q}\) or \(x,y\in \mathbb {R}\setminus \mathbb {Q}\), then \(f_1(x)=f_2(y)\). If exactly one of them is rational, then \(p{:}{=}\frac{1}{2}(x+y)\) must be irrational, that is \(\varphi (p)=0\). The second part of the statement is trivial in view of the inclusion \(D\cap (\mathbb {R}\setminus \mathbb {Q})\subseteq \mathscr {Z}_\varphi \).

3 The solution set in general

For an index \(k\in \{1,2\}\) and a constant \(\lambda \in \mathbb {R}\), define

$$\begin{aligned}{} & {} a_k(\lambda ){:}{=}\sup \{u\in I_k\mid f_k(t)=\lambda \text { if }t\in \,]\inf I_k,u[\,\} \,\text { and }\\{} & {} b_k(\lambda ){:}{=}\inf \{u\in I_k\mid f_k(t)=\lambda \text { if }t\in \,]u,\sup I_k[\,\}. \end{aligned}$$

In words, the extended real numbers defined above can be interpreted as follows. The set \(]\inf I_k, a_k(\lambda )[\) is the largest open subinterval at the left end of \(I_k\) on which \(f_k\) is identically \(\lambda \). We have \(a_k(\lambda )=-\infty \) if and only if \(I_k\) has no subinterval of positive length whose left endpoint is \(\inf I_k\) and on which \(f_k\) takes \(\lambda \). Finally, \(a_k(\lambda )=\sup I_k\) if and only if \(f_k\) takes \(\lambda \) on the whole interval \(I_k\). With obvious modifications, similar statements are true with \(b_k(\lambda )\le +\infty \).

Observe that, whenever \((\varphi ,f_1,f_2)\) is a non-extremal solution of (1), then obviously

  1. (C1)

    neither \(f_1\) nor \(f_2\) is constant on its domain or

  2. (C2)

    exactly one of the functions \(f_1\) and \(f_2\) is constant on its domain.

Indeed, if \((\varphi ,f_1,f_2)\) is not extremal, then neither the interior of \(\mathscr {Z}_\varphi \) nor the complementary set \(\mathscr {Z}_\varphi ^c\) is non-empty. So if \(f_1\) and \(f_2\) were both constant, they would have to take the same value, which contradicts the fact that the solution is not extremal.

Theorem 6

Let \(\varphi :D\rightarrow \mathbb {R}\) be such that \(\mathscr {Z}_\varphi \) is closed in D. Then \((\varphi ,f_1,f_2)\) solves functional equation (1) if and only if one of the following statements holds true.

  1. (i)

    The triplet \((\varphi ,f_1,f_2)\) is extremal.

  2. (ii)

    There exist constants \(\lambda ,\mu \in \mathbb {R}\) and open intervals \(U_1,U_2\subseteq I_1\) and \(V_1,V_2\subseteq I_2\) with

    $$\begin{aligned} \inf U_1= & {} \inf I_1\quad \text {and}\quad \inf V_1=\inf I_2 \quad \text {or}\quad \sup U_2=\sup I_1\quad \\{} & {} \text {and}\quad \sup V_2=\sup I_2 \end{aligned}$$

    such that

    $$\begin{aligned}{} & {} f_1(x)=f_2(y)=\lambda \quad \text {if}\quad (x,y)\in U_1\times V_1\qquad \text {or}\quad f_1(x)=f_2(y)=\mu \\{} & {} \text {if}\quad (x,y)\in U_2\times V_2 \end{aligned}$$

    and

    $$\begin{aligned} \varphi (u)=0\quad \text {whenever}\quad u\in \tfrac{1}{2}(K_1+I_2)\cup \tfrac{1}{2}(I_1+K_2), \end{aligned}$$

    where \(K_1{:}{=}I_1\setminus (U_1\cup U_2)\) and \(K_2{:}{=}I_2\setminus (V_1\cup V_2)\) are closed proper subintervals.

  3. (iii)

    There exists a constant \(\lambda \in \mathbb {R}\) and, for some index \(i\in \{1,2\}\), there exists a sequence \((U_n)\) of disjoint nonempty open subintervals of \(I_i\) such that

    $$\begin{aligned}{} & {} f_i(x)=\lambda \quad \text {if}\quad x\in \bigcup _n U_n,\qquad f_j(y)=\lambda \quad \text {if}\quad y\in I_j, \qquad \text {and}\nonumber \\{} & {} \varphi (u)=0\quad \text {if}\quad u\in \tfrac{1}{2}(\mathscr {K}_i+I_j), \end{aligned}$$
    (3)

    where \(\mathscr {K}_i{:}{=}I_i{\setminus }\bigcup \nolimits _n U_n\) and \(j\in \{1,2\}\) with \(i\ne j\).

Proof

First we are going to prove the necessity of cases (i), (ii), and (iii). To do this, assume that \((\varphi ,f_1,f_2)\) solves equation (1).

If \(\mathscr {Z}_\varphi \) has an empty interior then, in view of Theorem 5, \((\varphi ,f_1,f_2)\) must be extremal, so we obtain solution (i). If \(\mathscr {Z}_\varphi \) has a nonempty interior, then either \(\mathscr {Z}_\varphi =D\) or \(\mathscr {Z}_\varphi \ne D\). If \(\mathscr {Z}_\varphi =D\), then again we get that \((\varphi ,f_1,f_2)\) is extremal. Hence, in the sequel, we suppose that \(\mathscr {Z}_\varphi \ne D\) is valid. Within this sub-case, two main cases can be distinguished: either the functions \(f_1\) and \(f_2\) are both constant on their domain or at least one of them is not constant. Since \(\mathscr {Z}_\varphi \) is different from D, in the first case we get that the functions \(f_1\) and \(f_2\) must take the same value, so we again get case (i). Therefore, suppose also that at least one of the functions \(f_1\) and \(f_2\) is not constant on its domain. This means that either (C1) or (C2) is satisfied.

Case 1. Assume first that neither \(f_1\) nor \(f_2\) is constant on its domain. Since \(\mathscr {Z}_\varphi ^c\) is nonempty, the intersection \(f_1(I_1)\cap f_2(I_2)\) is nonempty. Then, by Remark 1, there exist \(\lambda ,\mu \in f_1(I_1)\cap f_2(I_2)\) such that at least one of the inequalities

$$\begin{aligned} -\infty<\min (a_1(\lambda ),a_2(\lambda ))\qquad \text {or}\qquad \max (b_1(\mu ),b_2(\mu ))<+\infty \end{aligned}$$
(4)

is met. Define the open subintervals

$$\begin{aligned}{} & {} U_1{:}{=}\,]\inf I_1,a_1(\lambda )[, U_2{:}{=}\,]b_1(\mu ),\sup I_1[V_1{:}{=}]\inf I_2,a_2(\lambda )\nonumber \\{} & {} [,\text {and}\quad V_2{:}{=}\,]b_2(\mu ),\sup I_2[. \end{aligned}$$
(5)

In view of the inequalities under (4), at least one of the conditions \(\emptyset \notin \{U_1,V_1\}\) or \(\emptyset \notin \{U_2,V_2\}\) is satisfied. Furthermore, by our condition (C1), we have \(a_i(\lambda )<\sup I_i\), \(\inf I_i<b_i(\mu )\), and \(a_i(\lambda )\le b_i(\mu )\) hold for any \(i\in \{1,2\}\). Consequently, \(K_1\) and \(K_2\) are indeed proper closed subintervals.

For brevity, denote \(A{:}{=}\frac{1}{2}(K_1+I_2)\cup \frac{1}{2}(I_1+K_2)\). The intervals \(K_1\) and \(K_2\) contain at least one point, hence \(\emptyset \ne \tfrac{1}{2}(K_1+K_2)\subseteq A\), which shows that A is a nonempty open subinterval of D. Now all we need to prove is that the inclusion \(A\subseteq \mathscr {Z}_\varphi \) is fulfilled. We prove this indirectly.

Suppose that we have a point \(p\in A\) for which \(\varphi (p)\ne 0\). Since \(p\in A\), there exist \(x\in I_1\) and \(y\in I_2\) such that \(p=\frac{1}{2}(x+y)\) and that at least one of the inclusions \(x\in K_1\) or \(y\in K_2\) holds. On the other hand, in view of our condition (C1) and of the maximality of the intervals under (5), we must have \((I_2 | p)_{I_1}\subseteq I_1{\setminus } K_1\) and \((I_1 | p)_{I_2}\subseteq I_2{\setminus } K_2\) simultaneously. These inclusions yield that \(x\in I_1{\setminus } K_1\) and \(y\in I_2{\setminus } K_2\). The contradiction shows that \(A\subseteq \mathscr {Z}_\varphi \) is valid. Thus we have obtained solution (ii).

Case 2. Assume now that exactly one of the functions \(f_1\) and \(f_2\) is constant on its domain. Without loss of generality, we can assume that \(f_2(y)=\lambda \) for some \(\lambda \in \mathbb {R}\) whenever \(y\in I_2\). Since the set \(\mathscr {Z}_\varphi ^c\) is not empty there exists a nonempty open subinterval of \(I_1\) on which \(f_1\) takes the value \(\lambda \). By our assumption, this interval must be different from \(I_1\). This forces that \(I_2\) is bounded from below or bounded from above.

Let \(\mathscr {U}\) consist of the open subintervals of \(I_1\) fulfilling the condition that each of them is maximal with respect to the property that \(f_1\) is identically \(\lambda \) on it. On the one hand, the family \(\mathscr {U}\) is nonempty. On the other hand, having a non-extremal solution, \(I_1\) does not belong to \(\mathscr {U}\). Denote \(d{:}{=}\text{ diam }\,I_2\) and consider the subfamily

$$\begin{aligned} \mathscr {U}_d{:}{=}\{U\in \mathscr {U}\mid d\le \text{ diam }\,U\}. \end{aligned}$$

Let us first consider the case where the diameter of each member of \(\mathscr {U}\) is less than d, that is, where the subfamily \(\mathscr {U}_d\) is empty. Then, for any \(p\in \text{ cl }\,\mathscr {Z}_\varphi ^c\), it follows that either

$$\begin{aligned} \inf (2p-I_i)=2p-\sup I_i<\inf I_j\quad \text {or}\quad \sup I_j<\sup (2p-I_i)=2p-\inf I_i\nonumber \\ \end{aligned}$$
(6)

holds, since \(\text{ diam }(2p-I_i)=d\). Consequently at least one of the disjoint intervals \(U_1{:}{=}\,]\inf I_j,a_j(\lambda )[\) and \(U_2{:}{=}\,]b_j(\lambda ),\sup I_j[\) is nonempty. Moreover, by our assumption, we have \(\max (\text{ diam }\,U_1,\text{ diam }\,U_2)<d\le +\infty \), which yields that \(I_j\) is bounded from below or bounded from above. In this subcase, define \((U_n){:}{=}\{U_1,U_2\}\setminus \{\emptyset \}\).

If the family \(\mathscr {U}_d\) is nonempty, then it can be at most countable. Then let \((U_n){:}{=}\mathscr {U}_d\).

Now, in any of the above subcases, define \(\mathscr {K}_1{:}{=}I_1\setminus \bigcup _n U_n\). We show that \(\varphi \) vanishes on the arithmetic mean \(\frac{1}{2}(\mathscr {K}_1+I_2)\).

Indirectly, assume that this is not the case. Then there exists \(p\in \frac{1}{2}(\mathscr {K}_1+I_2)\) such that \(\varphi (p)\ne 0\). Then, on one hand, \(f_1\) takes \(\lambda \) on \((I_2 | p)_{I_1}\). On the other hand \(2p-I_2\subseteq \mathscr {K}_1\subseteq I_1\), consequently \((I_2 | p)_{I_1}=2p-I_2\) and hence \(\text{ diam }(I_2 | p)_{I_1}=d\). In the case \(\mathscr {U}_d=\emptyset \) this is impossible, thus \(\mathscr {U}_d\) cannot be empty. Then there exists a member \(U_{n_0}\) of the sequence \((U_n)\) such that \((I_2 | p)_{I_1}\subseteq U_{n_0}\). Hence, by the definition of \(\mathscr {K}_1\), the interval \((I_2 | p)_{I_1}\) cannot be a subset of \(\mathscr {K}_1\), which is a contradiction. To summarize, in this third case we have obtained solution (iii).

Finally we turn to the sufficiency of (i), (ii), and (iii). In fact, the sufficiency of (i) is obvious.

To prove the sufficiency of (ii), let \(x\in I_1\), \(y\in I_2\), and set \(u{:}{=}\frac{1}{2}(x+y)\). If \(x\in U_1\) and \(y\in V_1\) or \(x\in U_2\) and \(y\in V_2\), then \(f_1(x)=f_2(y)\), and hence equation (1) is trivially satisfied. Thus we can assume that this is not the case. Then we can distinguish two subcases, namely \(x\notin U_1\) or \(y\notin V_1\).

If \(x\in I_1\setminus (U_1\cup U_2)=K_1\), then \(u\in A\) follows, which means that \(\varphi (u)=0\), hence equation (1) is satisfied. If \(x\notin U_1\) and \(y\notin V_2\), then \(\inf K_1=\sup U_1\le x\) and \(y\le \sup K_2=\inf V_2\) hold. Observe that

$$\begin{aligned}{} & {} \inf A=\min \big (\inf \tfrac{1}{2}(K_1+I_2),\inf \tfrac{1}{2}(I_1+K_2)\big )\,\,\text { and }\\{} & {} \sup A=\max \big (\sup \tfrac{1}{2}(K_1+I_2),\sup \tfrac{1}{2}(I_1+K_2)\big ). \end{aligned}$$

Using these, we obtain that

$$\begin{aligned} \inf A \le \tfrac{1}{2}(\inf K_1+\inf I_2) \le u \le \tfrac{1}{2}(\sup I_1+\sup K_2) \le \sup A. \end{aligned}$$

Since A is an interval, it follows that \(u\in A\), and hence \(\varphi (u)=0\). Case \(y\notin V_1\) can be treated in a similar way.

Finally, to prove the sufficiency of (iii), for brevity assume that \(i=1\) and let \(x\in I_1\), \(y\in I_2\), and \(u{:}{=}\frac{1}{2}(x+y)\). If \(x\in U_n\) for some index n, then \(f_1(x)=\lambda =f_2(y)\), thus equation (1) is satisfied. Otherwise \(x\in \mathscr {K}_1\), which yields that \(\varphi (u)=0\). \(\square \)

As a consequence of Theorem 6, we obtain Theorem 3 of paper [4]. For the sake of clarity, the statement in question is formulated using the terminology of the current paper.

Corollary

Let \(I\subseteq \mathbb {R}\) be a nonempty open subinterval, \(\varphi :I\rightarrow \mathbb {R}\) be such that \(\mathscr {Z}_\varphi \) is closed in I, and \(f:I\rightarrow \mathbb {R}\). Then the pair \((\varphi ,f)\) is a solution of equation

$$\begin{aligned} \varphi \Big (\frac{x+y}{2}\Big )\big (f(x)-f(y)\big )=0,\qquad x,y\in I \end{aligned}$$
(7)

if and only if either f is constant on I and \(\varphi \) is any function or there exist constants \(\lambda ,\mu \in \mathbb {R}\) and open subintervals \(U,V\subseteq I\) with

$$\begin{aligned} \inf U=\inf I\quad \text {or}\quad \sup V=\sup I \end{aligned}$$

such that

$$\begin{aligned}{} & {} f(x)=\lambda \quad \text {if}\quad x\in U,\qquad f(y)=\mu \quad \text {if}\quad y\in V,\qquad \text {and}\nonumber \\{} & {} \varphi (u)=0\quad \text {if}\quad u\in \tfrac{1}{2}(I+I\setminus (U\cup V)). \end{aligned}$$
(8)

Proof

Apply Theorem 6 for \(I{:}{=}I_1{:}{=}I_2\) and \(f{:}{=}f_1{:}{=}f_2\). \(\square \)