Find Formulas of Absolute and "Ray" Functions $$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!

Thank you. 
It seems that there is no "direct" or "easy" way to solve these types of problems in general. To set up the system of equation you did, you needed to know the generic function ahead of time. Hence, mathematical intuition rules in the end.
It's kind of like factoring. There is no general recipe. That's always hard for me to get use to.
There appears to be a mistake in your reply, however. If x < 0, then y = -cx + dx and not -cx - dx.
The system of equations can't work for the second problem. So intuitively, I kept in mind that whatever the formula is, it would have the constant "+1." Ignoring that allows the system of equations to work. Then afterward, the constant "+1" is to be added: y = (1/2)|x|+(3/2)x+1.
(The next problem in Functions and Graphs has the solution y = .5|x+1|-.5|x-1|. This, again, does not conform to the system of equations. So intuitively, the way I looked at it is its relationship to  y = |x+1|-|x-1|. The only other way that we might arrive at the solution is to notice that it's an odd function. So the formula would have to uphold that.)
