Suppose $(M, g)$ is a Riemannian manifold, and $\gamma: I \rightarrow M$ is a regular (but not necessarily unit-speed) curve in $M$. Show that the geodesic curvature of $\gamma$ at $t\in I$ is $$\kappa(t)=\frac{\sqrt{|\gamma'(t)|^2|D_t\gamma'(t)|^2 - \langle \gamma'(t), D_t \gamma'(t) \rangle^2}}{|\gamma'(t)|^3}.$$
I've been searching for an error in my solution for hours but I can't find it. Here's my solution:
Let $\tilde\gamma = \gamma \circ\varphi$ be a unit-speed parametrization of $\gamma$. We start by listing identities.
By the product rule, $D_t \tilde\gamma'(\varphi^{-1}(t))= D_t \frac{\gamma'(t)}{|\gamma'(t)|}\implies\\ D_t \tilde\gamma'(\varphi^{-1}(t))= -\frac{|\gamma'(t)|'}{|\gamma'(t)|^2}\gamma'(t) + \frac{1}{|\gamma'(t)|}D_t \gamma'(t)\tag{i}$
Since $|\tilde\gamma'|$ is constant, $\langle \tilde\gamma'(\varphi^{-1}(t))\, , \, D_t \tilde\gamma'(\varphi^{-1}(t))\rangle = 0 \implies \\ \langle \frac{1}{|\gamma'(t)|}\gamma'(t)\, , \, D_t \tilde\gamma'(\varphi^{-1}(t))\rangle =0\tag{ii}$
By combining (i) and (ii), we have $\langle \frac{1}{|\gamma'(t)|}\gamma'(t)\, , \, -\frac{|\gamma'(t)|'}{|\gamma'(t)|^2}\gamma'(t) + \frac{1}{|\gamma'(t)|}D_t \gamma'(t)\rangle =0 \implies \\ -\frac{|\gamma'(t)|'}{|\gamma'(t)|^3}\langle\gamma'(t), \gamma'(t) \rangle + \frac{1}{|\gamma'(t)|^2} \langle\gamma'(t), D_t\gamma'(t) \rangle=0 \implies\\ \frac{\langle\gamma'(t), D_t\gamma'(t) \rangle}{|\gamma'(t)|}=|\gamma'(t)|' \tag{iii}$
Finally we compute: $(\kappa(t))^2=\langle D_t \tilde\gamma'(\varphi^{-1}(t))\, , \, D_t \tilde\gamma'(\varphi^{-1}(t)) \rangle \\ =\langle -\frac{|\gamma'(t)|'}{|\gamma'(t)|^2}\gamma'(t) + \frac{1}{|\gamma'(t)|}D_t \gamma'(t)\, , \, D_t \tilde\gamma'(\varphi^{-1}(t))\rangle \quad\quad \text{by (i)}\\ =\langle \frac{1}{|\gamma'(t)|}D_t \gamma'(t), \, -\frac{|\gamma'(t)|'}{|\gamma'(t)|^2}\gamma'(t) + \frac{1}{|\gamma'(t)|}D_t \gamma'(t)\rangle \quad\quad \text{by (i) and (ii)}\\ = -\frac{|\gamma'(t)|'}{|\gamma'(t)|^3}\langle \gamma'(t), D_t\gamma'(t)\rangle + \frac{|D_t\gamma'(t)|^2}{|\gamma'(t)|^2}\\ = -\frac{\langle \gamma'(t), D_t\gamma'(t)\rangle^2}{|\gamma'(t)|^4}+\frac{|D_t\gamma'(t)|^2}{|\gamma'(t)|^2} \quad\quad \text{by (iii)}\\ =\frac{|\gamma'(t)|^2|D_t\gamma'(t)|^2 - \langle \gamma'(t), D_t \gamma'(t) \rangle^2}{|\gamma'(t)|^4}$
But that final denominator is clearly supposed to be $|\gamma'(t)|^6$. Any help would be greatly appreciated.