Definition. Let $X$ be a metric space. A Borel measurable function $\rho:X\rightarrow[0,\infty]$ is an upper gradient for $u:X\rightarrow\mathbb R$, if for all $x,y\in X,x\neq y$ $$|u(x)-u(y)|\leq\int_\gamma\rho$$ for all rectifiable curves $\gamma$ connecting $x$ and $y$.
I want to show that, if $u$ is Lipschitz, then $$\rho(x):=\liminf_{r\rightarrow 0}\sup_{y\in B(x,r)}\frac{|u(x)-u(y)|}{r}$$ is an upper gradient for $u$.
This is an exercise from Juha Heinonen's book, Analysis on metric spaces.
A hint was to first consider the case that $X=I$ is an interval and using a suitable fine cover.
$\rho$ is well defined, since the limit is bounded by the Lipschitz constant of $u$.
Assume wlog that $x<y$. By parametrizing $\gamma$ by arc length, we only need to consider the path $$\gamma:[0,r],\quad\gamma(t)=x+t,$$ where $r=|x-y|$. Then \begin{align*} \int_\gamma\rho &=\int_0^r\rho(x+t)dt \\ &=\liminf_{k\rightarrow\infty}2^{-k}\sum_{j=0}^{2^k-1} \sup_{t\in(rj2^{-k},r(j+1)2^{-k})}\rho(x+t) \\ &\geq\liminf_{k\rightarrow\infty}\sum_{j=0}^{2^k-1} |u(x+rj2^{-k})-u(x+r(j+1)2^{-k})| \\ &\geq\liminf_{k\rightarrow\infty} \left|\sum_{j=0}^{2^k-1}u(x+rj2^{-k})-u(x+r(j+1)2^{-k})\right| \\ &=|u(x)-u(y)|, \end{align*} since the above is a telescoping sum. Thus $\rho$ is an upper gradient for $u$.
If $X$ is an arbitrary metric space, then we can do the same thing. Parametrize $\gamma$ by arc length, so that $|\gamma'|=1$. Then $$\int_\gamma\rho =\int_I \rho\circ\gamma(t)dt, $$ and now we can use the above calculation. Is this sufficient?