0

Suppose i have functions $f(x)=min(c_1,max(b_1,x+a_1))$ and $g(x)=min(c_2,max(b_2,x+a_2))$ , how to prove that $g(f(x))=min(c,max(b,x+a))$ . Here except $x$ all other values are constants.

Motivations of the problem : I was reading editorial of some problem here but i was not able to understand how 3rd step came from 2nd in the proof.

laser
  • 1
  • This question could be helpful. I don't mean the answers (which are possibly interesting if you need a proof), but the formula itself in the title (and it works the other way around as well, swapping $\min$ and $\max$) – user3733558 Mar 26 '21 at 13:43

1 Answers1

0

we have

$$f(x)=min(c_1,max(b_1,x+a_1))$$ $$g(x)=min(c_2,max(b_2,x+a_2))$$

Then it's something like

$$g(f(x))=min(c_2,max(b_2,min(c_1,max(b_1,x+a_1))+a_2))$$

$$=min(min(max(c_1,b_2),c_2),max(max(min(b_1,c_1),b_2),x+a_1+a_2^*))$$

Dole
  • 2,754