Show that $f$ have a zero of $m\ge n$ multiplicity iff exists some $g$ such that $f(x)=(x-x_0)^n g(x)$ It is the exercise 10 on page 348 of Analysis I of Amann and Escher. Please, comment if this lacks something. Thank you.

Let $X\subseteq\Bbb K$ be perfect and $f\in C^n(X,\Bbb K)$ for some $n\in\Bbb N_{>0}$. A number $x_0\in X$ is called a zero of multiplicity $n$ of $f$ if $f(x_0)=f'(x_0)=\ldots=f^{(n-1)}(x_0)=0$ and $f^{(n)}(x_0)\neq 0$.
Show that if $X$ is convex, then $f$ have a zero of multiplicity $\ge n$ at $x_0$ if and only if there is some $g\in C(X,\Bbb K)$ such that $f(x)=(x-x_0)^n g(x)$ for all $x\in X$.

$(\implies)$ From the characteristics of $f$ if we define
$$g(x):=\begin{cases}\frac{f(x)}{(x-x_0)^n}, &x\in X\setminus\{x_0\}\\f^{(n)}(x_0)/n!,& x=x_0\end{cases}$$
the function is continuous and defined in $X$ since
$$\lim_{x\to x_0}\frac{f(x)}{(x-x_0)^n}=\lim_{x\to x_0}\frac{f^{(n)}(x)}{n!}=\frac{f^{(n)}(x_0)}{n!}$$
The limit is well-defined because $X$ is perfect. Because $f$ is $n$-times differentiable then $g$ is $n$-times differentiable at least in $X\setminus\{x_0\}$.
$(\impliedby)$ If we have a function $g\in C^n(X,\Bbb K)$ then the function defined by
$$f(x):=(x-x_0)^n g(x)$$
have a zero of multiplicity $m\ge n$ in $x_0$. Certainly $g\in C(X,\Bbb K)$, as required.

Question: I dont know how to complete the discrepancy about $g$ in one implication or the other, I mean, from the first implication we need that $g$ would be $n$-times differentiable at least in $X\setminus\{x_0\}$. But from the second implication I only can define $g$ as $n$-times differentiable in $X$.
 A: If we have $f \in C^n(X,\mathbb{K})$, and $f$ has a representation
$$f(x) = (x - x_0)^n\cdot g(x),\tag{1}$$
then, without any a priori assumptions on $g$, it follows that $g$ is $n$ times continuously differentiable on $X\setminus \{x_0\}$, since the function $x \mapsto (x - x_0)^{-n}$ is infinitely often differentiable on $\mathbb{K}\setminus \{x_0\}$, hence $x \mapsto f(x)\cdot (x-x_0)^{-n}$ is outside $\{x_0\}$ as smooth as $f$ is.
A representation $(1)$ can (for $n > 0$) only exist when $f(x_0) = 0$, and if that is the case, then for every $c\in \mathbb{K}$, the function
$$g_c \colon x \mapsto \begin{cases} f(x)\cdot (x-x_0)^{-n} &, x \in X\setminus \{x_0\} \\ \qquad c &, x = x_0\end{cases}$$
gives a representation $(1)$, and every $g$ satisfying $(1)$ is one of the $g_c$. The function $g_c$ is continuous at $x_0$ if and only if
$$c = \lim_{x\to x_0} \frac{f(x)}{(x-x_0)^n}.$$
Thus we can reword the exercise as

If $X$ is convex (and perfect, and $f \in C^n(X,\mathbb{K})$), then $f$ has a zero of order $\geqslant n$ at $x_0$ if and only if $$\lim_{x\to x_0} \frac{f(x)}{(x-x_0)^n}$$ exists in $\mathbb{K}$.

We deduce both directions from the Taylor expansion of $f$ about $x_0$. We have
$$f(x) = \sum_{k = 0}^{n} \frac{f^{(k)}(x_0)}{k!}(x-x_0)^k + R_n(f,x_0)(x),\tag{2}$$
with the bounds
$$\lvert R_n(f,x_0)(x)\rvert \leqslant \frac{\lvert x-x_0\rvert^n}{(n-1)!}\cdot \sup \bigl\{ \lvert f^{(n)}\bigl(x_0 + t(x-x_0)\bigr) - f^{(n)}(x_0)\rvert : t \in [0,1]\bigr\}.\tag{3}$$
If $f(x_0) = f'(x_0) = \dotsc = f^{(n-1)}(x_0) = 0$, then $(2)$ directly yields
$$\frac{f(x)}{(x-x_0)^n} = \frac{f^{(n)}(x_0)}{n!} + \frac{R_n(f,x_0)(x)}{(x-x_0)^n}$$
for $x\neq x_0$, and by the continuity of $f^{(n)}$, $(3)$ yields
$$\biggl\lvert\frac{R_n(f,x_0)(x)}{(x-x_0)^n}\biggr\rvert \leqslant \frac{\sup\bigl\{\lvert f^{(n)}\bigl(x_0 + t(x-x_0)\bigr) - f^{(n)}(x_0)\rvert : t \in [0,1]\bigr\}}{(n-1)!} \xrightarrow{x\to x_0} 0,$$
since $\lvert x-x_0\rvert < \delta$ implies $\bigl\lvert \bigl(x_0 + t(x-x_0)\bigr) - x_0\bigr\rvert = t\lvert x-x_0\rvert < \delta$ for $t\in [0,1]$. Thus
$$\lim_{x\to x_0} \frac{f(x)}{(x-x_0)^n} = \frac{f^{(n)}(x_0)}{n!}$$
if $f$ has a zero of order $\geqslant n$ at $x_0$.
Conversely, if the limit exists, then $f^{(k)}(x_0) = 0$ for $0 \leqslant k < n$. For $0 \leqslant k < n$, if we already know that $f^{(r)}(x_0) = 0$ for $0 \leqslant r < k$ (for $k = 0$ this is an empty condition that is vacuously true), then from $(2)$ we obtain
\begin{align}
f^{(k)}(x_0) &= k!\lim_{x\to x_0} \frac{f(x)}{(x-x_0)^k} \\
&= k!\lim_{x\to x_0} \biggl((x-x_0)^{n-k}\cdot \frac{f(x)}{(x-x_0)^n}\biggr) \\
&= k!\lim_{x\to x_0} (x-x_0)^{n-k} \cdot \lim_{x\to x_0} \frac{f(x)}{(x-x_0)^n} \\
&= k!\cdot 0 \cdot \lim_{x\to x_0} \frac{f(x)}{(x-x_0)^n} \\
&= 0.
\end{align}
