Question

The expression (x+y)−∣x−y∣2\frac{(x + y) - |x - y|}{2} is equal to

Choose one option
Official answer and solution
Official answer
B
From
Official GATE 2017 answer key

Solution

Evaluate the expression by analyzing the two complementary cases: x >= y and x < y.

Consider the given expression:

E=(x+y)−∣x−y∣2E = \frac{(x + y) - |x - y|}{2}

By the definition of the absolute value function ∣z∣|z|:

  • Case 1: x≥yx \ge y.
    Then ∣x−y∣=x−y|x - y| = x - y.
    Substituting into the expression:
    E=(x+y)−(x−y)2=x+y−x+y2=2y2=yE = \frac{(x + y) - (x - y)}{2} = \frac{x + y - x + y}{2} = \frac{2y}{2} = y
    Since x≥yx \ge y, the minimum of xx and yy is yy. Thus, E=min⁡(x,y)E = \min(x, y).
  • Case 2: x<yx < y.
    Then ∣x−y∣=−(x−y)=y−x|x - y| = -(x - y) = y - x.
    Substituting into the expression:
    E=(x+y)−(y−x)2=x+y−y+x2=2x2=xE = \frac{(x + y) - (y - x)}{2} = \frac{x + y - y + x}{2} = \frac{2x}{2} = x
    Since x<yx < y, the minimum of xx and yy is xx. Thus, E=min⁡(x,y)E = \min(x, y).

In both cases, the expression identically evaluates to the minimum of xx and yy:

(x+y)−∣x−y∣2=min⁡(x,y)\frac{(x + y) - |x - y|}{2} = \min(x, y)

(Note: the corresponding formula with addition, (x+y)+∣x−y∣2\frac{(x + y) + |x - y|}{2}, equals max⁡(x,y)\max(x, y)).

Final answer

B

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2017 Computer Science and Information Technology (CS) Session 1
Question
63 of 65, printed as GA Q.63
Section
General Aptitude

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.