express $f$ in the interval $[0, 2]$

52 Views Asked by At

In a question of an exercise, I have to "express the following function in the interval $[0, 2]$ " :

$f\left(x\right)=\left|x-2\left\lfloor\frac{x+1}{2}\right\rfloor\right|$

My initial idea would be that I have to express the function without the absolute value...

Therefore, I tried working with inequalities, ie: we have, if we define $g(x)= x-2 \lfloor\frac{x+1}{2}\rfloor$

$0 \le x \le 2$

and

$-x-1\le \:-2\lfloor \frac{x+1}{2}\rfloor < -x+1$

summing them:

$-x-1\le \:x-2\lfloor \frac{x+1}{2}\rfloor < 3-x$

$-x-1\le g(x) < 3-x$

however I don't get anything meaningful out of this.

By seeing the plot of $g$ ($f$ without the absolute value), it is both positive and negative in this interval.

What am I supposed to do? Did I understand the question wrong?

2

There are 2 best solutions below

0
On BEST ANSWER

Since $x\in[0,2]$, $\frac{x+1}2\in\left[\frac12,\frac32\right]$. If $x\in[0,1)$, then $\frac{x+1}2\in\left[\frac12,1\right)$, and therefore $\left\lfloor\frac{x+1}2\right\rfloor=0$; otherwise, $\left\lfloor\frac{x+1}2\right\rfloor=1$. So, $x-2\left\lfloor\frac{x+1}2\right\rfloor=x$ if $x\in[0,1)$ and $x-2\left\lfloor\frac{x+1}2\right\rfloor=x-2$ otherwise. Can you take it from here?

0
On

In $[0,1)$, $\lfloor \frac{x+1}{2} \rfloor =0$ and your function is $|x|=x$.

In $[1,2]$, the floor evaluates to $1$ and your function is $$|x-2| =2-x$$ as $x-2$ will be non-positive here.