<s>[INST] If $f(x)$ is differentiable for all real numbers, then what is the value of $\frac{a+b+c}{2}$? 
If $f(x)=\begin {cases} a^2 + e^x & -\infty <x<0 \\ x+2 & 0\le x \le 3 \\ c -\frac{b^2}{x} & 3<x<\infty \end{cases}$, where $a,b,c$ are positive quantities. If $f(x)$ is differentiable for all real numbers, then value of $\frac{a+b+c}{2}$ is

Left hand derivative at $x=0$
$$Lf’(0) =\lim_{h\to 0} \frac{2 - (a^2 +e^{-h})}{h}$$
For limit to exist, $2-a^2=0 \implies a=\pm \sqrt 2$
$$L f’(0)=1$$
Right hand derivative at $x=0$
$$R f’(0) =\lim_{h\to 0} \frac{ h+2 -2}{h} =1$$
Left hand derivative at $x=3$
$$Lf’(3) =\lim_{h\to 0} \frac{5- (3-h+2)}{h}=1$$
And
$$Rf’(3) =\lim_{h\to 0} \frac{ c -\frac{b^2}{3+h}-5}{h}$$
For limit to exist, $c=h$
$$Rf’(3) =\lim_{h\to 0} \frac{b^2}{(3+h)(h)}=\infty$$
Where am I going wrong?
 [/INST] In order to be differentiable everywhere, $f$ must be continuous.  As $f$ is a piecewise continuous function:
To solve for $a$, in the last step using the fact that $a$ is positive
$$\lim_{x\rightarrow0^-}f(x)=\lim_{x\rightarrow0^+}f(x)$$
$$\lim_{x\rightarrow0^-}(a^2+e^x)=\lim_{x\rightarrow0^+}(2+x)$$
$$a^2+e^0=2+0$$
$$a^2=1$$
$$a=1$$
Similarly, we can solve for $c$ in terms of $b$:
$$\lim_{x\rightarrow3^-}f(x)=\lim_{x\rightarrow3^+}f(x)$$
$$\lim_{x\rightarrow3^-}(2+x)=\lim_{x\rightarrow3^+}(c-\frac{b^2}{x})$$
$$2+3=c-\frac{b^2}{3}$$
$$c=5+\frac{b^2}{3}$$
Now, we take into account that $f$ is differentiable at $x=3$ (and using the fact that $b$ is positive):
$$\lim_{x\rightarrow3^-}f'(x)=\lim_{x\rightarrow3^+}f'(x)$$
$$\lim_{x\rightarrow3^-}1=\lim_{x\rightarrow3^+}\frac{b^2}{x^2}$$
$$1=\frac{b^2}{9}$$
$$b=3$$
$$c=5+\frac{b^2}{3}=5+3=8$$
Therefore $\frac{a+b+c}{2}=\frac{1+3+8}{2}=6$
</s>