GATE | GATE-CS-2017 (Set 1) | Question 8



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) 1
(D) none of the above


Answer: (B)

Explanation: As we know that, if x > y, then |x – y| = x – y and
if x < y then |x – y| = y – x , because value of |x – y| is always non-negative.
Therefore,

  • Case 1: If x > y :
    (x + y) – |x – y| ] / 2
    =  (x + y) – (x – y) ] / 2
    = 2y / 2
    = y (Minimum of x , y)
  • Case 2: If x < y :
    (x + y) – |x – y| ] / 2
    = (x + y) – (y – x) ] / 2
    = 2x / 2
    = x (Minimum of x , y)

Therefore in both the case we get minimum of (x,y). So, option B

Note that you can take some random values of x and y, then verify given options.

Quiz of this Question



My Personal Notes arrow_drop_up