Triangle inequality with a condition

78 Views Asked by At

I have these 4 inequalities:

$$a+b\geqslant c$$ $$a+c\geqslant b$$ $$b+c\geqslant a$$

and $$0\leqslant b\leqslant N$$

How do I solve this? I need to go from $$|a-b|\leqslant c\leqslant a+b$$to $$a-N\leqslant c\leqslant a+N$$ but I don't know how to get to that answer.

3

There are 3 best solutions below

2
On BEST ANSWER

It is not clear what the "this" is that you are trying to "solve".

But the conclusion $a - N \le c \le a +N$ follows easily from:

$b \le N \implies a - N \le a - b $ and $a+b \le a + N$, while $b\ge 0\implies a-b \le a \le a+b$. So we have $a - N \le a - b\le a+b \le a+N$.

As $a+b \ge c$ we know $c \le a+b$. And as $b+c \ge a$ we know $c \ge a-b$.

So we have $a-N \le a-b \le c \le a+b \le a+N$.

2
On

I used proof by contradiction to prove it mathematically. Let's assume d(x, z) = n(worst case scenario), but d(y, z) - d(y, x) $>$ n. Or in other words the word z is outside of the interval. One way to go from x to z, is to go from x to y, and then from y to z. The best case scenario is that all changes made from x to y are reversed from y to z, which makes the least number of changes to make to go from x to z, d(y, z) - d(y, z) > n. So it is impossible for z to be an answer. Example: root = quera n = 1 is puera related to quera? query -> quera 1 move quera -> puera 2 moves Luckily for us, the one move made from query to quera is reversed when going from quera to puera(we make a equal to y, then make y equal to a again), which makes it 2 moves - 1 move = 1 move But if we were looking at puerb, then the move wouldn't have reversed, this making puerb inappropriate.

0
On

$$a-b\leqslant |a-b|\leqslant c\leqslant a+b$$ $$\implies$$ $$a-b\leqslant c\leqslant a+b$$ $$\implies$$ $$-b\leqslant c-a\leqslant b$$ $$\implies$$ $$-N\leqslant c-a\leqslant N$$ $$\implies$$ $$a-N\leqslant c\leqslant a+N$$

and since

$$c\geqslant0$$ $$\implies$$ $$max(0,a-N)\leqslant c\leqslant a+N$$