So I am studying Newton's method and I realize the only two cases where it cannot achieve quadratic convergence is when the first derivative is 0 and second derivative does not exist.
However, how could second derivative not exist? as I thought a function is always dfferentiatable until it reaches $0$. Do you have an example where a function cannot have a second derivative?
and also, zero first derivative means the $f'(x)$ of a function is zero at the root, then for example
$(x-2)^2=0$ --- where there is a multiple root and newton's method does not achieve quadratic convergence, but the first derivative is not 0 at root. Why?
If $f$ is continuous everywhere (for simplicity) and not differentiable at $x_0$, then $F(x)=\int_a^x f(y) dy$ is differentiable only once at $x_0$. For a concrete example, the function
$$F(x)=\int_{-1}^x |y| dy$$
is differentiable only once at $0$. Thus the Newton iteration for
$$G(x)=\int_{-1}^x |y| dy - \frac{1}{2}$$
for initial conditions close to zero, should not be expected to converge quadratically.
In your example you just have a calculation error, $\frac{d}{dx} (x-2)^2 = 2(x-2)$ which is indeed zero at $x=2$.