Derivative of any number raised to the power of x

I know this is a piece of elementary calculus but I just worked it out from (more or less) first principles (as I knew what the answer was but did not know why).

Let y = r^x what is \frac{dy}{dx}?

r = e. k where k is some constant. Hence y=(ke)^x or k^xe^x

\frac{r}{e} = k and so \frac{e^{ln(r)}}{e} = k and so e^{ln(r) - 1} = k .

And e^{x(ln(r) - 1)}e^x = r^x , so e^{xln(r)} = r^x

Applying the chain rule u = xln(r) and y = e^u so \frac{dy}{du}\frac{du}{dx} = e^u \times ln(r)

Which is e^{xln(r)}ln(r) = r^xln(r)

Now I have written it all out I know there are redundant steps in there, but this is how I (re)discovered it…