g[f(x)]={f(x)+1,f(x)<0(f(x)−1)2+b,f(x)≥0
⇒g[f(x)]=⎧⎪
⎪
⎪⎨⎪
⎪
⎪⎩x+a+1,x+a<0 and x<0|x−1|+1,|x−1|<0 and x≥0(x+a−1)2+b,x+a≥0 and x<0(|x−1|−1)2+b,|x−1|≥0 and x≥0
⇒g[f(x)]=⎧⎪
⎪
⎪⎨⎪
⎪
⎪⎩x+a+1,x∈(−∞,−a) and x∈(−∞,0)|x−1|+1,x∈ϕ(x+a−1)2+b,x∈[−a,∞) and x∈(−∞,0)(|x−1|−1)2+b,x∈R and x∈[0,∞)
⇒g[f(x)]=⎧⎪⎨⎪⎩x+a+1,x∈(−∞,−a)(x+a−1)2+b,x∈[−a,0)(|x−1|−1)2+b,x∈[0,∞)
Given g(f(x)) is continuous for all x∈R.
So, at x=−a and at x=0,
1=b+1 and (a−1)2+b=b
⇒b=0 and a=1
⇒a+b=1