How to create a function $f$ such that $f(x,y)$ is high when either $x$ or $y$ is? There are two variables, let's say $x$ and $y$.
I want to come up with a function $f:[0,5]\times[0,5]\longrightarrow[0,5]$ that respects the following rules:

*

*If $x$ is high (close to the maximum value of 5) and $y$ is low (close to $0$), $f(x,y)$ should results in a high value (close to 5). The same would happen for the reverse ($x$ with a low value and $y$ with a high value)

*If $x$ is high and $y$ is high, $f(x,y)$ will also be high; it would be useful that the values resulted would be higher than those from point $(1)$.

*If $x$ is low and $y$ is low, $f(x,y)$ should result in low values.

I'm having troubles starting imagining what mathematical functions would be useful, as I am not even close to being advanced in the concepts of Mathematics. Any ideas would be appreciated, at least in the sense of finding any information that could get me started.
 A: You can take, for instance,$$f(x,y)=\frac45\max\{x,y\}+\frac15\min\{x,y\}.$$It has all the properties that you are interested in.
A: One way to model this could be to use the distance from the line:
$$
x+y=0
$$
through $(0,0)$. This line has normal vector:
$$
\vec n=
\begin{pmatrix}
1\\
1
\end{pmatrix}
$$
and the distance of a given point $(x,y)$ to this line is proportional to $t=\vec n\cdot\langle x,y \rangle=x+y$ so in case we want something like:
$$
f(5,5)=5\\
f(5,0)=4\\
f(0,0)=0
$$
we can connect this to a single dimensional function:
$$
f(x,y)=g(x+y)
$$
where
$$
g(10)=5\\
g(5)=4\\
g(0)=0
$$
A way to achieve this could be to add the extra requirement $g'(10)=0$ so that $f$ has maximum at $(x,y)=(5,5)$ and build $g(0)=0$ in:
$$
g(t)=at^3+bt^2+ct
$$
Hence
$$
\begin{align}
g(10)&=1000a+100b+10c&&=5\\
g(5)&=125a+25b+5c&&=4\\
g'(10)&=300a+20b+c&&=0
\end{align}
$$
which can be solved for $a,b,c$ to have:
$$
f(x,y)=g(x+y)=0.002(x+y)^3-0.09(x+y)^2+1.2(x+y)
$$
See this link to look at interactive GeoGebra-applet with 3D-plot of this function

ADDENDUM: As can be seen both from the other answer and from comments, there will be (infinitely) many ways to satisfy your requirements, but to point you towards handling the additional requirement stated in your comment below this post, you could simply add a modifier to the above solution which takes the distance to the perpendicular line:
$$
x-y=0
$$
as input. This distance is (similarly) proportional to $t=x-y$, and so we need a modifier function $m(x,y)=h(x-y)=h(t)$ that satisfies:
$$
h(0)=0\\
h(5)=m(5,0)\\
h(-5)=m(0,5)
$$
so just choose which modification you want at $(5,0)$ and $(0,5)$ and match for instance a quadratic function as $h$:
$$
h(t)=\alpha t^2+\beta t+\gamma
$$
and combine:
$$
\begin{align}
q(x,y) &=f(x,y)+m(x,y)\\
&=g(x+y)+h(x-y)\\
&=a(x+y)^3+b(x+y)^2+c(x+y)+\alpha(x-y)^2+\beta(x-y)+\gamma
\end{align}
$$
but be a little careful - if $h(t)$ increases too rapidly away from $h(0)$ to one side, then $q$ may exceed a value of $5$.
Here is GeoGebra-applet with example of this technique
