How would I prove that these two expressions are equivalent?

257 Views Asked by At

I want to figure out a way to simpilfy

$$x* \frac{1-\frac{|0-x|}{0-x}}{2}$$

to show that it is the same as

$$\frac{x+|x|}{2}$$

Or go the other way around and complicate the second equation so that it looks the same. I've been having trouble figuring out how to manipulate the 0-x that is inside the absolute value.

I get about this far then am not sure how to continue.

$$\frac{x-\frac{|-x^2|}{-x}}{2}$$


background context:

I needed an equation that took a number and set all the negative values to 0. I've already created a function in the past that took any number, and set the value below a certain threshold to zero:

$$x* \frac{1-\frac{|t-x|}{t-x}}{2}$$

where t is the threshold. So I could put in like 17 and anything less than 17 would be set to 0.

But I knew since the threshold in this case was 0 that probably meant I could cancel a bunch of stuff out and simplify the function. Then someone I work with offered the second function. And after checking the logic, it does have the exact same behavior or setting all negative numbers to be 0.

My equation tries to set the number to either 1 or -1, then shifts it over to be 2 or 0, cuts it in half to be 1 or 0, then multiplies by the original value.

Their equation is just set the number to 2x if it's positive, or 0 if it's negative. Then divides by 2 to get the original value, or it'll stay stuck at 0.

I was wondering if there were any edge cases where these two equations provided different answers, and want to practice math a bit. But still pretty bad at knowing all the algebra rules out there for simplification.

1

There are 1 best solutions below

4
On

Recall that $|{-x}|$ is equal to $|x|$ for all $x$. Thus, $$x \cdot \frac{1 - \frac{|0 - x|}{0 - x}}{2} = \frac{x}{1} \cdot\frac{1 - \frac{|{-x}|}{-x}}{2} = \frac{x\left(1 + \frac{|x|}{x}\right)}{1 \cdot2} = \frac{x + |x|}{2}.$$