For differentiability at x=0
f′(0+h)=limh→0h2∣∣∣cosπh∣∣∣−0h−0=0
f′(0−h)=limh→0h2∣∣∣cosπh∣∣∣−0−h=0
∵f′(0+)=f′(0−)=0 (finite)
So f(x) is differentiable at x=0
Now,For differentiability at x=2
f′(2+h)=limh→0(2+h)2∣∣∣cosπ2+h∣∣∣−0h−0
f′(2+h)=limh→0(2+h)2⋅sin(π2−π2+h)h
f′(2+h)=limh→0(2+h)2⋅sin(πh2(2+h))(π2(2+h))h×π2(2+h)
f′(2+h)=(2)2⋅π2⋅2=π
f′(2−h)=limh→0(2−h)2∣∣∣cosπ2−h∣∣∣−0−h=
f′(2−h)=limh→0(2−h)2(−cos(π2−h))−h
f′(2−h)=limh→0(2−h)2⋅sin(π2−π2−h)h=−π
∴f′(2+)≠f′(2−) .
So f(x) is not differentiable at x=2.