$y = \begin{cases} 0, & \text{if } x < 0, \\ 2x, & \text{if } x \geq 0. \end{cases}$
How can we represent the above function in one formula?
I'm not exactly sure how to tackle this sort of question. (This is not homework.) It comes from Functions and Graphs by I. M. Gelfand on page 32. On the face of it, it's an easy question that should have an easy answer. Yet my math intuition skills need a lot of work. (Hopefully this book will help!)
To solve this, is there a general method to work backwards from these two "rays" to an absolute value function?
Likewise, turning to page 33 to investigate another problem:
$y = \begin{cases} 2x + 1, & \text{if } x \geq 0, \\ \frac{1}{2}x + 1, & \text{if } x \leq 0. \end{cases}$
For example, $|2x+1|-|\frac{1}{2}x+1|$ clearly can't work as the formula. Besides guessing and attempting all sorts of possible formulas to the end of time, how can we look at this systematically?
Thank you so much for your time and patients!