# Solving System of Equations

(Re-posted from StackOverflow as suggested)

I have the following problem.

The functions $f(x),g(x)$ are defined as $$f(x) = \begin{cases} f_1(x) & 0 \leq x \leq 10, \\ f_2(x) & 10 < x \leq 20, \\ 0 & \text{otherwise}, \end{cases} \qquad g(x) = \begin{cases} g_1(x) & 0 \leq x \leq 5, \\ g_2(x) & 5 < x \leq 20, \\ 0 & \text{otherwise}, \end{cases}$$ In addition, we require the constraints $$\int_0^{20} f(x) dx \geq K, \quad \int_0^{20} g(x) dx \geq Q, \quad f(x)+g(x) \leq R \text{ for all x}.$$ where $K,Q,R$ are parameters.

I assume there is quite some elaborate theory behind it, and was wondering if anybody could point me in the right direction to devise an algorithm that can generate $f_1(x), f_2(x), g_1(x), g_2(x)$?

I would like to add that for a given $K$ and $Q$, the interest is to keep $R$ as low as possible.

• Do you mean that when $x \in [0, 10)$, $f(x) = f_1(x)$ and when $x \in [10, 20]$, $f(x) = f_2(x)$? What sort of restriction is that? – Karolis Juodelė Apr 5 '14 at 16:26
• Yeah, that's what I mean, f1(x)!=f2(x) – MrD Apr 5 '14 at 16:28
• I can take any function $f$ and define $f_1(x) = f(x)\cdot 1_{[0, 10)}(x)$ where $1_{[...]}$ is an indicator function. My point is that dividing $f$ into two functions adds nothing to the problem. – Karolis Juodelė Apr 5 '14 at 16:33
• I may have gotten the syntax wrong, but I hope what I mean is still clear? – MrD Apr 5 '14 at 16:34
• So is there actually a point to $f_1, f_2$ or not? – Karolis Juodelė Apr 5 '14 at 16:36

Let $X$ be a random variable distributed uniformly over $[0,20]$. Your constraints imply $$\mathbb{E}[f(X)] \geq \frac{K}{20}, \qquad \mathbb{E}[g(X)] \geq \frac{Q}{20}.$$ We conclude that $$\mathbb{E}[f(X)+g(X)] \geq \frac{K+Q}{20},$$ and so there is some point $x \in [0,20]$ such that $f(x) + g(x) \geq (K+Q)/20$. In particular, $R \geq (K+Q)/20$. This bound is tight, as shown by the functions $$f(x) = \frac{K}{20} \mathbf{1}_{x \in [0,20]}, \qquad g(x) = \frac{Q}{20} \mathbf{1}_{x \in [0,20]}.$$
• You have a constraint on $\int_0^{20} f(x) dx$, and this translates to a constraint on $\mathbb{E}[f(X)]$ since the density of $X$ is $(1/20)\mathbf{1}_{x \in [0,20]}$. – Yuval Filmus Apr 5 '14 at 18:22
• This solution only works for $R \geq (K+Q)/20$, in which case I hope you can answer this yourself. The first part shows that there is no solution if $R < (K+Q)/20$. – Yuval Filmus Apr 6 '14 at 14:15