The expression (x + y - |x - y|) / 2 is equal to:
A. The maximum of x and y
B. The minimum of x and y
C. (x + y + |x - y|) / 2
D. None of the above
GATE 2017 · General Aptitude · Absolute Value · medium
Answer: B. The minimum of x and y. The expression (x + y - |x - y|) / 2 = min(x, y).
- Case 1: x >= y: E = (x + y - (x - y)) / 2 = (x + y - x + y) / 2 = 2y / 2 = y. Since x >= y, y = min(x, y).
- Case 2: x < y: E = (x + y - (y - x)) / 2 = (x + y - y + x) / 2 = 2x / 2 = x. Since x < y, x = min(x, y).
- Combine both cases: In all cases, (x + y - |x - y|) / 2 = min(x, y). Therefore option B is correct.