Maximum of a function which may not be continuous

I have the following function:

$$\frac{2(xe^y + z)}{(x(1+e^y) + z)}$$

I want to find the maximum of the function with the following constraint:

$$x \leq \frac{(1 - z)}{(1 + e^y)}$$

My questions are:

1. What conditions should I check to make sure that the maximum exists?
2. And how to find the maximum value?

Thanks!

The question asks to find the maximum of the function

$$f(x,y,z) = \frac{2(xe^y + z)}{x\left(1+e^y\right) + z} \tag{1}\label{eq1}$$

subject to the constraint of

$$x \leq \frac{1 - z}{1 + e^y} \tag{2}\label{eq2}$$

The domain of $$x,y,z$$ is unspecified, but I'll assume it's $$\mathbb{R}$$.

In answer to the first question, I would first check if there is any simplification which can be done with the function in \eqref{eq1}. With the numerator, you have

\begin{align} 2\left(xe^y + z\right) & = 2\left(x + \left(xe^y + z\right) - x\right) \\ & = 2\left(x\left(1 + e^y\right) + z - x\right) \\ & = 2\left(x\left(1 + e^y\right) + z\right) - 2x \tag{3}\label{eq3} \end{align}

Next, note since $$e^y \gt 0$$, you can multiply both sides of \eqref{eq2} by $$1 + e^y$$ to get

$$x\left(1+e^y\right) \le 1 - z \; \iff \; x\left(1+e^y\right) + z \le 1 \tag{4}\label{eq4}$$

This shows the denominator of the fraction in \eqref{eq1} can become arbitrarily close to either side of $$0$$, indicating no maximum is likely. To confirm this, let $$y = 0$$, $$x = 1$$, $$z \le -1$$ but $$z \ne -2$$. Then \eqref{eq4} still holds and you can substitute \eqref{eq3} into \eqref{eq1} to get

\begin{align} f(x,y,z) & = 2 + \frac{-2x}{x\left(1+e^y\right) + z} \\ & = 2 + \frac{-2}{2 + z} \tag{5}\label{eq5} \end{align}

Next, note that

\begin{align} \lim_{z \, \to \, -2^{-}} f(x,y,z) & = \lim_{z \, \to \, -2^{-}} \left(2 + \frac{-2}{2 + z}\right) \\ & = \infty \tag{6}\label{eq6} \end{align}

This formally shows there is no maximum value with just the one current constraint. Also, the limit $$z$$ going to $$-2^{+}$$ instead shows no minimum exists either since the limit then is $$-\infty$$ instead.

• Thank you so much! It is possible to have lower bound under this constraint? And what will happen if we consider both $x$ and $y$ $>$ $0$? Jul 15, 2019 at 23:07
• @Shahnewaz You're welcome. As my last sentence states, there's no lower bound either. I just edited my answer to explicitly state the limit would become $-\infty$ when checking for $z$ going to $-2$ from above. My example already has $x \gt 0$. I chose $y = 0$ for convenience, but if you have $y \gt 0$ for some small value, it will just reduce what $z$ needs to approach slightly in the limit for $x\left(1 + e^y\right) + z$ to approach $0$, but it won't otherwise change the general approach I used. Jul 15, 2019 at 23:11
• Just one for question for clarification. If after simplification, my denominator was some sort of $1 - \frac{1}{2} (x(1+e^y) + z)$, then shouldn't I have a lower bound? Because in that case the denominator would be $\frac{1}{2}$. So it would be 2 - 4x Jul 16, 2019 at 16:40
• @Shahnewaz Yes, if your denominator was something like $1-\frac{1}{2}(x(1+e^y)+z)$, then it would have a positive minimum value of $\frac{1}{2}$. Let $D$ be your denominator. Since $D \ge \frac{1}{2}$, then $2D \ge 1$ and $\frac{1}{D} \le 2$. Now, if $x \ge 0$, then $\frac{-2x}{D} \ge -4x$ giving a lower bound of $2-4x$ as you state. Also, if $x \lt 0$, then $-2x \gt 0$ so $\frac{-2x}{D} \le -4x$, giving $2-4x$ as an upper bound. Jul 16, 2019 at 17:04
• Thanks again! You really clarified a lot of things for me Jul 16, 2019 at 17:13