How to find what values of $a$ make $f(x)=x^2$ if $x\geq 0$ and $f(x)=ax$ if $x<0$ continuous and differentiable at 0? Let $f(x)=\begin{cases} x^2, \text{ if } x\geq 0\\ ax, \text{ if } x<0\end{cases}$ 
(a) For which values of $a$ is $f$ differentiable at $x=0$?
(b) For which values of $a$ is $f$ continuous at $x=0$?
(c) When $f$ is differentiable at $x=0$, does $f^{\prime\prime}(0)$ exist?
Here is the function as $a$ goes from $-10$ to $10$.

Here is my attempt:
(a) $a$ is differentiable at $x=0$ for only $a=0$. This is because the transition between the function pieces is "smooth". Though, I am also thinking, $a$ is differentiable at $x=0$ for all $a\geq 0$ because near $x=0$, $ax$ would behave similarly to $x^2$.
(b) The graph shows it is continuous everywhere for all $a$. I am unsure how to prove this though because we don't have $f(x)$ is differentiable for all $a$ at $x=0$.
(c) I am unsure about this one. I want to say no because there may be a jump in the slopes of the tangent lines if $a\ne0$. However, if the answer to (a) is $a=0$, then it would be a smooth transition and the tangent lines' slopes would be smooth transitions too.
 A: *

*Yes, it's only when $a=0$. That's because that's the only case in which$$\lim_{x\to0^+}\frac{f(x)-f(0)}x=\lim_{x\to0^-}\frac{f(x)-f(0)}x.$$

*For any $a$, we have$$\lim_{x\to0^+}f(x)=\lim_{x\to0^-}f(x)=0=f(0).$$So, your answer is correct.

*No, because $f$ is differentiable at $0$ only when $a=0$ and, in that case, the right derivative of $f'$ at $0$ is different from the left derivative. Therefore, $f''(0)$ doesn't exist.

A: For point (a) you can compute the derivatives: for $x\geq0$ the derivative of $f$ is $f'(x)=2x$ and for $x<0$ is $f'(x)=a$. To say that $f$ is differentiable at the origin, you need that
$$ 
a=\lim_{x\to0^-}f'(x)=\lim_{x\to0^+}f'(x)=0
$$
So only $a=0$ works. 
For point (b) the technique is the same, but you only need to check the limit of the function (not the derivative)
$$
0=\lim_{x\to0^-}f(x)=\lim_{x\to0^+}f(x)=0
$$
So continuity holds for every $a$.
For point (c) you know that $f$ is differentiable iff $a=0$, so the function you are considering is $0$ for $x<0$ and $x^2$ for $x\geq 0$. Computing the second derivatives you obtain $f''(x)=0$ for $x<0$ and $f''(x)=2$ for $x\geq 0$, hence you have 
$$
\lim_{x\to0^-}f''(x)=0\ne2=\lim_{x\to0^+}f''(x)
$$
So $f$ is not differentiable two times in $x=0$.
A: $(a)$ $Rf'(0)=\lim_{x\to0^{+}}\frac{f(x)-f(0)}{x}=\lim_{x\to0^{+}}\frac{x^2}{x}=\lim_{x\to0^{+}}x=0$ and $Lf'(0)=\lim_{x\to0^{-}}\frac{f(x)-f(0)}{x}=\lim_{x\to0^{-}}\frac{ax}{x}=a$
$f$ is differentiable if $Rf'(0)=Lf'(0)$,i.e., $a=0$
$(b)$ $Rf'(0)=\lim_{x\to0^{+}}f(x)=\lim_{x\to0^{+}}x^2 =0$ and $Lf'(0)=\lim_{x\to0^{-}}ax=0$
$f$ is continuous.
$(c)$ $Rf''(0)=2$ and $Lf''(0)=0$
$f$ is not twice differentiable.
