I'm not sure if i got this right since instead of using the limit definition i just differentiated, but...

Given the piecewise function: f(x) = sin(x) , x<= 0 ; f(x) = ax - x^2 , x>0

find the value a such that f'(0) exists.

What I did:

(sinx)' = cosx and (ax-x^2)' = a-2x ; then i set them equal and solve for f'(0) to get a=1

and that's my answer, which i think makes sense since when i graph it there doesn't seem to be any corners.