Given 2 non negative, ordered real variables $x, y$ such that we know:

  1. $x\geqslant y$
  2. $x - y = d$
  3. $x+y=1$

Given another variable $k$ such that either:

  1. $k=0$ or
  2. $k=d^2-d$

The objective is to construct a single algebraic equation such that:

  1. The equation outputs $d$ when value of $k$ is non zero i.e. $k=d^2-d$.
  2. It outputs 0 when $k$ is 0.

Essentially we are trying to encode a logical constraint in a simple mathematical equation. The simple approach is to take $d^2-d$ or 0 as the constant and solve the quadratic equation $x^2-x=k$ but it will give 2 results in each case:

  1. $d$ and $1-d$
  2. 0 and 1

How do we enforce the logic/selection using basic mathematical operations [+, - , *, /, abs()]. We are not allowed to use any logical operations or operations that internally use logic or require if/else kind of tests at any level as that defeats the original purpose and makes the problem trivial.

Been struggling with it for days can someone please help?

  • $\begingroup$ Are $x$ and $y$ the inputs of the expression you seek? $\endgroup$ Jul 17, 2021 at 16:32
  • $\begingroup$ we are given these 2 variables [but of course we do not know their values] $\endgroup$
    – J.Doe
    Jul 17, 2021 at 16:34
  • $\begingroup$ The operations you want to restrict yourself to are all continuous (in their various domains), and therefore it is impossible to use them to build the discontinuous function you have defined (namely, when $k=d^2-d$ you want $0$ for $y=0$ but $1-2y$ when $y>0$. If you're willing to divulge more about the "original purposes" that would "defeated" by other mechanisms is, it might be possible to point you in a useful direction, though. $\endgroup$ Jul 17, 2021 at 16:38
  • 1
    $\begingroup$ No, the absolute-value function cannot help -- it is continuous too. $\endgroup$ Jul 17, 2021 at 16:47
  • 1
    $\begingroup$ That is still a continuous function. Nothing new there; it won't help you create anything discontinous. This is not because you lack ingenuity -- it is a general fact, proved in elementary real analysis courses, that everything you can possibly construct by composing continuous functions will itself be continuous. $\endgroup$ Jul 17, 2021 at 16:53


You must log in to answer this question.

Browse other questions tagged .