Let #g(x) = int_0^x f(t)dt#.
Then:
#(1)# When #x < 0#, as #f(t) = 0# for #t in (x,0)#, then #g(x) = 0#
#(2)# When #0 < x <= 1#,
#g(x) = int_0^x f(t)dt = int_0^x tdt = x^2/2#
#(3)# When #1 < x <= 2#,
#g(x) = int_0^x f(t)dt = int_0^1 tdt + int_1^x (2-t)dt #
#g(x) = int_0^x f(t)dt = g(1) + int_1^x 2dt -int_1^x tdt #
#g(x) = int_0^x f(t)dt = 1/2 + 2(x-1) - x^2/2 + 1/2 #
#g(x) = int_0^x f(t)dt = -1+ 2x- x^2/2 #
#(4)# When #x > 2#, #f(t) = 0# for #t in(2,x)#, so:
#g(x) = int_0^x f(t)dt = int_0^2 f(t) dt + int_2^x 0*dt = g(2) = 1#
In summary:
#g(x) = {(0 " if " x < 0), (x^2/2 " if "0 <= x < 1), ( -1+ 2x- x^2/2 " if " 1 <= x < 2), (1 " if " x >= 2):}#
#f(x)# is defined as a continuous functions inside each of the intervals #(-oo,0),(0,1),(1,2),(2,+oo)#
At the boundaries we have
#lim_(x->0^-) f(x) = 0#
#lim_(x->0^+) f(x) = 0 = f(0)#
#lim_(x->1^-) f(x) = 1 = f(1)#
#lim_(x->1^+) f(x) = 1#
#lim_(x->2^-) f(x) = 0 = f(2)#
#lim_(x->2^+) f(x) = 0#
So the #f(x)# is continuous for any #x in RR#.
#f(x)# is also differentiable inside each of the intervals #(-oo,0),(0,1),(1,2),(2,+oo)#, but as:
#f'(x) = {(0 " if " x < 0), (1 " if "0 <= x < 1), ( -1 " if " 1 <= x < 2), (0 " if " x >= 2):}#
it is not differentiable in #x=0, x=1, " and " x=2#.
Clearly #g(x)# is differentiable everywhere because:
#d/dx g(x) = f(x)#