Question:medium

If $f(x)=\begin{cases} x+a, & x \leq 0 \\ |x-4|, & x\gt0\end{cases}$ and 
$g(x)= \begin{cases}x+1 & , x\lt0 \\ (x-4)^2+b, & x \geq 0\end{cases}$ 
are continuous on $R$, then $(gof) (2)+(fog)(-2)$ is equal to:

Updated On: Mar 23, 2026
  • -10
  • 10
  • 8
  • -8
Show Solution

The Correct Option is D

Solution and Explanation

 To solve the given problem, we need to ensure the continuity of the functions \( f(x) \) and \( g(x) \) at the specified points, and then evaluate \( (g \circ f)(2) \) and \( (f \circ g)(-2) \).

Step 1: Continuity of the Functions

The function \( f(x) \) is defined as:

  • \( f(x) = x + a, \; x \leq 0 \)
  • \( f(x) = |x-4|, \; x > 0 \)

To ensure continuity at \( x = 0 \), the left-hand limit must equal the right-hand limit and the function value at that point:

  • \(\lim_{{x \to 0^-}} (x + a) = 0 + a = a\)
  • \(\lim_{{x \to 0^+}} |x-4| = |0-4| = 4\)

For continuity, set \( a = 4 \).

The function \( g(x) \) is defined as:

  • \( g(x) = x + 1, \; x < 0 \)
  • \( g(x) = (x-4)^2 + b, \; x \geq 0 \)

To ensure continuity at \( x = 0 \), compute the left-hand and right-hand limits:

  • \(\lim_{{x \to 0^-}} (x + 1) = 0 + 1 = 1\)
  • \(\lim_{{x \to 0^+}} (x-4)^2 + b = (0-4)^2 + b = 16 + b\)

For continuity, set \( 16 + b = 1 \), which gives \( b = -15 \).

Step 2: Calculate \( (g \circ f)(2) \)

Since \( f(x) = |x-4| \) when \( x > 0 \), we have:

  • \( f(2) = |2-4| = 2 \)

Now evaluate \( g(f(2)) = g(2) \):

  • \( g(2) = (2-4)^2 + b = 4 - 15 = -11 \)

Step 3: Calculate \( (f \circ g)(-2) \)

Since \( g(x) = x+1 \) when \( x < 0 \), we have:

  • \( g(-2) = -2 + 1 = -1 \)

Now evaluate \( f(g(-2)) = f(-1) \):

  • \( f(-1) = -1 + 4 = 3 \)

Step 4: Final Expression

We are asked to find \( (g \circ f)(2) + (f \circ g)(-2) \):

Thus, the expression is \(-11 + 3 = -8\).

Conclusion: Therefore, the value of \( (g \circ f)(2) + (f \circ g)(-2) \) is \(-8\). The correct answer is -8.

Was this answer helpful?
1